From ba42d97872a8a16adf382845e0fd8bf089df6482 Mon Sep 17 00:00:00 2001 From: "petrak@" Date: Sun, 20 Nov 2022 15:46:12 -0600 Subject: [PATCH 01/95] start work on arbitrary brainsweeps --- .../at/petrak/hexcasting/client/RenderLib.kt | 126 ++-- .../common/recipe/BrainsweepRecipe.java | 14 +- .../common/recipe/HexRecipeStuffRegistry.java | 8 +- .../brainsweep/BrainsweepIngredient.java | 48 ++ .../EntityBrainsweepIngredient.java | 51 ++ .../VillagerBrainsweepIngredient.java} | 114 ++-- .../datagen/recipe/HexplatRecipes.kt | 564 +++++++++--------- .../builders/BrainsweepRecipeBuilder.java | 22 +- .../fabric/interop/emi/HexEMIPlugin.java | 56 +- .../fabric/interop/emi/VillagerEmiStack.java | 38 +- .../fabric/interop/emi/VillagerVariant.java | 4 +- 11 files changed, 575 insertions(+), 470 deletions(-) create mode 100644 Common/src/main/java/at/petrak/hexcasting/common/recipe/ingredient/brainsweep/BrainsweepIngredient.java create mode 100644 Common/src/main/java/at/petrak/hexcasting/common/recipe/ingredient/brainsweep/EntityBrainsweepIngredient.java rename Common/src/main/java/at/petrak/hexcasting/common/recipe/ingredient/{VillagerIngredient.java => brainsweep/VillagerBrainsweepIngredient.java} (73%) diff --git a/Common/src/main/java/at/petrak/hexcasting/client/RenderLib.kt b/Common/src/main/java/at/petrak/hexcasting/client/RenderLib.kt index eabeb1aa..90b3ebd6 100644 --- a/Common/src/main/java/at/petrak/hexcasting/client/RenderLib.kt +++ b/Common/src/main/java/at/petrak/hexcasting/client/RenderLib.kt @@ -9,7 +9,7 @@ import at.petrak.hexcasting.api.utils.getValue import at.petrak.hexcasting.api.utils.setValue import at.petrak.hexcasting.api.utils.weakMapped import at.petrak.hexcasting.client.gui.GuiSpellcasting -import at.petrak.hexcasting.common.recipe.ingredient.VillagerIngredient +import at.petrak.hexcasting.common.recipe.ingredient.brainsweep.BrainsweepIngredient import com.mojang.blaze3d.systems.RenderSystem import com.mojang.blaze3d.vertex.DefaultVertexFormat import com.mojang.blaze3d.vertex.PoseStack @@ -51,12 +51,12 @@ val CAP_THETA: Float = 18f * Please make sure to enable the right asinine shaders; see [GuiSpellcasting] */ fun drawLineSeq( - mat: Matrix4f, - points: List, - width: Float, - z: Float, - tail: Int, - head: Int, + mat: Matrix4f, + points: List, + width: Float, + z: Float, + tail: Int, + head: Int, ) { if (points.size <= 1) return @@ -86,15 +86,15 @@ fun drawLineSeq( val prev = p1.add(p0.negated()) val next = p2.add(p1.negated()) val angle = - Mth.atan2((prev.x * next.y - prev.y * next.x).toDouble(), (prev.x * next.x + prev.y * next.y).toDouble()) - .toFloat() + Mth.atan2((prev.x * next.y - prev.y * next.x).toDouble(), (prev.x * next.x + prev.y * next.y).toDouble()) + .toFloat() joinAngles[i - 1] = angle val clamp = Math.min(prev.length(), next.length()) / (width * 0.5f); joinOffsets[i - 1] = Mth.clamp(Mth.sin(angle) / (1 + Mth.cos(angle)), -clamp, clamp) } fun vertex(color: BlockPos, pos: Vec2) = - buf.vertex(mat, pos.x, pos.y, z).color(color.x, color.y, color.z, a).endVertex() + buf.vertex(mat, pos.x, pos.y, z).color(color.x, color.y, color.z, a).endVertex() for ((i, pair) in points.zipWithNext().withIndex()) { val (p1, p2) = pair // https://github.com/not-fl3/macroquad/blob/master/src/shapes.rs#L163 @@ -104,7 +104,7 @@ fun drawLineSeq( val normal = Vec2(-tangent.y, tangent.x) fun color(time: Float): BlockPos = - BlockPos(Mth.lerp(time, r1, r2).toInt(), Mth.lerp(time, g1, g2).toInt(), Mth.lerp(time, b1, b2).toInt()) + BlockPos(Mth.lerp(time, r1, r2).toInt(), Mth.lerp(time, g1, g2).toInt(), Mth.lerp(time, b1, b2).toInt()) val color1 = color(i.toFloat() / n) val color2 = color((i + 1f) / n) @@ -170,13 +170,13 @@ fun rotate(vec: Vec2, theta: Float): Vec2 { * * you have to do the conversion yourself.) * */ fun drawPatternFromPoints( - mat: Matrix4f, - points: List, - dupIndices: Set?, - drawLast: Boolean, - tail: Int, - head: Int, - flowIrregular: Float, + mat: Matrix4f, + points: List, + dupIndices: Set?, + drawLast: Boolean, + tail: Int, + head: Int, + flowIrregular: Float, ) { val zappyPts = makeZappy(points, dupIndices, 10f, 2.5f, 0.1f, flowIrregular) val nodes = if (drawLast) { @@ -188,26 +188,26 @@ fun drawPatternFromPoints( drawLineSeq(mat, zappyPts, 2f, 1f, screenCol(tail), screenCol(head)) for (node in nodes) { drawSpot( - mat, - node, - 2f, - dodge(FastColor.ARGB32.red(head)) / 255f, - dodge(FastColor.ARGB32.green(head)) / 255f, - dodge(FastColor.ARGB32.blue(head)) / 255f, - FastColor.ARGB32.alpha(head) / 255f + mat, + node, + 2f, + dodge(FastColor.ARGB32.red(head)) / 255f, + dodge(FastColor.ARGB32.green(head)) / 255f, + dodge(FastColor.ARGB32.blue(head)) / 255f, + FastColor.ARGB32.alpha(head) / 255f ); } } fun makeZappy( - points: List, - dupIndices: Set?, - hops: Float, - variance: Float, - speed: Float, - flowIrregular: Float + points: List, + dupIndices: Set?, + hops: Float, + variance: Float, + speed: Float, + flowIrregular: Float ) = - makeZappy(points, dupIndices, hops.toInt(), variance, speed, flowIrregular, 0.2f) + makeZappy(points, dupIndices, hops.toInt(), variance, speed, flowIrregular, 0.2f) /** * Split up a sequence of linePoints with a lightning effect @@ -215,8 +215,8 @@ fun makeZappy( * @param speed: rate at which the lightning effect should move/shake/etc */ fun makeZappy( - barePoints: List, dupIndices: Set?, hops: Int, variance: Float, speed: Float, flowIrregular: Float, - readabilityOffset: Float + barePoints: List, dupIndices: Set?, hops: Int, variance: Float, speed: Float, flowIrregular: Float, + readabilityOffset: Float ): List { // Nothing in, nothing out if (barePoints.isEmpty()) { @@ -245,14 +245,14 @@ fun makeZappy( // and zSeed (i.e. time elapsed) to perturb the shape gradually over time) val minorPerturb = NOISE.getValue(i.toDouble(), j.toDouble(), sin(zSeed)) * flowIrregular val theta = (3 * NOISE.getValue( - i.toDouble() + j.toDouble() / (hops + 1) + minorPerturb - zSeed, - 1337.0, - 0.0 + i.toDouble() + j.toDouble() / (hops + 1) + minorPerturb - zSeed, + 1337.0, + 0.0 ) * TAU).toFloat() val r = (NOISE.getValue( - i.toDouble() + j.toDouble() / (hops + 1) - zSeed, - 69420.0, - 0.0 + i.toDouble() + j.toDouble() / (hops + 1) - zSeed, + 69420.0, + 0.0 ) * maxVariance * scaleVariance(progress)).toFloat() val randomHop = Vec2(r * Mth.cos(theta), r * Mth.sin(theta)) // Then record the new location. @@ -333,10 +333,10 @@ fun drawSpot(mat: Matrix4f, point: Vec2, radius: Float, r: Float, g: Float, b: F fun screenCol(n: Int): Int { return FastColor.ARGB32.color( - FastColor.ARGB32.alpha(n), - screen(FastColor.ARGB32.red(n)), - screen(FastColor.ARGB32.green(n)), - screen(FastColor.ARGB32.blue(n)), + FastColor.ARGB32.alpha(n), + screen(FastColor.ARGB32.red(n)), + screen(FastColor.ARGB32.green(n)), + screen(FastColor.ARGB32.blue(n)), ) } @@ -363,7 +363,7 @@ fun getCenteredPattern(pattern: HexPattern, width: Float, height: Float, minSize } } val scale = - min(minSize, min(width / 3f / maxDx, height / 3f / maxDy)) + min(minSize, min(width / 3f / maxDx, height / 3f / maxDy)) val com2: Vec2 = pattern.getCenter(scale) val lines2: List = pattern.toLines(scale, com2.negated()) return scale to lines2 @@ -385,12 +385,12 @@ fun transferMsToGl(ms: PoseStack, toRun: Runnable) { private var villager: Villager? by weakMapped(Villager::level) -fun prepareVillagerForRendering(ingredient: VillagerIngredient, level: Level): Villager { +fun prepareVillagerForRendering(ingredient: BrainsweepIngredient, level: Level): Villager { val minLevel: Int = ingredient.minLevel() val profession: VillagerProfession = Registry.VILLAGER_PROFESSION.getOptional(ingredient.profession()) - .orElse(VillagerProfession.NONE) + .orElse(VillagerProfession.NONE) val biome: VillagerType = Registry.VILLAGER_TYPE.getOptional(ingredient.biome()) - .orElse(VillagerType.PLAINS) + .orElse(VillagerType.PLAINS) val instantiatedVillager = villager ?: run { val newVillager = Villager(EntityType.VILLAGER, level) @@ -399,18 +399,18 @@ fun prepareVillagerForRendering(ingredient: VillagerIngredient, level: Level): V } instantiatedVillager.villagerData = instantiatedVillager.villagerData - .setProfession(profession) - .setType(biome) - .setLevel(minLevel) + .setProfession(profession) + .setType(biome) + .setLevel(minLevel) return instantiatedVillager } @JvmOverloads fun renderEntity( - ms: PoseStack, entity: Entity, world: Level, x: Float, y: Float, rotation: Float, - renderScale: Float, offset: Float, - bufferTransformer: (MultiBufferSource) -> MultiBufferSource = { it -> it } + ms: PoseStack, entity: Entity, world: Level, x: Float, y: Float, rotation: Float, + renderScale: Float, offset: Float, + bufferTransformer: (MultiBufferSource) -> MultiBufferSource = { it -> it } ) { entity.level = world ms.pushPose() @@ -432,23 +432,23 @@ fun renderEntity( * Make sure you have the `PositionColorShader` set */ fun renderQuad( - ps: PoseStack, x: Float, y: Float, w: Float, h: Float, color: Int + ps: PoseStack, x: Float, y: Float, w: Float, h: Float, color: Int ) { val mat = ps.last().pose() val tess = Tesselator.getInstance() val buf = tess.builder buf.begin(VertexFormat.Mode.QUADS, DefaultVertexFormat.POSITION_COLOR) buf.vertex(mat, x, y, 0f) - .color(color) - .endVertex() + .color(color) + .endVertex() buf.vertex(mat, x, y + h, 0f) - .color(color) - .endVertex() + .color(color) + .endVertex() buf.vertex(mat, x + w, y + h, 0f) - .color(color) - .endVertex() + .color(color) + .endVertex() buf.vertex(mat, x + w, y, 0f) - .color(color) - .endVertex() + .color(color) + .endVertex() tess.end() } diff --git a/Common/src/main/java/at/petrak/hexcasting/common/recipe/BrainsweepRecipe.java b/Common/src/main/java/at/petrak/hexcasting/common/recipe/BrainsweepRecipe.java index 6abb5470..b19bed30 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/recipe/BrainsweepRecipe.java +++ b/Common/src/main/java/at/petrak/hexcasting/common/recipe/BrainsweepRecipe.java @@ -2,7 +2,7 @@ package at.petrak.hexcasting.common.recipe; import at.petrak.hexcasting.common.recipe.ingredient.StateIngredient; import at.petrak.hexcasting.common.recipe.ingredient.StateIngredientHelper; -import at.petrak.hexcasting.common.recipe.ingredient.VillagerIngredient; +import at.petrak.hexcasting.common.recipe.ingredient.brainsweep.BrainsweepIngredient; import com.google.gson.JsonObject; import net.minecraft.network.FriendlyByteBuf; import net.minecraft.resources.ResourceLocation; @@ -21,10 +21,10 @@ import org.jetbrains.annotations.NotNull; // God I am a horrible person public record BrainsweepRecipe( - ResourceLocation id, - StateIngredient blockIn, - VillagerIngredient villagerIn, - BlockState result + ResourceLocation id, + StateIngredient blockIn, + BrainsweepIngredient villagerIn, + BlockState result ) implements Recipe { public boolean matches(BlockState blockIn, Villager villagerIn) { return this.blockIn.test(blockIn) && this.villagerIn.test(villagerIn); @@ -84,7 +84,7 @@ public record BrainsweepRecipe( @Override public @NotNull BrainsweepRecipe fromJson(ResourceLocation recipeID, JsonObject json) { var blockIn = StateIngredientHelper.deserialize(GsonHelper.getAsJsonObject(json, "blockIn")); - var villagerIn = VillagerIngredient.deserialize(GsonHelper.getAsJsonObject(json, "villagerIn")); + var villagerIn = BrainsweepIngredient.deserialize(GsonHelper.getAsJsonObject(json, "villagerIn")); var result = StateIngredientHelper.readBlockState(GsonHelper.getAsJsonObject(json, "result")); return new BrainsweepRecipe(recipeID, blockIn, villagerIn, result); } @@ -99,7 +99,7 @@ public record BrainsweepRecipe( @Override public @NotNull BrainsweepRecipe fromNetwork(ResourceLocation recipeID, FriendlyByteBuf buf) { var blockIn = StateIngredientHelper.read(buf); - var villagerIn = VillagerIngredient.read(buf); + var villagerIn = BrainsweepIngredient.read(buf); var result = Block.stateById(buf.readVarInt()); return new BrainsweepRecipe(recipeID, blockIn, villagerIn, result); } diff --git a/Common/src/main/java/at/petrak/hexcasting/common/recipe/HexRecipeStuffRegistry.java b/Common/src/main/java/at/petrak/hexcasting/common/recipe/HexRecipeStuffRegistry.java index be386a17..2fe4cfe7 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/recipe/HexRecipeStuffRegistry.java +++ b/Common/src/main/java/at/petrak/hexcasting/common/recipe/HexRecipeStuffRegistry.java @@ -30,12 +30,12 @@ public class HexRecipeStuffRegistry { // TODO: custom costs in brainsweeping. also custom entities but we'll getting there public static final RecipeSerializer BRAINSWEEP = registerSerializer("brainsweep", - new BrainsweepRecipe.Serializer()); + new BrainsweepRecipe.Serializer()); public static final RecipeSerializer SEAL_FOCUS = registerSerializer("seal_focus", - SealFocusRecipe.SERIALIZER); + SealFocusRecipe.SERIALIZER); public static final RecipeSerializer SEAL_SPELLBOOK = registerSerializer( - "seal_spellbook", - SealSpellbookRecipe.SERIALIZER); + "seal_spellbook", + SealSpellbookRecipe.SERIALIZER); public static RecipeType BRAINSWEEP_TYPE = registerType("brainsweep"); diff --git a/Common/src/main/java/at/petrak/hexcasting/common/recipe/ingredient/brainsweep/BrainsweepIngredient.java b/Common/src/main/java/at/petrak/hexcasting/common/recipe/ingredient/brainsweep/BrainsweepIngredient.java new file mode 100644 index 00000000..1f55f593 --- /dev/null +++ b/Common/src/main/java/at/petrak/hexcasting/common/recipe/ingredient/brainsweep/BrainsweepIngredient.java @@ -0,0 +1,48 @@ +package at.petrak.hexcasting.common.recipe.ingredient.brainsweep; + +import com.google.gson.JsonObject; +import net.minecraft.network.FriendlyByteBuf; +import net.minecraft.network.chat.Component; +import net.minecraft.util.GsonHelper; +import net.minecraft.util.StringRepresentable; +import net.minecraft.world.entity.Entity; + +import java.util.List; +import java.util.function.Predicate; + +public abstract class BrainsweepIngredient implements Predicate { + public abstract List getTooltip(boolean advanced); + + public abstract JsonObject serialize(); + + public abstract void write(FriendlyByteBuf buf); + + public static BrainsweepIngredient read(FriendlyByteBuf buf) { + var type = buf.readVarInt(); + return switch (Type.values()[type]) { + case VILLAGER -> VillagerBrainsweepIngredient.read(buf); + case ENTITY -> { + } + }; + } + + public static BrainsweepIngredient deserialize(JsonObject json) { + var typestr = GsonHelper.getAsString(json, "type"); + var type = Type.valueOf(typestr); + return switch (type) { + case VILLAGER -> VillagerBrainsweepIngredient.deserialize(json); + case ENTITY -> null; + }; + } + + public enum Type implements StringRepresentable { + VILLAGER, + ENTITY; + + @Override + public String getSerializedName() { + return this.toString(); + } + } + +} diff --git a/Common/src/main/java/at/petrak/hexcasting/common/recipe/ingredient/brainsweep/EntityBrainsweepIngredient.java b/Common/src/main/java/at/petrak/hexcasting/common/recipe/ingredient/brainsweep/EntityBrainsweepIngredient.java new file mode 100644 index 00000000..8ba7460c --- /dev/null +++ b/Common/src/main/java/at/petrak/hexcasting/common/recipe/ingredient/brainsweep/EntityBrainsweepIngredient.java @@ -0,0 +1,51 @@ +package at.petrak.hexcasting.common.recipe.ingredient.brainsweep; + +import com.google.gson.JsonObject; +import net.minecraft.advancements.critereon.DeserializationContext; +import net.minecraft.advancements.critereon.EntityPredicate; +import net.minecraft.advancements.critereon.SerializationContext; +import net.minecraft.network.FriendlyByteBuf; +import net.minecraft.network.chat.Component; +import net.minecraft.world.entity.Entity; +import net.minecraft.world.level.storage.loot.predicates.LootItemCondition; + +import java.util.List; + +public class EntityBrainsweepIngredient extends BrainsweepIngredient { + public final EntityPredicate.Composite requirements; + // Just tell the player what it is you want + public final Component tooltip; + + protected EntityBrainsweepIngredient(EntityPredicate.Composite requirements, Component tooltip) { + super(); + this.requirements = requirements; + this.tooltip = tooltip; + } + + @Override + public boolean test(Entity entity) { + return false; + } + + @Override + public List getTooltip(boolean advanced) { + return List.of(this.tooltip); + } + + @Override + public JsonObject serialize() { + var obj = new JsonObject(); + obj.add("requirements", this.requirements.toJson(SerializationContext.INSTANCE)); + obj.addProperty("tooltip", Component.Serializer.toJson(this.tooltip)); + return obj; + } + + @Override + public void write(FriendlyByteBuf buf) { + + } + + public static EntityBrainsweepIngredient deserialize(JsonObject obj) { + var reqs = EntityPredicate.Composite.fromJson(obj, "requirements", DeserializationContext) + } +} diff --git a/Common/src/main/java/at/petrak/hexcasting/common/recipe/ingredient/VillagerIngredient.java b/Common/src/main/java/at/petrak/hexcasting/common/recipe/ingredient/brainsweep/VillagerBrainsweepIngredient.java similarity index 73% rename from Common/src/main/java/at/petrak/hexcasting/common/recipe/ingredient/VillagerIngredient.java rename to Common/src/main/java/at/petrak/hexcasting/common/recipe/ingredient/brainsweep/VillagerBrainsweepIngredient.java index 07267048..4d4ff14a 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/recipe/ingredient/VillagerIngredient.java +++ b/Common/src/main/java/at/petrak/hexcasting/common/recipe/ingredient/brainsweep/VillagerBrainsweepIngredient.java @@ -1,4 +1,4 @@ -package at.petrak.hexcasting.common.recipe.ingredient; +package at.petrak.hexcasting.common.recipe.ingredient.brainsweep; import at.petrak.hexcasting.xplat.IXplatAbstractions; import com.google.gson.JsonObject; @@ -9,7 +9,7 @@ import net.minecraft.network.chat.Component; import net.minecraft.network.chat.MutableComponent; import net.minecraft.resources.ResourceLocation; import net.minecraft.util.GsonHelper; -import net.minecraft.util.Mth; +import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.EntityType; import net.minecraft.world.entity.npc.Villager; import org.jetbrains.annotations.Nullable; @@ -17,24 +17,64 @@ import org.jetbrains.annotations.Nullable; import java.util.ArrayList; import java.util.List; import java.util.Objects; -import java.util.function.Predicate; -// you ever step back and realize the thoughts that have coursed through your mind for so long -// they've become second nature are in fact incredibly horrific? -// jesus christ I'm making a class called `VillagerIngredient` -public record VillagerIngredient( - @Nullable ResourceLocation profession, - @Nullable ResourceLocation biome, // aka their "type" - int minLevel -) implements Predicate { +/** + * Special case for villagers so we can have biome/profession/level reqs + */ +public class VillagerBrainsweepIngredient extends BrainsweepIngredient { + private final @Nullable ResourceLocation profession; + private final @Nullable ResourceLocation biome; + private final int minLevel; + + protected VillagerBrainsweepIngredient( + @Nullable ResourceLocation profession, + @Nullable ResourceLocation biome, // aka their "type" + int minLevel + ) { + super(); + this.profession = profession; + this.biome = biome; + this.minLevel = minLevel; + } + @Override - public boolean test(Villager villager) { + public boolean test(Entity entity) { + if (!(entity instanceof Villager villager)) return false; + var data = villager.getVillagerData(); ResourceLocation profID = IXplatAbstractions.INSTANCE.getID(data.getProfession()); return (this.profession == null || this.profession.equals(profID)) - && (this.biome == null || this.biome.equals(Registry.VILLAGER_TYPE.getKey(data.getType()))) - && this.minLevel <= data.getLevel(); + && (this.biome == null || this.biome.equals(Registry.VILLAGER_TYPE.getKey(data.getType()))) + && this.minLevel <= data.getLevel(); + } + + @Override + public List getTooltip(boolean advanced) { + List tooltip = new ArrayList<>(); + tooltip.add(name()); + + if (advanced) { + if (minLevel >= 5) { + tooltip.add(Component.translatable("hexcasting.tooltip.brainsweep.level", 5) + .withStyle(ChatFormatting.DARK_GRAY)); + } else if (minLevel > 1) { + tooltip.add(Component.translatable("hexcasting.tooltip.brainsweep.min_level", minLevel) + .withStyle(ChatFormatting.DARK_GRAY)); + } + + if (biome != null) { + tooltip.add(Component.literal(biome.toString()).withStyle(ChatFormatting.DARK_GRAY)); + } + + ResourceLocation displayId = Objects.requireNonNullElseGet(profession, + () -> Registry.ENTITY_TYPE.getKey(EntityType.VILLAGER)); + tooltip.add(Component.literal(displayId.toString()).withStyle(ChatFormatting.DARK_GRAY)); + } + + tooltip.add(getModNameComponent()); + + return tooltip; } public Component name() { @@ -75,48 +115,13 @@ public record VillagerIngredient( return component; } - public List getTooltip(boolean advanced) { - return getTooltip(advanced, true); - } - - public List getTooltip(boolean advanced, boolean orHigher) { - List tooltip = new ArrayList<>(); - tooltip.add(name()); - - if (advanced) { - if (orHigher) { - if (minLevel >= 5) { - tooltip.add(Component.translatable("hexcasting.tooltip.brainsweep.level", 5) - .withStyle(ChatFormatting.DARK_GRAY)); - } else if (minLevel > 1) { - tooltip.add(Component.translatable("hexcasting.tooltip.brainsweep.min_level", minLevel) - .withStyle(ChatFormatting.DARK_GRAY)); - } - } else if (profession != null || minLevel > 1) { - tooltip.add(Component.translatable("hexcasting.tooltip.brainsweep.level", Mth.clamp(minLevel, 1, 5)) - .withStyle(ChatFormatting.DARK_GRAY)); - } - - if (biome != null) { - tooltip.add(Component.literal(biome.toString()).withStyle(ChatFormatting.DARK_GRAY)); - } - - ResourceLocation displayId = Objects.requireNonNullElseGet(profession, - () -> Registry.ENTITY_TYPE.getKey(EntityType.VILLAGER)); - tooltip.add(Component.literal(displayId.toString()).withStyle(ChatFormatting.DARK_GRAY)); - } - - tooltip.add(getModNameComponent()); - - return tooltip; - } - public Component getModNameComponent() { String namespace = profession == null ? "minecraft" : profession.getNamespace(); String mod = IXplatAbstractions.INSTANCE.getModName(namespace); return Component.literal(mod).withStyle(ChatFormatting.BLUE, ChatFormatting.ITALIC); } + @Override public JsonObject serialize() { var obj = new JsonObject(); if (this.profession != null) { @@ -129,6 +134,7 @@ public record VillagerIngredient( return obj; } + @Override public void write(FriendlyByteBuf buf) { if (this.profession != null) { buf.writeVarInt(1); @@ -145,7 +151,7 @@ public record VillagerIngredient( buf.writeInt(this.minLevel); } - public static VillagerIngredient deserialize(JsonObject json) { + public static VillagerBrainsweepIngredient deserialize(JsonObject json) { ResourceLocation profession = null; if (json.has("profession")) { profession = new ResourceLocation(GsonHelper.getAsString(json, "profession")); @@ -155,10 +161,10 @@ public record VillagerIngredient( biome = new ResourceLocation(GsonHelper.getAsString(json, "biome")); } int minLevel = GsonHelper.getAsInt(json, "minLevel"); - return new VillagerIngredient(profession, biome, minLevel); + return new VillagerBrainsweepIngredient(profession, biome, minLevel); } - public static VillagerIngredient read(FriendlyByteBuf buf) { + public static VillagerBrainsweepIngredient read(FriendlyByteBuf buf) { ResourceLocation profession = null; var hasProfession = buf.readVarInt(); if (hasProfession != 0) { @@ -170,6 +176,6 @@ public record VillagerIngredient( biome = buf.readResourceLocation(); } int minLevel = buf.readInt(); - return new VillagerIngredient(profession, biome, minLevel); + return new VillagerBrainsweepIngredient(profession, biome, minLevel); } } diff --git a/Common/src/main/java/at/petrak/hexcasting/datagen/recipe/HexplatRecipes.kt b/Common/src/main/java/at/petrak/hexcasting/datagen/recipe/HexplatRecipes.kt index aa1cbc80..c75b1ea0 100644 --- a/Common/src/main/java/at/petrak/hexcasting/datagen/recipe/HexplatRecipes.kt +++ b/Common/src/main/java/at/petrak/hexcasting/datagen/recipe/HexplatRecipes.kt @@ -10,7 +10,7 @@ import at.petrak.hexcasting.common.lib.HexItems import at.petrak.hexcasting.common.recipe.SealFocusRecipe import at.petrak.hexcasting.common.recipe.SealSpellbookRecipe import at.petrak.hexcasting.common.recipe.ingredient.StateIngredientHelper -import at.petrak.hexcasting.common.recipe.ingredient.VillagerIngredient +import at.petrak.hexcasting.common.recipe.ingredient.brainsweep.BrainsweepIngredient import at.petrak.hexcasting.datagen.IXplatConditionsBuilder import at.petrak.hexcasting.datagen.IXplatIngredients import at.petrak.hexcasting.datagen.recipe.builders.BrainsweepRecipeBuilder @@ -36,9 +36,9 @@ import net.minecraft.world.level.block.Blocks import java.util.function.Consumer class HexplatRecipes( - val generator: DataGenerator, - val ingredients: IXplatIngredients, - val conditions: (RecipeBuilder) -> IXplatConditionsBuilder + val generator: DataGenerator, + val ingredients: IXplatIngredients, + val conditions: (RecipeBuilder) -> IXplatConditionsBuilder ) : PaucalRecipeProvider(generator, HexAPI.MOD_ID) { override fun makeRecipes(recipes: Consumer) { @@ -56,78 +56,78 @@ class HexplatRecipes( wandRecipe(recipes, HexItems.STAFF_EDIFIED, HexBlocks.EDIFIED_PLANKS.asItem()) ringCornered(HexItems.FOCUS, 1, - ingredients.glowstoneDust(), - ingredients.leather(), - Ingredient.of(HexItems.CHARGED_AMETHYST)) - .unlockedBy("has_item", hasItem(HexItemTags.STAVES)) - .save(recipes) + ingredients.glowstoneDust(), + ingredients.leather(), + Ingredient.of(HexItems.CHARGED_AMETHYST)) + .unlockedBy("has_item", hasItem(HexItemTags.STAVES)) + .save(recipes) ShapedRecipeBuilder.shaped(HexItems.SPELLBOOK) - .define('N', ingredients.goldNugget()) - .define('B', Items.WRITABLE_BOOK) - .define('A', HexItems.CHARGED_AMETHYST) - .define('F', Items.CHORUS_FRUIT) // i wanna gate this behind the end SOMEHOW - // hey look its my gender ^^ - .pattern("NBA") - .pattern("NFA") - .pattern("NBA") - .unlockedBy("has_focus", hasItem(HexItems.FOCUS)) - .unlockedBy("has_chorus", hasItem(Items.CHORUS_FRUIT)).save(recipes) + .define('N', ingredients.goldNugget()) + .define('B', Items.WRITABLE_BOOK) + .define('A', HexItems.CHARGED_AMETHYST) + .define('F', Items.CHORUS_FRUIT) // i wanna gate this behind the end SOMEHOW + // hey look its my gender ^^ + .pattern("NBA") + .pattern("NFA") + .pattern("NBA") + .unlockedBy("has_focus", hasItem(HexItems.FOCUS)) + .unlockedBy("has_chorus", hasItem(Items.CHORUS_FRUIT)).save(recipes) ringCornerless( - HexItems.CYPHER, 1, - ingredients.copperIngot(), - Ingredient.of(HexItems.AMETHYST_DUST)) - .unlockedBy("has_item", hasItem(HexItemTags.STAVES)).save(recipes) + HexItems.CYPHER, 1, + ingredients.copperIngot(), + Ingredient.of(HexItems.AMETHYST_DUST)) + .unlockedBy("has_item", hasItem(HexItemTags.STAVES)).save(recipes) ringCornerless( - HexItems.TRINKET, 1, - ingredients.ironIngot(), - Ingredient.of(Items.AMETHYST_SHARD)) - .unlockedBy("has_item", hasItem(HexItemTags.STAVES)).save(recipes) + HexItems.TRINKET, 1, + ingredients.ironIngot(), + Ingredient.of(Items.AMETHYST_SHARD)) + .unlockedBy("has_item", hasItem(HexItemTags.STAVES)).save(recipes) ShapedRecipeBuilder.shaped(HexItems.ARTIFACT) - .define('F', ingredients.goldIngot()) - .define('A', HexItems.CHARGED_AMETHYST) - // why in god's name does minecraft have two different places for item tags - .define('D', ItemTags.MUSIC_DISCS) - .pattern(" F ") - .pattern("FAF") - .pattern(" D ") - .unlockedBy("has_item", hasItem(HexItemTags.STAVES)).save(recipes) + .define('F', ingredients.goldIngot()) + .define('A', HexItems.CHARGED_AMETHYST) + // why in god's name does minecraft have two different places for item tags + .define('D', ItemTags.MUSIC_DISCS) + .pattern(" F ") + .pattern("FAF") + .pattern(" D ") + .unlockedBy("has_item", hasItem(HexItemTags.STAVES)).save(recipes) ringCornerless(HexItems.SCRYING_LENS, 1, Items.GLASS, HexItems.AMETHYST_DUST) - .unlockedBy("has_item", hasItem(HexItemTags.STAVES)).save(recipes) + .unlockedBy("has_item", hasItem(HexItemTags.STAVES)).save(recipes) ShapedRecipeBuilder.shaped(HexItems.ABACUS) - .define('S', Items.STICK) - .define('A', Items.AMETHYST_SHARD) - .define('W', ItemTags.PLANKS) - .pattern("WAW") - .pattern("SAS") - .pattern("WAW") - .unlockedBy("has_item", hasItem(HexItemTags.STAVES)).save(recipes) + .define('S', Items.STICK) + .define('A', Items.AMETHYST_SHARD) + .define('W', ItemTags.PLANKS) + .pattern("WAW") + .pattern("SAS") + .pattern("WAW") + .unlockedBy("has_item", hasItem(HexItemTags.STAVES)).save(recipes) // Why am I like this ShapedRecipeBuilder.shaped(HexItems.SUBMARINE_SANDWICH) - .define('S', Items.STICK) - .define('A', Items.AMETHYST_SHARD) - .define('C', Items.COOKED_BEEF) - .define('B', Items.BREAD) - .pattern(" SA") - .pattern(" C ") - .pattern(" B ") - .unlockedBy("has_item", hasItem(Items.AMETHYST_SHARD)).save(recipes) + .define('S', Items.STICK) + .define('A', Items.AMETHYST_SHARD) + .define('C', Items.COOKED_BEEF) + .define('B', Items.BREAD) + .pattern(" SA") + .pattern(" C ") + .pattern(" B ") + .unlockedBy("has_item", hasItem(Items.AMETHYST_SHARD)).save(recipes) for (dye in DyeColor.values()) { val item = HexItems.DYE_COLORIZERS[dye]!! ShapedRecipeBuilder.shaped(item) - .define('D', HexItems.AMETHYST_DUST) - .define('C', DyeItem.byColor(dye)) - .pattern(" D ") - .pattern("DCD") - .pattern(" D ") - .unlockedBy("has_item", hasItem(HexItems.AMETHYST_DUST)).save(recipes) + .define('D', HexItems.AMETHYST_DUST) + .define('C', DyeItem.byColor(dye)) + .pattern(" D ") + .pattern("DCD") + .pattern(" D ") + .unlockedBy("has_item", hasItem(HexItems.AMETHYST_DUST)).save(recipes) } gayRecipe(recipes, ItemPrideColorizer.Type.AGENDER, Ingredient.of(Items.GLASS)) @@ -144,337 +144,337 @@ class HexplatRecipes( gayRecipe(recipes, ItemPrideColorizer.Type.LESBIAN, Ingredient.of(Items.HONEYCOMB)) gayRecipe(recipes, ItemPrideColorizer.Type.NONBINARY, Ingredient.of(Items.MOSS_BLOCK)) gayRecipe(recipes, ItemPrideColorizer.Type.PANSEXUAL, ingredients.whenModIngredient( - Ingredient.of(Items.CARROT), - "farmersdelight", - CompatIngredientValue.of("farmersdelight:skillet") + Ingredient.of(Items.CARROT), + "farmersdelight", + CompatIngredientValue.of("farmersdelight:skillet") )) gayRecipe(recipes, ItemPrideColorizer.Type.PLURAL, Ingredient.of(Items.REPEATER)) gayRecipe(recipes, ItemPrideColorizer.Type.TRANSGENDER, Ingredient.of(Items.EGG)) ShapedRecipeBuilder.shaped(HexItems.UUID_COLORIZER) - .define('B', Items.BOWL) - .define('D', HexItems.AMETHYST_DUST) - .define('C', Items.AMETHYST_SHARD) - .pattern(" C ") - .pattern(" D ") - .pattern(" B ") - .unlockedBy("has_item", hasItem(HexItems.AMETHYST_DUST)).save(recipes) + .define('B', Items.BOWL) + .define('D', HexItems.AMETHYST_DUST) + .define('C', Items.AMETHYST_SHARD) + .pattern(" C ") + .pattern(" D ") + .pattern(" B ") + .unlockedBy("has_item", hasItem(HexItems.AMETHYST_DUST)).save(recipes) ShapedRecipeBuilder.shaped(HexItems.SCROLL_SMOL) - .define('P', Items.PAPER) - .define('A', Items.AMETHYST_SHARD) - .pattern(" A") - .pattern("P ") - .unlockedBy("has_item", hasItem(Items.AMETHYST_SHARD)).save(recipes) + .define('P', Items.PAPER) + .define('A', Items.AMETHYST_SHARD) + .pattern(" A") + .pattern("P ") + .unlockedBy("has_item", hasItem(Items.AMETHYST_SHARD)).save(recipes) ShapedRecipeBuilder.shaped(HexItems.SCROLL_MEDIUM) - .define('P', Items.PAPER) - .define('A', Items.AMETHYST_SHARD) - .pattern(" A") - .pattern("PP ") - .pattern("PP ") - .unlockedBy("has_item", hasItem(Items.AMETHYST_SHARD)).save(recipes) + .define('P', Items.PAPER) + .define('A', Items.AMETHYST_SHARD) + .pattern(" A") + .pattern("PP ") + .pattern("PP ") + .unlockedBy("has_item", hasItem(Items.AMETHYST_SHARD)).save(recipes) ShapedRecipeBuilder.shaped(HexItems.SCROLL_LARGE) - .define('P', Items.PAPER) - .define('A', Items.AMETHYST_SHARD) - .pattern("PPA") - .pattern("PPP") - .pattern("PPP") - .unlockedBy("has_item", hasItem(Items.AMETHYST_SHARD)).save(recipes) + .define('P', Items.PAPER) + .define('A', Items.AMETHYST_SHARD) + .pattern("PPA") + .pattern("PPP") + .pattern("PPP") + .unlockedBy("has_item", hasItem(Items.AMETHYST_SHARD)).save(recipes) ShapedRecipeBuilder.shaped(HexItems.SLATE, 6) - .define('S', Items.DEEPSLATE) - .define('A', HexItems.AMETHYST_DUST) - .pattern(" A ") - .pattern("SSS") - .unlockedBy("has_item", hasItem(HexItems.AMETHYST_DUST)).save(recipes) + .define('S', Items.DEEPSLATE) + .define('A', HexItems.AMETHYST_DUST) + .pattern(" A ") + .pattern("SSS") + .unlockedBy("has_item", hasItem(HexItems.AMETHYST_DUST)).save(recipes) ShapedRecipeBuilder.shaped(HexItems.JEWELER_HAMMER) - .define('I', ingredients.ironIngot()) - .define('N', ingredients.ironNugget()) - .define('A', Items.AMETHYST_SHARD) - .define('S', ingredients.stick()) - .pattern("IAN") - .pattern(" S ") - .pattern(" S ") - .unlockedBy("has_item", hasItem(Items.AMETHYST_SHARD)).save(recipes) + .define('I', ingredients.ironIngot()) + .define('N', ingredients.ironNugget()) + .define('A', Items.AMETHYST_SHARD) + .define('S', ingredients.stick()) + .pattern("IAN") + .pattern(" S ") + .pattern(" S ") + .unlockedBy("has_item", hasItem(Items.AMETHYST_SHARD)).save(recipes) ShapedRecipeBuilder.shaped(HexBlocks.SLATE_BLOCK) - .define('S', HexItems.SLATE) - .pattern("S") - .pattern("S") - .unlockedBy("has_item", hasItem(HexItems.SLATE)) - .save(recipes, modLoc("slate_block_from_slates")) + .define('S', HexItems.SLATE) + .pattern("S") + .pattern("S") + .unlockedBy("has_item", hasItem(HexItems.SLATE)) + .save(recipes, modLoc("slate_block_from_slates")) ringAll(HexBlocks.SLATE_BLOCK, 8, Blocks.DEEPSLATE, HexItems.AMETHYST_DUST) - .unlockedBy("has_item", hasItem(HexItems.SLATE)).save(recipes) + .unlockedBy("has_item", hasItem(HexItems.SLATE)).save(recipes) packing(HexItems.AMETHYST_DUST, HexBlocks.AMETHYST_DUST_BLOCK.asItem(), "amethyst_dust", - false, recipes) + false, recipes) ringAll(HexBlocks.AMETHYST_TILES, 8, Blocks.AMETHYST_BLOCK, HexItems.AMETHYST_DUST) - .unlockedBy("has_item", hasItem(HexItems.AMETHYST_DUST)).save(recipes) + .unlockedBy("has_item", hasItem(HexItems.AMETHYST_DUST)).save(recipes) SingleItemRecipeBuilder.stonecutting(Ingredient.of(Blocks.AMETHYST_BLOCK), HexBlocks.AMETHYST_TILES) - .unlockedBy("has_item", hasItem(Blocks.AMETHYST_BLOCK)) - .save(recipes, modLoc("stonecutting/amethyst_tiles")) + .unlockedBy("has_item", hasItem(Blocks.AMETHYST_BLOCK)) + .save(recipes, modLoc("stonecutting/amethyst_tiles")) ringAll(HexBlocks.SCROLL_PAPER, 8, Items.PAPER, Items.AMETHYST_SHARD) - .unlockedBy("has_item", hasItem(Items.AMETHYST_SHARD)).save(recipes) + .unlockedBy("has_item", hasItem(Items.AMETHYST_SHARD)).save(recipes) ShapelessRecipeBuilder.shapeless(HexBlocks.ANCIENT_SCROLL_PAPER, 8) - .requires(ingredients.dyes()[DyeColor.BROWN]!!) - .requires(HexBlocks.SCROLL_PAPER, 8) - .unlockedBy("has_item", hasItem(HexBlocks.SCROLL_PAPER)).save(recipes) + .requires(ingredients.dyes()[DyeColor.BROWN]!!) + .requires(HexBlocks.SCROLL_PAPER, 8) + .unlockedBy("has_item", hasItem(HexBlocks.SCROLL_PAPER)).save(recipes) stack(HexBlocks.SCROLL_PAPER_LANTERN, 1, HexBlocks.SCROLL_PAPER, Items.TORCH) - .unlockedBy("has_item", hasItem(HexBlocks.SCROLL_PAPER)).save(recipes) + .unlockedBy("has_item", hasItem(HexBlocks.SCROLL_PAPER)).save(recipes) stack(HexBlocks.ANCIENT_SCROLL_PAPER_LANTERN, 1, HexBlocks.ANCIENT_SCROLL_PAPER, Items.TORCH) - .unlockedBy("has_item", hasItem(HexBlocks.ANCIENT_SCROLL_PAPER)).save(recipes) + .unlockedBy("has_item", hasItem(HexBlocks.ANCIENT_SCROLL_PAPER)).save(recipes) ShapelessRecipeBuilder.shapeless(HexBlocks.ANCIENT_SCROLL_PAPER_LANTERN, 8) - .requires(ingredients.dyes()[DyeColor.BROWN]!!) - .requires(HexBlocks.SCROLL_PAPER_LANTERN, 8) - .unlockedBy("has_item", hasItem(HexBlocks.SCROLL_PAPER_LANTERN)) - .save(recipes, modLoc("ageing_scroll_paper_lantern")) + .requires(ingredients.dyes()[DyeColor.BROWN]!!) + .requires(HexBlocks.SCROLL_PAPER_LANTERN, 8) + .unlockedBy("has_item", hasItem(HexBlocks.SCROLL_PAPER_LANTERN)) + .save(recipes, modLoc("ageing_scroll_paper_lantern")) stack(HexBlocks.SCONCE, 4, - Ingredient.of(HexItems.CHARGED_AMETHYST), - ingredients.copperIngot()) - .unlockedBy("has_item", hasItem(HexItems.CHARGED_AMETHYST)).save(recipes) + Ingredient.of(HexItems.CHARGED_AMETHYST), + ingredients.copperIngot()) + .unlockedBy("has_item", hasItem(HexItems.CHARGED_AMETHYST)).save(recipes) ShapelessRecipeBuilder.shapeless(HexBlocks.EDIFIED_PLANKS, 4) - .requires(HexItemTags.EDIFIED_LOGS) - .unlockedBy("has_item", hasItem(HexItemTags.EDIFIED_LOGS)).save(recipes) + .requires(HexItemTags.EDIFIED_LOGS) + .unlockedBy("has_item", hasItem(HexItemTags.EDIFIED_LOGS)).save(recipes) ShapedRecipeBuilder.shaped(HexBlocks.EDIFIED_WOOD, 3) - .define('W', HexBlocks.EDIFIED_LOG) - .pattern("WW") - .pattern("WW") - .unlockedBy("has_item", hasItem(HexBlocks.EDIFIED_LOG)).save(recipes) + .define('W', HexBlocks.EDIFIED_LOG) + .pattern("WW") + .pattern("WW") + .unlockedBy("has_item", hasItem(HexBlocks.EDIFIED_LOG)).save(recipes) ShapedRecipeBuilder.shaped(HexBlocks.STRIPPED_EDIFIED_WOOD, 3) - .define('W', HexBlocks.STRIPPED_EDIFIED_LOG) - .pattern("WW") - .pattern("WW") - .unlockedBy("has_item", hasItem(HexBlocks.STRIPPED_EDIFIED_LOG)).save(recipes) + .define('W', HexBlocks.STRIPPED_EDIFIED_LOG) + .pattern("WW") + .pattern("WW") + .unlockedBy("has_item", hasItem(HexBlocks.STRIPPED_EDIFIED_LOG)).save(recipes) ring(HexBlocks.EDIFIED_PANEL, 8, - HexItemTags.EDIFIED_PLANKS, null) - .unlockedBy("has_item", hasItem(HexItemTags.EDIFIED_PLANKS)).save(recipes) + HexItemTags.EDIFIED_PLANKS, null) + .unlockedBy("has_item", hasItem(HexItemTags.EDIFIED_PLANKS)).save(recipes) ShapedRecipeBuilder.shaped(HexBlocks.EDIFIED_TILE, 6) - .define('W', HexItemTags.EDIFIED_PLANKS) - .pattern("WW ") - .pattern("W W") - .pattern(" WW") - .unlockedBy("has_item", hasItem(HexItemTags.EDIFIED_PLANKS)).save(recipes) + .define('W', HexItemTags.EDIFIED_PLANKS) + .pattern("WW ") + .pattern("W W") + .pattern(" WW") + .unlockedBy("has_item", hasItem(HexItemTags.EDIFIED_PLANKS)).save(recipes) ShapedRecipeBuilder.shaped(HexBlocks.EDIFIED_DOOR, 3) - .define('W', HexItemTags.EDIFIED_PLANKS) - .pattern("WW") - .pattern("WW") - .pattern("WW") - .unlockedBy("has_item", hasItem(HexItemTags.EDIFIED_PLANKS)).save(recipes) + .define('W', HexItemTags.EDIFIED_PLANKS) + .pattern("WW") + .pattern("WW") + .pattern("WW") + .unlockedBy("has_item", hasItem(HexItemTags.EDIFIED_PLANKS)).save(recipes) ShapedRecipeBuilder.shaped(HexBlocks.EDIFIED_TRAPDOOR, 2) - .define('W', HexItemTags.EDIFIED_PLANKS) - .pattern("WWW") - .pattern("WWW") - .unlockedBy("has_item", hasItem(HexItemTags.EDIFIED_PLANKS)).save(recipes) + .define('W', HexItemTags.EDIFIED_PLANKS) + .pattern("WWW") + .pattern("WWW") + .unlockedBy("has_item", hasItem(HexItemTags.EDIFIED_PLANKS)).save(recipes) ShapedRecipeBuilder.shaped(HexBlocks.EDIFIED_STAIRS, 4) - .define('W', HexItemTags.EDIFIED_PLANKS) - .pattern("W ") - .pattern("WW ") - .pattern("WWW") - .unlockedBy("has_item", hasItem(HexItemTags.EDIFIED_PLANKS)).save(recipes) + .define('W', HexItemTags.EDIFIED_PLANKS) + .pattern("W ") + .pattern("WW ") + .pattern("WWW") + .unlockedBy("has_item", hasItem(HexItemTags.EDIFIED_PLANKS)).save(recipes) ShapedRecipeBuilder.shaped(HexBlocks.EDIFIED_SLAB, 6) - .define('W', HexItemTags.EDIFIED_PLANKS) - .pattern("WWW") - .unlockedBy("has_item", hasItem(HexItemTags.EDIFIED_PLANKS)).save(recipes) + .define('W', HexItemTags.EDIFIED_PLANKS) + .pattern("WWW") + .unlockedBy("has_item", hasItem(HexItemTags.EDIFIED_PLANKS)).save(recipes) ShapedRecipeBuilder.shaped(HexBlocks.EDIFIED_PRESSURE_PLATE, 1) - .define('W', HexItemTags.EDIFIED_PLANKS) - .pattern("WW") - .unlockedBy("has_item", hasItem(HexItemTags.EDIFIED_PLANKS)).save(recipes) + .define('W', HexItemTags.EDIFIED_PLANKS) + .pattern("WW") + .unlockedBy("has_item", hasItem(HexItemTags.EDIFIED_PLANKS)).save(recipes) ShapelessRecipeBuilder.shapeless(HexBlocks.EDIFIED_BUTTON) - .requires(HexItemTags.EDIFIED_PLANKS) - .unlockedBy("has_item", hasItem(HexItemTags.EDIFIED_PLANKS)).save(recipes) + .requires(HexItemTags.EDIFIED_PLANKS) + .unlockedBy("has_item", hasItem(HexItemTags.EDIFIED_PLANKS)).save(recipes) val enlightenment = OvercastTrigger.Instance( - EntityPredicate.Composite.ANY, - MinMaxBounds.Ints.ANY, // add a little bit of slop here - MinMaxBounds.Doubles.atLeast(0.8), - MinMaxBounds.Doubles.between(0.1, 2.05) + EntityPredicate.Composite.ANY, + MinMaxBounds.Ints.ANY, // add a little bit of slop here + MinMaxBounds.Doubles.atLeast(0.8), + MinMaxBounds.Doubles.between(0.1, 2.05) ) ShapedRecipeBuilder.shaped(HexBlocks.EMPTY_IMPETUS) - .define('B', Items.IRON_BARS) - .define('A', HexItems.CHARGED_AMETHYST) - .define('S', HexBlocks.SLATE_BLOCK) - .define('P', Items.PURPUR_BLOCK) - .pattern("PSS") - .pattern("BAB") - .pattern("SSP") - .unlockedBy("enlightenment", enlightenment).save(recipes) + .define('B', Items.IRON_BARS) + .define('A', HexItems.CHARGED_AMETHYST) + .define('S', HexBlocks.SLATE_BLOCK) + .define('P', Items.PURPUR_BLOCK) + .pattern("PSS") + .pattern("BAB") + .pattern("SSP") + .unlockedBy("enlightenment", enlightenment).save(recipes) ShapedRecipeBuilder.shaped(HexBlocks.EMPTY_DIRECTRIX) - .define('C', Items.COMPARATOR) - .define('O', Items.OBSERVER) - .define('A', HexItems.CHARGED_AMETHYST) - .define('S', HexBlocks.SLATE_BLOCK) - .pattern("CSS") - .pattern("OAO") - .pattern("SSC") - .unlockedBy("enlightenment", enlightenment).save(recipes) + .define('C', Items.COMPARATOR) + .define('O', Items.OBSERVER) + .define('A', HexItems.CHARGED_AMETHYST) + .define('S', HexBlocks.SLATE_BLOCK) + .pattern("CSS") + .pattern("OAO") + .pattern("SSC") + .unlockedBy("enlightenment", enlightenment).save(recipes) ShapedRecipeBuilder.shaped(HexBlocks.AKASHIC_BOOKSHELF) - .define('L', HexItemTags.EDIFIED_LOGS) - .define('P', HexItemTags.EDIFIED_PLANKS) - .define('C', Items.BOOK) - /*this is the*/ .pattern("LPL") // and what i have for you today is - .pattern("CCC") - .pattern("LPL") - .unlockedBy("enlightenment", enlightenment).save(recipes) + .define('L', HexItemTags.EDIFIED_LOGS) + .define('P', HexItemTags.EDIFIED_PLANKS) + .define('C', Items.BOOK) + /*this is the*/.pattern("LPL") // and what i have for you today is + .pattern("CCC") + .pattern("LPL") + .unlockedBy("enlightenment", enlightenment).save(recipes) ShapedRecipeBuilder.shaped(HexBlocks.AKASHIC_LIGATURE) - .define('L', HexItemTags.EDIFIED_LOGS) - .define('P', HexItemTags.EDIFIED_PLANKS) - .define('C', HexItems.CHARGED_AMETHYST) - .pattern("LPL") - .pattern("CCC") - .pattern("LPL") - .unlockedBy("enlightenment", enlightenment).save(recipes) + .define('L', HexItemTags.EDIFIED_LOGS) + .define('P', HexItemTags.EDIFIED_PLANKS) + .define('C', HexItems.CHARGED_AMETHYST) + .pattern("LPL") + .pattern("CCC") + .pattern("LPL") + .unlockedBy("enlightenment", enlightenment).save(recipes) BrainsweepRecipeBuilder(StateIngredientHelper.of(Blocks.AMETHYST_BLOCK), - VillagerIngredient(null, null, 3), - Blocks.BUDDING_AMETHYST.defaultBlockState()) - .unlockedBy("enlightenment", enlightenment) - .save(recipes, modLoc("brainsweep/budding_amethyst")) + BrainsweepIngredient(null, null, 3), + Blocks.BUDDING_AMETHYST.defaultBlockState()) + .unlockedBy("enlightenment", enlightenment) + .save(recipes, modLoc("brainsweep/budding_amethyst")) BrainsweepRecipeBuilder(StateIngredientHelper.of(HexBlocks.EMPTY_IMPETUS), - VillagerIngredient(ResourceLocation("toolsmith"), null, 2), - HexBlocks.IMPETUS_RIGHTCLICK.defaultBlockState()) - .unlockedBy("enlightenment", enlightenment) - .save(recipes, modLoc("brainsweep/impetus_rightclick")) + BrainsweepIngredient(ResourceLocation("toolsmith"), null, 2), + HexBlocks.IMPETUS_RIGHTCLICK.defaultBlockState()) + .unlockedBy("enlightenment", enlightenment) + .save(recipes, modLoc("brainsweep/impetus_rightclick")) BrainsweepRecipeBuilder(StateIngredientHelper.of(HexBlocks.EMPTY_IMPETUS), - VillagerIngredient(ResourceLocation("fletcher"), null, 2), - HexBlocks.IMPETUS_LOOK.defaultBlockState()) - .unlockedBy("enlightenment", enlightenment) - .save(recipes, modLoc("brainsweep/impetus_look")) + BrainsweepIngredient(ResourceLocation("fletcher"), null, 2), + HexBlocks.IMPETUS_LOOK.defaultBlockState()) + .unlockedBy("enlightenment", enlightenment) + .save(recipes, modLoc("brainsweep/impetus_look")) BrainsweepRecipeBuilder(StateIngredientHelper.of(HexBlocks.EMPTY_IMPETUS), - VillagerIngredient(ResourceLocation("cleric"), null, 2), - HexBlocks.IMPETUS_STOREDPLAYER.defaultBlockState()) - .unlockedBy("enlightenment", enlightenment) - .save(recipes, modLoc("brainsweep/impetus_storedplayer")) + BrainsweepIngredient(ResourceLocation("cleric"), null, 2), + HexBlocks.IMPETUS_STOREDPLAYER.defaultBlockState()) + .unlockedBy("enlightenment", enlightenment) + .save(recipes, modLoc("brainsweep/impetus_storedplayer")) BrainsweepRecipeBuilder(StateIngredientHelper.of(HexBlocks.EMPTY_DIRECTRIX), - VillagerIngredient(ResourceLocation("mason"), null, 1), - HexBlocks.DIRECTRIX_REDSTONE.defaultBlockState()) - .unlockedBy("enlightenment", enlightenment) - .save(recipes, modLoc("brainsweep/directrix_redstone")) + BrainsweepIngredient(ResourceLocation("mason"), null, 1), + HexBlocks.DIRECTRIX_REDSTONE.defaultBlockState()) + .unlockedBy("enlightenment", enlightenment) + .save(recipes, modLoc("brainsweep/directrix_redstone")) BrainsweepRecipeBuilder(StateIngredientHelper.of(HexBlocks.AKASHIC_LIGATURE), - VillagerIngredient(ResourceLocation("librarian"), null, 5), - HexBlocks.AKASHIC_RECORD.defaultBlockState()) - .unlockedBy("enlightenment", enlightenment) - .save(recipes, modLoc("brainsweep/akashic_record")) + BrainsweepIngredient(ResourceLocation("librarian"), null, 5), + HexBlocks.AKASHIC_RECORD.defaultBlockState()) + .unlockedBy("enlightenment", enlightenment) + .save(recipes, modLoc("brainsweep/akashic_record")) // Create compat CreateCrushingRecipeBuilder() - .withInput(Blocks.AMETHYST_CLUSTER) - .duration(150) - .withOutput(Items.AMETHYST_SHARD, 7) - .withOutput(HexItems.AMETHYST_DUST, 5) - .withOutput(0.25f, HexItems.CHARGED_AMETHYST) - .withConditions() - .whenModLoaded("create") - .save(recipes, ResourceLocation("create", "crushing/amethyst_cluster")) + .withInput(Blocks.AMETHYST_CLUSTER) + .duration(150) + .withOutput(Items.AMETHYST_SHARD, 7) + .withOutput(HexItems.AMETHYST_DUST, 5) + .withOutput(0.25f, HexItems.CHARGED_AMETHYST) + .withConditions() + .whenModLoaded("create") + .save(recipes, ResourceLocation("create", "crushing/amethyst_cluster")) CreateCrushingRecipeBuilder() - .withInput(Blocks.AMETHYST_BLOCK) - .duration(150) - .withOutput(Items.AMETHYST_SHARD, 3) - .withOutput(0.5f, HexItems.AMETHYST_DUST, 4) - .withConditions() - .whenModLoaded("create") - .save(recipes, ResourceLocation("create", "crushing/amethyst_block")) + .withInput(Blocks.AMETHYST_BLOCK) + .duration(150) + .withOutput(Items.AMETHYST_SHARD, 3) + .withOutput(0.5f, HexItems.AMETHYST_DUST, 4) + .withConditions() + .whenModLoaded("create") + .save(recipes, ResourceLocation("create", "crushing/amethyst_block")) CreateCrushingRecipeBuilder() - .withInput(Items.AMETHYST_SHARD) - .duration(150) - .withOutput(HexItems.AMETHYST_DUST, 4) - .withOutput(0.5f, HexItems.AMETHYST_DUST) - .withConditions() - .whenModLoaded("create") - .save(recipes, modLoc("compat/create/crushing/amethyst_shard")) + .withInput(Items.AMETHYST_SHARD) + .duration(150) + .withOutput(HexItems.AMETHYST_DUST, 4) + .withOutput(0.5f, HexItems.AMETHYST_DUST) + .withConditions() + .whenModLoaded("create") + .save(recipes, modLoc("compat/create/crushing/amethyst_shard")) // FD compat FarmersDelightCuttingRecipeBuilder() - .withInput(HexBlocks.EDIFIED_LOG) - .withTool(ingredients.axeStrip()) - .withOutput(HexBlocks.STRIPPED_EDIFIED_LOG) - .withOutput("farmersdelight:tree_bark") - .withSound(SoundEvents.AXE_STRIP) - .withConditions() - .whenModLoaded("farmersdelight") - .save(recipes, modLoc("compat/farmersdelight/cutting/akashic_log")) + .withInput(HexBlocks.EDIFIED_LOG) + .withTool(ingredients.axeStrip()) + .withOutput(HexBlocks.STRIPPED_EDIFIED_LOG) + .withOutput("farmersdelight:tree_bark") + .withSound(SoundEvents.AXE_STRIP) + .withConditions() + .whenModLoaded("farmersdelight") + .save(recipes, modLoc("compat/farmersdelight/cutting/akashic_log")) FarmersDelightCuttingRecipeBuilder() - .withInput(HexBlocks.EDIFIED_WOOD) - .withTool(ingredients.axeStrip()) - .withOutput(HexBlocks.STRIPPED_EDIFIED_WOOD) - .withOutput("farmersdelight:tree_bark") - .withSound(SoundEvents.AXE_STRIP) - .withConditions() - .whenModLoaded("farmersdelight") - .save(recipes, modLoc("compat/farmersdelight/cutting/akashic_wood")) + .withInput(HexBlocks.EDIFIED_WOOD) + .withTool(ingredients.axeStrip()) + .withOutput(HexBlocks.STRIPPED_EDIFIED_WOOD) + .withOutput("farmersdelight:tree_bark") + .withSound(SoundEvents.AXE_STRIP) + .withConditions() + .whenModLoaded("farmersdelight") + .save(recipes, modLoc("compat/farmersdelight/cutting/akashic_wood")) FarmersDelightCuttingRecipeBuilder() - .withInput(HexBlocks.EDIFIED_TRAPDOOR) - .withTool(ingredients.axeDig()) - .withOutput(HexBlocks.EDIFIED_PLANKS) - .withConditions() - .whenModLoaded("farmersdelight") - .save(recipes, modLoc("compat/farmersdelight/cutting/akashic_trapdoor")) + .withInput(HexBlocks.EDIFIED_TRAPDOOR) + .withTool(ingredients.axeDig()) + .withOutput(HexBlocks.EDIFIED_PLANKS) + .withConditions() + .whenModLoaded("farmersdelight") + .save(recipes, modLoc("compat/farmersdelight/cutting/akashic_trapdoor")) FarmersDelightCuttingRecipeBuilder() - .withInput(HexBlocks.EDIFIED_DOOR) - .withTool(ingredients.axeDig()) - .withOutput(HexBlocks.EDIFIED_PLANKS) - .withConditions() - .whenModLoaded("farmersdelight") - .save(recipes, modLoc("compat/farmersdelight/cutting/akashic_door")) + .withInput(HexBlocks.EDIFIED_DOOR) + .withTool(ingredients.axeDig()) + .withOutput(HexBlocks.EDIFIED_PLANKS) + .withConditions() + .whenModLoaded("farmersdelight") + .save(recipes, modLoc("compat/farmersdelight/cutting/akashic_door")) } private fun wandRecipe(recipes: Consumer, wand: ItemStaff, plank: Item) { ShapedRecipeBuilder.shaped(wand) - .define('W', plank) - .define('S', Items.STICK) - .define('A', HexItems.CHARGED_AMETHYST) - .pattern(" SA") - .pattern(" WS") - .pattern("S ") - .unlockedBy("has_item", hasItem(HexItems.CHARGED_AMETHYST)) - .save(recipes) + .define('W', plank) + .define('S', Items.STICK) + .define('A', HexItems.CHARGED_AMETHYST) + .pattern(" SA") + .pattern(" WS") + .pattern("S ") + .unlockedBy("has_item", hasItem(HexItems.CHARGED_AMETHYST)) + .save(recipes) } private fun gayRecipe(recipes: Consumer, type: ItemPrideColorizer.Type, material: Ingredient) { val colorizer = HexItems.PRIDE_COLORIZERS[type]!! ShapedRecipeBuilder.shaped(colorizer) - .define('D', HexItems.AMETHYST_DUST) - .define('C', material) - .pattern(" D ") - .pattern("DCD") - .pattern(" D ") - .unlockedBy("has_item", hasItem(HexItems.AMETHYST_DUST)) - .save(recipes) + .define('D', HexItems.AMETHYST_DUST) + .define('C', material) + .pattern(" D ") + .pattern("DCD") + .pattern(" D ") + .unlockedBy("has_item", hasItem(HexItems.AMETHYST_DUST)) + .save(recipes) } private fun specialRecipe(consumer: Consumer, serializer: SimpleRecipeSerializer<*>) { diff --git a/Common/src/main/java/at/petrak/hexcasting/datagen/recipe/builders/BrainsweepRecipeBuilder.java b/Common/src/main/java/at/petrak/hexcasting/datagen/recipe/builders/BrainsweepRecipeBuilder.java index 4f4292cf..9166c53e 100644 --- a/Common/src/main/java/at/petrak/hexcasting/datagen/recipe/builders/BrainsweepRecipeBuilder.java +++ b/Common/src/main/java/at/petrak/hexcasting/datagen/recipe/builders/BrainsweepRecipeBuilder.java @@ -3,7 +3,7 @@ package at.petrak.hexcasting.datagen.recipe.builders; import at.petrak.hexcasting.common.recipe.HexRecipeStuffRegistry; import at.petrak.hexcasting.common.recipe.ingredient.StateIngredient; import at.petrak.hexcasting.common.recipe.ingredient.StateIngredientHelper; -import at.petrak.hexcasting.common.recipe.ingredient.VillagerIngredient; +import at.petrak.hexcasting.common.recipe.ingredient.brainsweep.BrainsweepIngredient; import com.google.gson.JsonObject; import net.minecraft.advancements.Advancement; import net.minecraft.advancements.AdvancementRewards; @@ -22,12 +22,12 @@ import java.util.function.Consumer; public class BrainsweepRecipeBuilder implements RecipeBuilder { private StateIngredient blockIn; - private VillagerIngredient villagerIn; + private BrainsweepIngredient villagerIn; private final BlockState result; private final Advancement.Builder advancement; - public BrainsweepRecipeBuilder(StateIngredient blockIn, VillagerIngredient villagerIn, BlockState result) { + public BrainsweepRecipeBuilder(StateIngredient blockIn, BrainsweepIngredient villagerIn, BlockState result) { this.blockIn = blockIn; this.villagerIn = villagerIn; this.result = result; @@ -57,17 +57,17 @@ public class BrainsweepRecipeBuilder implements RecipeBuilder { } this.advancement.parent(new ResourceLocation("recipes/root")) - .addCriterion("has_the_recipe", RecipeUnlockedTrigger.unlocked(pRecipeId)) - .rewards(AdvancementRewards.Builder.recipe(pRecipeId)) - .requirements(RequirementsStrategy.OR); + .addCriterion("has_the_recipe", RecipeUnlockedTrigger.unlocked(pRecipeId)) + .rewards(AdvancementRewards.Builder.recipe(pRecipeId)) + .requirements(RequirementsStrategy.OR); pFinishedRecipeConsumer.accept(new Result( - pRecipeId, - this.blockIn, this.villagerIn, this.result, - this.advancement, - new ResourceLocation(pRecipeId.getNamespace(), "recipes/brainsweep/" + pRecipeId.getPath()))); + pRecipeId, + this.blockIn, this.villagerIn, this.result, + this.advancement, + new ResourceLocation(pRecipeId.getNamespace(), "recipes/brainsweep/" + pRecipeId.getPath()))); } - public record Result(ResourceLocation id, StateIngredient blockIn, VillagerIngredient villagerIn, + public record Result(ResourceLocation id, StateIngredient blockIn, BrainsweepIngredient villagerIn, BlockState result, Advancement.Builder advancement, ResourceLocation advancementId) implements FinishedRecipe { @Override diff --git a/Fabric/src/main/java/at/petrak/hexcasting/fabric/interop/emi/HexEMIPlugin.java b/Fabric/src/main/java/at/petrak/hexcasting/fabric/interop/emi/HexEMIPlugin.java index a24d5c26..d5a1c489 100644 --- a/Fabric/src/main/java/at/petrak/hexcasting/fabric/interop/emi/HexEMIPlugin.java +++ b/Fabric/src/main/java/at/petrak/hexcasting/fabric/interop/emi/HexEMIPlugin.java @@ -3,7 +3,7 @@ package at.petrak.hexcasting.fabric.interop.emi; import at.petrak.hexcasting.api.mod.HexItemTags; import at.petrak.hexcasting.common.recipe.BrainsweepRecipe; import at.petrak.hexcasting.common.recipe.HexRecipeStuffRegistry; -import at.petrak.hexcasting.common.recipe.ingredient.VillagerIngredient; +import at.petrak.hexcasting.common.recipe.ingredient.brainsweep.BrainsweepIngredient; import at.petrak.hexcasting.interop.utils.PhialRecipeStackBuilder; import dev.emi.emi.api.EmiPlugin; import dev.emi.emi.api.EmiRegistry; @@ -39,24 +39,24 @@ public class HexEMIPlugin implements EmiPlugin { private static final ResourceLocation SIMPLIFIED_ICON_PROFESSION = modLoc("textures/gui/villager_profession.png"); public static final EmiRecipeCategory BRAINSWEEP = new EmiRecipeCategory(BRAINSWEEP_ID, - new PatternRendererEMI(BRAINSWEEP_ID, 16, 16), - new EmiTexture(SIMPLIFIED_ICON_BRAINSWEEP, 0, 0, 16, 16, 16, 16, 16, 16)); + new PatternRendererEMI(BRAINSWEEP_ID, 16, 16), + new EmiTexture(SIMPLIFIED_ICON_BRAINSWEEP, 0, 0, 16, 16, 16, 16, 16, 16)); public static final EmiRecipeCategory PHIAL = new EmiRecipeCategory(PHIAL_ID, - new PatternRendererEMI(PHIAL_ID, 12, 12).shift(2, 2), - new EmiTexture(SIMPLIFIED_ICON_PHIAL, 0, 0, 16, 16, 16, 16, 16, 16)); + new PatternRendererEMI(PHIAL_ID, 12, 12).shift(2, 2), + new EmiTexture(SIMPLIFIED_ICON_PHIAL, 0, 0, 16, 16, 16, 16, 16, 16)); public static final EmiRecipeCategory EDIFY = new EmiRecipeCategory(EDIFY_ID, - new PatternRendererEMI(EDIFY_ID, 16, 16).strokeOrder(false), - new EmiTexture(SIMPLIFIED_ICON_EDIFY, 0, 0, 16, 16, 16, 16, 16, 16)); + new PatternRendererEMI(EDIFY_ID, 16, 16).strokeOrder(false), + new EmiTexture(SIMPLIFIED_ICON_EDIFY, 0, 0, 16, 16, 16, 16, 16, 16)); public static final EmiRecipeCategory VILLAGER_LEVELING = new EmiRecipeCategory(VILLAGER_LEVELING_ID, - EmiStack.of(Items.EMERALD), - new EmiTexture(SIMPLIFIED_ICON_LEVELING, 0, 0, 16, 16, 16, 16, 16, 16)); + EmiStack.of(Items.EMERALD), + new EmiTexture(SIMPLIFIED_ICON_LEVELING, 0, 0, 16, 16, 16, 16, 16, 16)); public static final EmiRecipeCategory VILLAGER_PROFESSION = new EmiRecipeCategory(VILLAGER_PROFESSION_ID, - EmiStack.of(Blocks.LECTERN), - new EmiTexture(SIMPLIFIED_ICON_PROFESSION, 0, 0, 16, 16, 16, 16, 16, 16)); + EmiStack.of(Blocks.LECTERN), + new EmiTexture(SIMPLIFIED_ICON_PROFESSION, 0, 0, 16, 16, 16, 16, 16, 16)); @Override public void register(EmiRegistry registry) { @@ -70,9 +70,9 @@ public class HexEMIPlugin implements EmiPlugin { registry.addWorkstation(EDIFY, EmiIngredient.of(HexItemTags.STAVES)); for (BrainsweepRecipe recipe : registry.getRecipeManager() - .getAllRecipesFor(HexRecipeStuffRegistry.BRAINSWEEP_TYPE)) { + .getAllRecipesFor(HexRecipeStuffRegistry.BRAINSWEEP_TYPE)) { var inputs = EmiIngredient.of(recipe.blockIn().getDisplayedStacks().stream() - .map(EmiStack::of).toList()); + .map(EmiStack::of).toList()); var villagerInput = VillagerEmiStack.atLevelOrHigher(recipe.villagerIn(), true); var output = EmiStack.of(recipe.result().getBlock()); registry.addRecipe(new EmiBrainsweepRecipe(inputs, villagerInput, output, recipe.getId())); @@ -84,38 +84,38 @@ public class HexEMIPlugin implements EmiPlugin { registry.addRecipe(new EmiEdifyRecipe()); - var basicVillager = new VillagerIngredient(null, null, 1); + var basicVillager = new BrainsweepIngredient(null, null, 1); for (VillagerProfession profession : Registry.VILLAGER_PROFESSION) { ResourceLocation id = Registry.VILLAGER_PROFESSION.getKey(profession); ResourceLocation poiRecipeId = modLoc("villager/poi/" + id.getNamespace() + "/" + id.getPath()); - var manWithJob = new VillagerIngredient(id, null, 1); + var manWithJob = new BrainsweepIngredient(id, null, 1); Set states = VillagerEmiStack.matchingStatesForProfession(profession); if (!states.isEmpty()) { List workstations = states.stream() - .map(BlockState::getBlock) - .map(Block::asItem) - .distinct() - .filter((it) -> it != Items.AIR) - .toList(); + .map(BlockState::getBlock) + .map(Block::asItem) + .distinct() + .filter((it) -> it != Items.AIR) + .toList(); if (!workstations.isEmpty()) { registry.addWorkstation(VILLAGER_LEVELING, - EmiIngredient.of(workstations.stream().map(EmiStack::of).toList())); + EmiIngredient.of(workstations.stream().map(EmiStack::of).toList())); registry.addWorkstation(VILLAGER_PROFESSION, - EmiIngredient.of(workstations.stream().map(EmiStack::of).toList())); + EmiIngredient.of(workstations.stream().map(EmiStack::of).toList())); registry.addRecipe(new EmiProfessionRecipe(new VillagerEmiStack(basicVillager), - EmiIngredient.of(workstations.stream().map(EmiStack::of).toList()), - new VillagerEmiStack(manWithJob), poiRecipeId)); + EmiIngredient.of(workstations.stream().map(EmiStack::of).toList()), + new VillagerEmiStack(manWithJob), poiRecipeId)); for (int lvl = 1; lvl < 5; lvl++) { ResourceLocation levelRecipeId = modLoc( - "villager/levelup/" + lvl + "/" + id.getNamespace() + "/" + id.getPath()); - var manWithBadJob = new VillagerIngredient(id, null, lvl); - var manWithBetterJob = new VillagerIngredient(id, null, lvl + 1); + "villager/levelup/" + lvl + "/" + id.getNamespace() + "/" + id.getPath()); + var manWithBadJob = new BrainsweepIngredient(id, null, lvl); + var manWithBetterJob = new BrainsweepIngredient(id, null, lvl + 1); registry.addRecipe(new EmiLevelupRecipe(new VillagerEmiStack(manWithBadJob), - new VillagerEmiStack(manWithBetterJob), levelRecipeId)); + new VillagerEmiStack(manWithBetterJob), levelRecipeId)); } } } diff --git a/Fabric/src/main/java/at/petrak/hexcasting/fabric/interop/emi/VillagerEmiStack.java b/Fabric/src/main/java/at/petrak/hexcasting/fabric/interop/emi/VillagerEmiStack.java index dda0934a..481057ae 100644 --- a/Fabric/src/main/java/at/petrak/hexcasting/fabric/interop/emi/VillagerEmiStack.java +++ b/Fabric/src/main/java/at/petrak/hexcasting/fabric/interop/emi/VillagerEmiStack.java @@ -4,7 +4,7 @@ import at.petrak.hexcasting.client.ClientTickCounter; import at.petrak.hexcasting.client.RenderLib; import at.petrak.hexcasting.client.shader.FakeBufferSource; import at.petrak.hexcasting.client.shader.HexRenderTypes; -import at.petrak.hexcasting.common.recipe.ingredient.VillagerIngredient; +import at.petrak.hexcasting.common.recipe.ingredient.brainsweep.BrainsweepIngredient; import com.mojang.blaze3d.systems.RenderSystem; import com.mojang.blaze3d.vertex.PoseStack; import dev.emi.emi.api.render.EmiRender; @@ -35,43 +35,43 @@ import static at.petrak.hexcasting.client.RenderLib.renderEntity; public class VillagerEmiStack extends EmiStack { private final VillagerEntry entry; - public final VillagerIngredient ingredient; + public final BrainsweepIngredient ingredient; public final boolean mindless; private final ResourceLocation id; - public VillagerEmiStack(VillagerIngredient villager) { + public VillagerEmiStack(BrainsweepIngredient villager) { this(villager, false); } - public VillagerEmiStack(VillagerIngredient villager, boolean mindless) { + public VillagerEmiStack(BrainsweepIngredient villager, boolean mindless) { this(villager, mindless, 1); } - public VillagerEmiStack(VillagerIngredient villager, boolean mindless, long amount) { + public VillagerEmiStack(BrainsweepIngredient villager, boolean mindless, long amount) { entry = new VillagerEntry(new VillagerVariant(villager, mindless)); this.ingredient = villager; this.mindless = mindless; this.amount = amount; // This is so scuffed this.id = modLoc((Objects.toString(villager.profession()) + villager.minLevel() + mindless) - .replace(':', '-')); + .replace(':', '-')); } public static Set matchingStatesForProfession(VillagerProfession profession) { return Registry.POINT_OF_INTEREST_TYPE.holders() - .filter(profession.heldJobSite()) - .flatMap(it -> it.value().matchingStates().stream()) - .collect(Collectors.toSet()); + .filter(profession.heldJobSite()) + .flatMap(it -> it.value().matchingStates().stream()) + .collect(Collectors.toSet()); } - public static EmiIngredient atLevelOrHigher(VillagerIngredient ingredient, boolean remainder) { + public static EmiIngredient atLevelOrHigher(BrainsweepIngredient ingredient, boolean remainder) { if (ingredient.profession() == null) { return EmiIngredient.of(Registry.VILLAGER_PROFESSION.stream() - .filter(it -> matchingStatesForProfession(it).isEmpty()) - .map(it -> atLevelOrHigher(new VillagerIngredient(Registry.VILLAGER_PROFESSION.getKey(it), - ingredient.biome(), ingredient.minLevel()), true)) - .toList()); + .filter(it -> matchingStatesForProfession(it).isEmpty()) + .map(it -> atLevelOrHigher(new BrainsweepIngredient(Registry.VILLAGER_PROFESSION.getKey(it), + ingredient.biome(), ingredient.minLevel()), true)) + .toList()); } VillagerEmiStack stack = new VillagerEmiStack(ingredient).orHigher(true); @@ -136,7 +136,7 @@ public class VillagerEmiStack extends EmiStack { } ResourceLocation displayId = Objects.requireNonNullElseGet(ingredient.profession(), - () -> Registry.ENTITY_TYPE.getKey(EntityType.VILLAGER)); + () -> Registry.ENTITY_TYPE.getKey(EntityType.VILLAGER)); tooltip.add(Component.literal(displayId.toString()).withStyle(ChatFormatting.DARK_GRAY)); } @@ -150,9 +150,9 @@ public class VillagerEmiStack extends EmiStack { @Override public List getTooltip() { List list = getTooltipText().stream() - .map(Component::getVisualOrderText) - .map(ClientTooltipComponent::create) - .collect(Collectors.toList()); + .map(Component::getVisualOrderText) + .map(ClientTooltipComponent::create) + .collect(Collectors.toList()); if (!getRemainder().isEmpty()) { list.add(EmiTooltipComponents.getRemainderTooltipComponent(this)); } @@ -175,7 +175,7 @@ public class VillagerEmiStack extends EmiStack { RenderSystem.enableBlend(); RenderSystem.setShaderColor(1.0F, 1.0F, 1.0F, 1.0F); renderEntity(poseStack, villager, level, x + 8, y + 16, ClientTickCounter.getTotal(), 8, 0, - mindless ? (it) -> new FakeBufferSource(it, HexRenderTypes::getGrayscaleLayer) : it -> it); + mindless ? (it) -> new FakeBufferSource(it, HexRenderTypes::getGrayscaleLayer) : it -> it); } } diff --git a/Fabric/src/main/java/at/petrak/hexcasting/fabric/interop/emi/VillagerVariant.java b/Fabric/src/main/java/at/petrak/hexcasting/fabric/interop/emi/VillagerVariant.java index 6584ffd4..e956888d 100644 --- a/Fabric/src/main/java/at/petrak/hexcasting/fabric/interop/emi/VillagerVariant.java +++ b/Fabric/src/main/java/at/petrak/hexcasting/fabric/interop/emi/VillagerVariant.java @@ -1,7 +1,7 @@ package at.petrak.hexcasting.fabric.interop.emi; -import at.petrak.hexcasting.common.recipe.ingredient.VillagerIngredient; +import at.petrak.hexcasting.common.recipe.ingredient.brainsweep.BrainsweepIngredient; -public record VillagerVariant(VillagerIngredient ingredient, boolean mindless) { +public record VillagerVariant(BrainsweepIngredient ingredient, boolean mindless) { // NO-OP } From aa5c918525d42abde92a3a1db778e680ef49777c Mon Sep 17 00:00:00 2001 From: ChuijkYahus <94828194+ChuijkYahus@users.noreply.github.com> Date: Tue, 22 Nov 2022 23:29:02 +0800 Subject: [PATCH 02/95] config lines --- .../assets/hexcasting/lang/zh_cn.json | 54 ++++++++++++++++--- 1 file changed, 47 insertions(+), 7 deletions(-) diff --git a/Common/src/main/resources/assets/hexcasting/lang/zh_cn.json b/Common/src/main/resources/assets/hexcasting/lang/zh_cn.json index acbe7e1f..ca71fe91 100644 --- a/Common/src/main/resources/assets/hexcasting/lang/zh_cn.json +++ b/Common/src/main/resources/assets/hexcasting/lang/zh_cn.json @@ -172,6 +172,46 @@ "emi.category.hexcasting.villager_leveling": "职业等级", "emi.category.hexcasting.villager_profession": "村民职业", + "text.autoconfig.hexcasting.title": "咒法学(Hexcasting)配置", + "text.autoconfig.hexcasting.category.common": "Common", + "text.autoconfig.hexcasting.category.client": "Client", + "text.autoconfig.hexcasting.category.server": "Server", + "text.autoconfig.hexcasting.option.common.dustMediaAmount": "紫水晶粉媒质含量", + "text.autoconfig.hexcasting.option.common.shardMediaAmount": "紫水晶碎片媒质含量", + "text.autoconfig.hexcasting.option.common.chargedCrystalMediaAmount": "充能紫水晶媒质含量", + "text.autoconfig.hexcasting.option.common.mediaToHealthRate": "媒质与生命值交换比率", + "text.autoconfig.hexcasting.option.common.dustMediaAmount.@Tooltip": "单个紫水晶粉所含媒质量", + "text.autoconfig.hexcasting.option.common.shardMediaAmount.@Tooltip": "单个紫水晶碎片所含媒质量", + "text.autoconfig.hexcasting.option.common.chargedCrystalMediaAmount.@Tooltip": "单个充能紫水晶所含媒质量", + "text.autoconfig.hexcasting.option.common.mediaToHealthRate.@Tooltip": "1点生命值可在施法时换算的媒质量", + "text.autoconfig.hexcasting.option.client.ctrlTogglesOffStrokeOrder": "Ctrl关闭笔顺显示", + "text.autoconfig.hexcasting.option.client.invertSpellbookScrollDirection": "反转法术书滚轮方向", + "text.autoconfig.hexcasting.option.client.invertAbacusScrollDirection": "反转算盘滚轮方向", + "text.autoconfig.hexcasting.option.client.gridSnapThreshold": "咒术网格吸附阈值", + "text.autoconfig.hexcasting.option.client.ctrlTogglesOffStrokeOrder.@Tooltip": "按下Ctrl键时*关闭*图案渐变显示,而非按下时打开", + "text.autoconfig.hexcasting.option.client.invertSpellbookScrollDirection.@Tooltip": "向上滚动滚轮(而非向下)增加法术书当前页页码,反之亦然", + "text.autoconfig.hexcasting.option.client.invertAbacusScrollDirection.@Tooltip": "向上滚动滚轮(而非向下)增加算盘计数,反之亦然", + "text.autoconfig.hexcasting.option.client.gridSnapThreshold.@Tooltip": "使用法杖时,吸附至另一点所需划过的距离,0.5意味着需划过50%(取值0.5~1)", + "text.autoconfig.hexcasting.option.server.opBreakHarvestLevel": "破坏方块挖掘等级", + "text.autoconfig.hexcasting.option.server.maxRecurseDepth": "递归最大深度", + "text.autoconfig.hexcasting.option.server.maxSpellCircleLength": "法术环最大长度", + "text.autoconfig.hexcasting.option.server.actionDenyList": "禁用操作列表", + "text.autoconfig.hexcasting.option.server.circleActionDenyList": "法术环禁用操作列表", + "text.autoconfig.hexcasting.option.server.villagersOffendedByMindMurder": "村民会被意识剥除冒犯", + "text.autoconfig.hexcasting.option.server.fewScrollTables": "少量卷轴战利品表", + "text.autoconfig.hexcasting.option.server.someScrollTables": "中等量卷轴战利品表", + "text.autoconfig.hexcasting.option.server.manyScrollTables": "大量卷轴战利品表", + "text.autoconfig.hexcasting.option.server.opBreakHarvestLevel.@Tooltip": "破坏方块法术的挖掘等级\n0 = 木,1 = 石,2 = 铁,3 = 钻石,4 = 下界合金", + "text.autoconfig.hexcasting.option.server.maxRecurseDepth.@Tooltip": "一个操作能执行其他操作的最大次数", + "text.autoconfig.hexcasting.option.server.maxSpellCircleLength.@Tooltip": "法术环所允许含有石板的最大个数", + "text.autoconfig.hexcasting.option.server.actionDenyList.@Tooltip": "被禁用操作的资源位置;试图执行此类操作会导致事故", + "text.autoconfig.hexcasting.option.server.circleActionDenyList.@Tooltip": "法术环中被禁用操作的资源位置;试图执行此类操作会导致事故", + "text.autoconfig.hexcasting.option.server.villagersOffendedByMindMurder.@Tooltip": "村民是否会在其他村民被剥离意识时感到气愤", + "text.autoconfig.hexcasting.option.server.fewScrollTables.@Tooltip": "会额外生成较少数量卷轴的战利品表", + "text.autoconfig.hexcasting.option.server.someScrollTables.@Tooltip": "会额外生成中等数量卷轴的战利品表", + "text.autoconfig.hexcasting.option.server.manyScrollTables.@Tooltip": "会额外生成较大数量卷轴的战利品表", + + "advancement.hexcasting:root": "咒法学研究", "advancement.hexcasting:root.desc": "在地底深处找到并采集不断生长着的、凝聚的媒质", "advancement.hexcasting:enlightenment": "获得启迪", @@ -200,8 +240,8 @@ "advancement.hexcasting:lore/experiment2": "“毡障”采访日志", "advancement.hexcasting:lore/inventory": "回收日志 #72", - "stat.hexcasting.media_used": "消耗媒质数量(以紫水晶粉计)", - "stat.hexcasting.media_overcasted": "过度施法消耗媒质数量(以紫水晶粉计)", + "stat.hexcasting.media_used": "消耗媒质量(以紫水晶粉计)", + "stat.hexcasting.media_overcasted": "过度施法消耗媒质量(以紫水晶粉计)", "stat.hexcasting.patterns_drawn": "绘制图案次数", "stat.hexcasting.spells_cast": "施放法术次数", @@ -1107,7 +1147,7 @@ "hexcasting.entry.lore": "故事", "hexcasting.entry.lore.desc": "我发现了些与我所研究的学问没有直接关系的信件和文本。但是,其中也许记载了某些历史上发生过的事。还是需要好好读读……", - "hexcasting.entry.lore.terabithia1": "泰瑞宾西娅·斯蒂勒斯,#1", + "hexcasting.entry.lore.terabithia1": "泰瑞宾西娅的信,#1", "hexcasting.page.lore.terabithia1.1": "$(italic)完整标题:泰瑞宾西娅·斯蒂勒斯寄给她父亲的信,#1/$$(br2)亲爱的爸爸,$(br)我对你攒钱送我来大图书馆的感激之情与日俱增。在这里学到的知识真是不可思议!我实在没法把我所见所想全部描述出来……能来这里真是太棒了。", "hexcasting.page.lore.terabithia1.2": "我写这封信时正坐在主穹顶下,它是由咒法学学生联合会维护和保养的。他们在穹顶顶部设置了某种奇特的装置,由此就能捕获从勤奋苦攻的学生的课桌中逸散出来的散在思维能量,至少我了解到的是这样。我的舍友阿曼妮塔就在钻研这门学问,她也非常愿意滔滔不绝地为我解释其中原理,尽管我得承认我听不大懂。", "hexcasting.page.lore.terabithia1.3": "就我的理解而言,我们思考的过程——也就是驱动我写这封信和你读这封信的无形机制——并不那么有效。一小部分能量会逸散到环境中,就和马车的车轴在长途跋涉后摸起来会有点烫一样。这些散在能量叫做“媒质”。一个人的散在媒质微不足道,但成百上千位主穹顶下的思考者加在一起就不得了了,甚至还会出现乘数效应。再配上某些天才般的装置,这些媒质就能被固化为某种紫色的水晶。", @@ -1117,7 +1157,7 @@ "hexcasting.page.lore.terabithia1.7": "作为一名学生,我每三个月能在阿卡夏邮局免费送一封信。但你也知道,我并不是很富裕……恐怕这是唯一一种能和你说上话的方式了。你攒钱回信我再感激不过,但我们之间的联系机会恐怕不会很多。不过我认为,我在这能学到的知识可能远超贷款上写的数字的价值。我大概会是家族中第一个不当农民的人吧!", "hexcasting.page.lore.terabithia1.8": "我想,我三个月后会再写封信的。$(br2)你亲爱的,$(br)泰瑞宾西娅·斯蒂勒斯", - "hexcasting.entry.lore.terabithia2": "泰瑞宾西娅·斯蒂勒斯,#2", + "hexcasting.entry.lore.terabithia2": "泰瑞宾西娅的信,#2", "hexcasting.page.lore.terabithia2.1": "$(italic)完整标题:泰瑞宾西娅·斯蒂勒斯寄给她父亲的信,#2/$$(br2)亲爱的爸爸,$(br)……天哪,试着把过去三个月的经历全写进信里真是件难事。这么难办的事居然是我免费得来的奇迹赐予的!我可真是辛苦。", "hexcasting.page.lore.terabithia2.2": "我在地质学联合会的研究正稳步推进。我们又进行了一次实地考察,这次范围更深,直到灰色的岩石隐去而硬质的片状板岩出现的地方。那里的岩石会在脚下碎成令人窒息的粉末……脚下的危险已经需要格外注意,更不用说那些藏身于黑暗的生物。(我之前曾遇到过这种生物一两次,但我知道你会为我经受生死考验而坐立难安,所以就不提了。)", "hexcasting.page.lore.terabithia2.3": "不过,我们确实发现了一些之前所说的紫水晶。在某次小型勘探中我们发现了个只有丁点水晶的小矿脉。我们需要严格遵守勘探规章,所以找到的紫水晶需全部取走并立刻上交给联合会中的学长。这整条规定在我看来从里到外都很荒诞。他们把这当做重要至极而绝密的事件,又把考察交给来这总共还不到六个月的新生去做,还就在那么几平方分米大的地方用足足十二把探矿镐开采总共十克都不到的东西……", @@ -1126,7 +1166,7 @@ "hexcasting.page.lore.terabithia2.6": "也许在紫水晶上感受不到嗡鸣和振动只是因为身处地下所造成的压力。我唯一一次摸到紫水晶时手一直在抖,而且触感确实很轻盈,不过对我而言两者的触感并不完全一致。两者的折射率略有不同。$(br2)如果有机会在矿洞外碰见紫水晶,我一定要问下阿曼妮塔她能不能用紫水晶施咒。似乎每次我们碰面她都新学到了些奇妙的技艺。", "hexcasting.page.lore.terabithia2.7": "就在上周,她不靠任何支撑物就把我悬到了空中!轻微的刺痛感,身体比空气还轻盈,但衣服又还是原本的重量……这种感觉非常奇怪。不过我确实很庆幸她在效果结束前把我拉到了床的正上方。$(br2)你亲爱的,$(br)泰瑞宾西娅·斯蒂勒斯", - "hexcasting.entry.lore.terabithia3": "泰瑞宾西娅·斯蒂勒斯,#3,1/2", + "hexcasting.entry.lore.terabithia3": "泰瑞宾西娅的信,#3,1/2", "hexcasting.page.lore.terabithia3.1": "$(italic)完整标题:泰瑞宾西娅·斯蒂勒斯寄给她父亲的信,#3,第一部分/$$(br2)亲爱的爸爸,$(br)自从上次写信以来发生了两桩怪事。$(br2)第一件,负责管理入门等级咒法学联合会学生的教授失踪了。没人知道他去了哪里。他的办公室和住所都被锁上了,但里面还是那副乱糟糟的样子。", "hexcasting.page.lore.terabithia3.2": "更奇怪的是,不管大图书馆的学生怎么激那帮冗杂官僚里管行政的人员,送去的信件都被一一打回。就连其他教授都不愿谈及他。$(br2)也正如你可能在想的,阿曼妮塔十分沮丧。不管大图书馆派来哪位教授接任,都不如原先的教授那样理解和愿意帮助初学者们。", "hexcasting.page.lore.terabithia3.3": "但是,这还不是两件事里更怪的那件。这件事——我很希望之后不要再碰到比这还骇人的事了——发生在我和地质学联合会的又一次考察中,我们计划前去某个村庄附近考察。", @@ -1140,7 +1180,7 @@ "hexcasting.page.lore.terabithia3.11": "就在我们要离开的时候,我又留意到先前禁止我们开采的那些水晶,它们暗色的深槽里似乎新出现了晶芽,就好像它们从中长出来了一样。我所知的地质学中有关水晶的所有知识都表明,这些水晶需要成千上万年才能长成,但仅在一天之内,新水晶就在我的眼前凭空出现了。我想学长们的开采禁令确实有道理,大概吧。", "hexcasting.page.lore.terabithia3.12": "回到地表的路程中没发生什么事,我们也正好在太阳落山的时候回到了营地。非常抱歉,信纸快用完了。阿卡夏信笺只够写这些字但这故事值得两封信一起寄应该能同时到$(br2)你亲爱的,$(br)泰瑞宾西娅·斯蒂勒斯", - "hexcasting.entry.lore.terabithia4": "泰瑞宾西娅·斯蒂勒斯,#3,2/2", + "hexcasting.entry.lore.terabithia4": "泰瑞宾西娅的信,#3,2/2", "hexcasting.page.lore.terabithia4.1": "$(italic)完整标题:泰瑞宾西娅·斯蒂勒斯寄给她父亲的信,#3,第二部分/$$(br2)亲爱的爸爸,$(br)正如我所说,信纸不够了,故事剩余部分就放在这份信里了。我们正好在太阳落山时回到了营地。而那天晚上的经历是整个奇怪考察中最为骇人的。", "hexcasting.page.lore.terabithia4.2": "我半夜醒来想去方便一下。云层把月亮完全遮住了,我在森林中迷了路,找不回营地。但我又害怕夜晚的那些怪物,于是决定要去村庄里找个地方睡觉。至少那里是安全的。", "hexcasting.page.lore.terabithia4.3": "村庄倒是很好找,尽管村庄里没有一点声音。就算这么晚了旅店不说人来人往也绝不会悄无声息。但从旅馆的门缝里看去,我却没能发现任何人的踪影。$(br2)我敲了敲一间房子的门,没有回应。再敲旁边的两间,也都没有回应,甚至感觉就像是房子一直空着一样。", @@ -1152,7 +1192,7 @@ "hexcasting.page.lore.terabithia4.9": "她还提到了某些有意思的事情:媒质水晶和真正的紫水晶都能用于制造先前我提过的特种玻璃。媒质水晶和紫水晶的晶体构造和物理性质几乎完全一致,而这和媒质的魔法性质没有关系,她是这么说的。$(br2)我最后没把遭遇满村怪物的经历告诉她。", "hexcasting.page.lore.terabithia4.10": "我知道我们家生活拮据,也知道从家里送一封信过来有多贵,但我求你,求你能给我一句忠告。我自从那时起一直心慌意乱,能读到你的信就是莫大的安慰。$(br2)你亲爱的,$(br)泰瑞宾西娅·斯蒂勒斯", - "hexcasting.entry.lore.terabithia5": "泰瑞宾西娅·斯蒂勒斯,#4", + "hexcasting.entry.lore.terabithia5": "泰瑞宾西娅的信,#4", "hexcasting.page.lore.terabithia5.1": "$(italic)完整标题:泰瑞宾西娅·斯蒂勒斯寄给她父亲的信,#4/$$(br2)阿曼妮塔消失了。$(br2)我完全不知道她去了哪里,爸爸。最后一次看到她是在晚饭时,她还在和其他人讨论学生失踪的情况,但那之后——", "hexcasting.page.lore.terabithia5.2": "之后——之后她也不见了。但没人谈起她。我太害怕了,爸爸,他们是都知道些什么吗?每个人都会有个朋友突然$(italic)消失/$,消失得无影无踪。$(br2)他们都去$(italic)哪里/$了?", "hexcasting.page.lore.terabithia5.3": "他们还一直在叫停设施和活动——我有好几周没和地质学联合会去考察了,穹顶上所有收集媒质的装置也不见了,药剂学联合会几个月没出现了……就好像大图书馆被白蚁啃到只剩了副空壳。$(br2)我觉得他们也开始审查我们写的信了……", From 0d90addd8d5b55ba5ee0da83078fee5a30aac64b Mon Sep 17 00:00:00 2001 From: "petrak@" Date: Tue, 22 Nov 2022 09:40:08 -0600 Subject: [PATCH 03/95] fix #321 --- .../common/casting/operators/stack/OpFishermanButItCopies.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/stack/OpFishermanButItCopies.kt b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/stack/OpFishermanButItCopies.kt index 6d5bf861..f78fe7be 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/stack/OpFishermanButItCopies.kt +++ b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/stack/OpFishermanButItCopies.kt @@ -18,7 +18,7 @@ object OpFishermanButItCopies : Action { if (stack.size < 2) throw MishapNotEnoughArgs(2, stack.size) - val depth = stack.getPositiveIntUnderInclusive(stack.lastIndex, stack.size - 1) + val depth = stack.getPositiveIntUnderInclusive(stack.lastIndex, stack.size - 2) stack.removeLast() val fish = stack.get(stack.size - 1 - depth) stack.add(fish) From f1f1f6aa7f26715b69a5bfccc267717e3dfd3f8b Mon Sep 17 00:00:00 2001 From: "petrak@" Date: Tue, 22 Nov 2022 09:44:13 -0600 Subject: [PATCH 04/95] make cloth config mandatory --- Fabric/src/main/resources/fabric.mod.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Fabric/src/main/resources/fabric.mod.json b/Fabric/src/main/resources/fabric.mod.json index 4aa0be25..12bea0f8 100644 --- a/Fabric/src/main/resources/fabric.mod.json +++ b/Fabric/src/main/resources/fabric.mod.json @@ -52,7 +52,8 @@ "fabric": ">=0.64", "fabric-language-kotlin": ">=1.7.4+kotlin.1.6.21", "patchouli": ">=1.19.2-77", - "paucal": "0.5.x" + "paucal": "0.5.x", + "cloth-config": "8.2.x" }, "suggests": { "gravitychanger": "0.7.21+fabric", From 1518ce2a0d06791de8719d6348c71e4a0eef15f2 Mon Sep 17 00:00:00 2001 From: ChuijkYahus <94828194+ChuijkYahus@users.noreply.github.com> Date: Wed, 23 Nov 2022 09:28:39 +0800 Subject: [PATCH 05/95] fix --- Common/src/main/resources/assets/hexcasting/lang/zh_cn.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Common/src/main/resources/assets/hexcasting/lang/zh_cn.json b/Common/src/main/resources/assets/hexcasting/lang/zh_cn.json index ca71fe91..b25848c1 100644 --- a/Common/src/main/resources/assets/hexcasting/lang/zh_cn.json +++ b/Common/src/main/resources/assets/hexcasting/lang/zh_cn.json @@ -506,7 +506,7 @@ "hexcasting.mishap.invalid_pattern": "该图案不对应任何操作", "hexcasting.mishap.unescaped": "本应运行一个图案,实际却运行了%s", - "hexcasting.mishap.invalid_value": "%1$s本应在栈下标为%3$s处接受%2$s,实际却接受了%4$s", + "hexcasting.mishap.invalid_value": "%1$s本应在栈下标为%3$s处接受%2$s,而实际却接受了%4$s", "hexcasting.mishap.invalid_value.class.double": "一个数", "hexcasting.mishap.invalid_value.class.boolean": "一个布尔值", "hexcasting.mishap.invalid_value.class.vector": "一个向量", From 7dc76985920fdf462aa6f17ac09604414313cb99 Mon Sep 17 00:00:00 2001 From: ChuijkYahus <94828194+ChuijkYahus@users.noreply.github.com> Date: Wed, 23 Nov 2022 09:28:53 +0800 Subject: [PATCH 06/95] fix --- Common/src/main/resources/assets/hexcasting/lang/zh_cn.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Common/src/main/resources/assets/hexcasting/lang/zh_cn.json b/Common/src/main/resources/assets/hexcasting/lang/zh_cn.json index b25848c1..0a4925ae 100644 --- a/Common/src/main/resources/assets/hexcasting/lang/zh_cn.json +++ b/Common/src/main/resources/assets/hexcasting/lang/zh_cn.json @@ -506,7 +506,7 @@ "hexcasting.mishap.invalid_pattern": "该图案不对应任何操作", "hexcasting.mishap.unescaped": "本应运行一个图案,实际却运行了%s", - "hexcasting.mishap.invalid_value": "%1$s本应在栈下标为%3$s处接受%2$s,而实际却接受了%4$s", + "hexcasting.mishap.invalid_value": "%1$s本应在栈下标为%3$s处接受%2$s,而实际接受了%4$s", "hexcasting.mishap.invalid_value.class.double": "一个数", "hexcasting.mishap.invalid_value.class.boolean": "一个布尔值", "hexcasting.mishap.invalid_value.class.vector": "一个向量", From fd80f45aca03e6620faa09f6757caa093685af3b Mon Sep 17 00:00:00 2001 From: ChuijkYahus <94828194+ChuijkYahus@users.noreply.github.com> Date: Wed, 23 Nov 2022 09:30:56 +0800 Subject: [PATCH 07/95] fix --- Common/src/main/resources/assets/hexcasting/lang/zh_cn.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Common/src/main/resources/assets/hexcasting/lang/zh_cn.json b/Common/src/main/resources/assets/hexcasting/lang/zh_cn.json index 0a4925ae..1be26881 100644 --- a/Common/src/main/resources/assets/hexcasting/lang/zh_cn.json +++ b/Common/src/main/resources/assets/hexcasting/lang/zh_cn.json @@ -560,7 +560,7 @@ "hexcasting.mishap.bad_item.colorizer": "一个染色剂", "hexcasting.mishap.bad_block": "本应在%2$s处接受%1$s,而实际接受了%3$s", "hexcasting.mishap.bad_block.sapling": "一个树苗", - "hexcasting.mishap.bad_block.replaceable": "放置方块的地方", + "hexcasting.mishap.bad_block.replaceable": "一个放置方块的地方", "hexcasting.mishap.bad_brainsweep": "%s排斥此村民的意识", "hexcasting.mishap.already_brainswept": "此村民已被使用", "hexcasting.mishap.no_spell_circle": "%s需在法术环上执行", From 7c00cbaec86057843bcb704fc91ccfeea60d10b2 Mon Sep 17 00:00:00 2001 From: "petrak@" Date: Tue, 22 Nov 2022 19:31:09 -0600 Subject: [PATCH 08/95] possibly impl arbitrary brainsweeps. i don't know. i'm in offline mode --- .../hexcasting/api/spell/OperatorUtils.kt | 10 +- .../spell/mishaps/MishapAlreadyBrainswept.kt | 10 +- .../api/spell/mishaps/MishapBadBrainsweep.kt | 8 +- .../operators/spells/great/OpBrainsweep.kt | 23 +- .../hexcasting/common/misc/Brainsweeping.java | 29 +- .../common/recipe/BrainsweepRecipe.java | 27 +- .../brainsweep/BrainsweepIngredient.java | 11 +- .../EntityBrainsweepIngredient.java | 40 +- .../VillagerBrainsweepIngredient.java | 27 +- .../datagen/recipe/HexplatRecipes.kt | 565 +++++++++--------- .../builders/BrainsweepRecipeBuilder.java | 28 +- .../patchouli/BrainsweepProcessor.java | 8 +- .../at/petrak/hexcasting/mixin/MixinMob.java | 6 +- .../assets/hexcasting/lang/en_us.json | 8 +- .../hexcasting/fabric/FabricHexInitializer.kt | 4 +- .../fabric/interop/emi/HexEMIPlugin.java | 48 +- .../hexcasting/forge/ForgeHexInitializer.java | 6 +- .../interop/jei/BrainsweepRecipeCategory.java | 4 +- 18 files changed, 439 insertions(+), 423 deletions(-) diff --git a/Common/src/main/java/at/petrak/hexcasting/api/spell/OperatorUtils.kt b/Common/src/main/java/at/petrak/hexcasting/api/spell/OperatorUtils.kt index 6389208f..840ca0ba 100644 --- a/Common/src/main/java/at/petrak/hexcasting/api/spell/OperatorUtils.kt +++ b/Common/src/main/java/at/petrak/hexcasting/api/spell/OperatorUtils.kt @@ -13,9 +13,9 @@ import net.minecraft.core.BlockPos import net.minecraft.server.level.ServerPlayer import net.minecraft.world.entity.Entity import net.minecraft.world.entity.LivingEntity +import net.minecraft.world.entity.Mob import net.minecraft.world.entity.decoration.ArmorStand import net.minecraft.world.entity.item.ItemEntity -import net.minecraft.world.entity.npc.Villager import net.minecraft.world.phys.Vec3 import java.util.function.DoubleUnaryOperator import kotlin.math.abs @@ -99,14 +99,14 @@ fun List.getPlayer(idx: Int, argc: Int = 0): ServerPlayer { throw MishapInvalidIota.ofType(x, if (argc == 0) idx else argc - (idx + 1), "entity.player") } -fun List.getVillager(idx: Int, argc: Int = 0): Villager { +fun List.getMob(idx: Int, argc: Int = 0): Mob { val x = this.getOrElse(idx) { throw MishapNotEnoughArgs(idx + 1, this.size) } if (x is EntityIota) { val e = x.entity - if (e is Villager) + if (e is Mob) return e } - throw MishapInvalidIota.ofType(x, if (argc == 0) idx else argc - (idx + 1), "entity.villager") + throw MishapInvalidIota.ofType(x, if (argc == 0) idx else argc - (idx + 1), "entity.mob") } fun List.getLivingEntityButNotArmorStand(idx: Int, argc: Int = 0): LivingEntity { @@ -216,7 +216,7 @@ fun List.getPositiveIntUnderInclusive(idx: Int, max: Int, argc: Int = 0): if (x is DoubleIota) { val double = x.double val rounded = double.roundToInt() - if (abs(double - rounded) <= DoubleIota.TOLERANCE && rounded in 0 .. max) { + if (abs(double - rounded) <= DoubleIota.TOLERANCE && rounded in 0..max) { return rounded } } diff --git a/Common/src/main/java/at/petrak/hexcasting/api/spell/mishaps/MishapAlreadyBrainswept.kt b/Common/src/main/java/at/petrak/hexcasting/api/spell/mishaps/MishapAlreadyBrainswept.kt index d23b1092..07e5a00d 100644 --- a/Common/src/main/java/at/petrak/hexcasting/api/spell/mishaps/MishapAlreadyBrainswept.kt +++ b/Common/src/main/java/at/petrak/hexcasting/api/spell/mishaps/MishapAlreadyBrainswept.kt @@ -2,22 +2,22 @@ package at.petrak.hexcasting.api.spell.mishaps import at.petrak.hexcasting.api.misc.FrozenColorizer import at.petrak.hexcasting.api.misc.HexDamageSources -import at.petrak.hexcasting.api.spell.iota.Iota import at.petrak.hexcasting.api.spell.ParticleSpray import at.petrak.hexcasting.api.spell.casting.CastingContext -import net.minecraft.world.entity.npc.Villager +import at.petrak.hexcasting.api.spell.iota.Iota +import net.minecraft.world.entity.Mob import net.minecraft.world.item.DyeColor -class MishapAlreadyBrainswept(val villager: Villager) : Mishap() { +class MishapAlreadyBrainswept(val mob: Mob) : Mishap() { override fun accentColor(ctx: CastingContext, errorCtx: Context): FrozenColorizer = dyeColor(DyeColor.GREEN) override fun execute(ctx: CastingContext, errorCtx: Context, stack: MutableList) { - villager.hurt(HexDamageSources.overcastDamageFrom(ctx.caster), villager.health) + mob.hurt(HexDamageSources.overcastDamageFrom(ctx.caster), mob.health) } override fun particleSpray(ctx: CastingContext) = - ParticleSpray.burst(villager.eyePosition, 1.0) + ParticleSpray.burst(mob.eyePosition, 1.0) override fun errorMessage(ctx: CastingContext, errorCtx: Context) = error("already_brainswept") diff --git a/Common/src/main/java/at/petrak/hexcasting/api/spell/mishaps/MishapBadBrainsweep.kt b/Common/src/main/java/at/petrak/hexcasting/api/spell/mishaps/MishapBadBrainsweep.kt index 7f121c18..78e35e2b 100644 --- a/Common/src/main/java/at/petrak/hexcasting/api/spell/mishaps/MishapBadBrainsweep.kt +++ b/Common/src/main/java/at/petrak/hexcasting/api/spell/mishaps/MishapBadBrainsweep.kt @@ -3,19 +3,19 @@ package at.petrak.hexcasting.api.spell.mishaps import at.petrak.hexcasting.api.misc.FrozenColorizer import at.petrak.hexcasting.api.misc.HexDamageSources import at.petrak.hexcasting.api.spell.ParticleSpray -import at.petrak.hexcasting.api.spell.iota.Iota import at.petrak.hexcasting.api.spell.casting.CastingContext +import at.petrak.hexcasting.api.spell.iota.Iota import net.minecraft.core.BlockPos -import net.minecraft.world.entity.npc.Villager +import net.minecraft.world.entity.Mob import net.minecraft.world.item.DyeColor import net.minecraft.world.phys.Vec3 -class MishapBadBrainsweep(val villager: Villager, val pos: BlockPos) : Mishap() { +class MishapBadBrainsweep(val mob: Mob, val pos: BlockPos) : Mishap() { override fun accentColor(ctx: CastingContext, errorCtx: Context): FrozenColorizer = dyeColor(DyeColor.GREEN) override fun execute(ctx: CastingContext, errorCtx: Context, stack: MutableList) { - trulyHurt(villager, HexDamageSources.overcastDamageFrom(ctx.caster), villager.health) + trulyHurt(mob, HexDamageSources.overcastDamageFrom(ctx.caster), mob.health) } override fun particleSpray(ctx: CastingContext): ParticleSpray { 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 276ddf7e..d9e3d9b0 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,19 +1,20 @@ 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.spell.* import at.petrak.hexcasting.api.spell.casting.CastingContext import at.petrak.hexcasting.api.spell.iota.Iota import at.petrak.hexcasting.api.spell.mishaps.MishapAlreadyBrainswept import at.petrak.hexcasting.api.spell.mishaps.MishapBadBrainsweep -import at.petrak.hexcasting.common.misc.Brainsweeping import at.petrak.hexcasting.common.recipe.BrainsweepRecipe import at.petrak.hexcasting.common.recipe.HexRecipeStuffRegistry import at.petrak.hexcasting.ktxt.tellWitnessesThatIWasMurdered +import at.petrak.hexcasting.mixin.accessor.AccessorLivingEntity +import at.petrak.hexcasting.xplat.IXplatAbstractions import net.minecraft.core.BlockPos import net.minecraft.sounds.SoundEvents import net.minecraft.sounds.SoundSource +import net.minecraft.world.entity.Mob import net.minecraft.world.entity.npc.Villager import net.minecraft.world.level.block.state.BlockState import net.minecraft.world.phys.Vec3 @@ -30,12 +31,12 @@ object OpBrainsweep : SpellAction { args: List, ctx: CastingContext ): Triple>? { - val sacrifice = args.getVillager(0, argc) + val sacrifice = args.getMob(0, argc) val pos = args.getBlockPos(1, argc) ctx.assertVecInRange(pos) ctx.assertEntityInRange(sacrifice) - if (Brainsweeping.isBrainswept(sacrifice)) + if (IXplatAbstractions.INSTANCE.isBrainswept(sacrifice)) throw MishapAlreadyBrainswept(sacrifice) val state = ctx.world.getBlockState(pos) @@ -45,12 +46,12 @@ object OpBrainsweep : SpellAction { val recman = ctx.world.recipeManager val recipes = recman.getAllRecipesFor(HexRecipeStuffRegistry.BRAINSWEEP_TYPE) - val recipe = recipes.find { it.matches(state, sacrifice) } + val recipe = recipes.find { it.matches(state, sacrifice, ctx.world) } ?: throw MishapBadBrainsweep(sacrifice, pos) return Triple( Spell(pos, state, sacrifice, recipe), - 10 * MediaConstants.CRYSTAL_UNIT, + recipe.mediaCost, listOf(ParticleSpray.cloud(sacrifice.position(), 1.0), ParticleSpray.burst(Vec3.atCenterOf(pos), 0.3, 100)) ) } @@ -58,18 +59,20 @@ object OpBrainsweep : SpellAction { private data class Spell( val pos: BlockPos, val state: BlockState, - val sacrifice: Villager, + val sacrifice: Mob, val recipe: BrainsweepRecipe ) : RenderedSpell { override fun cast(ctx: CastingContext) { ctx.world.setBlockAndUpdate(pos, BrainsweepRecipe.copyProperties(state, recipe.result)) - Brainsweeping.brainsweep(sacrifice) - if (HexConfig.server().doVillagersTakeOffenseAtMindMurder()) { + IXplatAbstractions.INSTANCE.brainsweep(sacrifice) + if (sacrifice is Villager && HexConfig.server().doVillagersTakeOffenseAtMindMurder()) { sacrifice.tellWitnessesThatIWasMurdered(ctx.caster) } - ctx.world.playSound(null, sacrifice, SoundEvents.VILLAGER_DEATH, SoundSource.AMBIENT, 0.8f, 1f) + val sound = (sacrifice as AccessorLivingEntity).`hex$getDeathSound`() + if (sound != null) + ctx.world.playSound(null, sacrifice, sound, SoundSource.AMBIENT, 0.8f, 1f) ctx.world.playSound(null, sacrifice, SoundEvents.PLAYER_LEVELUP, SoundSource.AMBIENT, 0.5f, 0.8f) } } diff --git a/Common/src/main/java/at/petrak/hexcasting/common/misc/Brainsweeping.java b/Common/src/main/java/at/petrak/hexcasting/common/misc/Brainsweeping.java index 7821c3c7..6a5b1996 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/misc/Brainsweeping.java +++ b/Common/src/main/java/at/petrak/hexcasting/common/misc/Brainsweeping.java @@ -6,43 +6,24 @@ import net.minecraft.world.InteractionResult; import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.LivingEntity; import net.minecraft.world.entity.Mob; -import net.minecraft.world.entity.npc.Villager; -import net.minecraft.world.entity.npc.VillagerDataHolder; import net.minecraft.world.entity.player.Player; -import net.minecraft.world.entity.raid.Raider; import net.minecraft.world.level.Level; import net.minecraft.world.phys.EntityHitResult; import org.jetbrains.annotations.Nullable; public class Brainsweeping { - // Keeping these functions in Brainsweeping just so we have to change less code - public static void brainsweep(Mob entity) { - if (isValidTarget(entity)) { - IXplatAbstractions.INSTANCE.brainsweep(entity); - } - } - - public static boolean isBrainswept(Mob entity) { - return isValidTarget(entity) && IXplatAbstractions.INSTANCE.isBrainswept(entity); - } - - // TODO: make this a tag - public static boolean isValidTarget(Mob mob) { - return mob instanceof VillagerDataHolder || mob instanceof Raider; - } - - public static InteractionResult tradeWithVillager(Player player, Level world, InteractionHand hand, Entity entity, - @Nullable EntityHitResult hitResult) { - if (entity instanceof Villager v && IXplatAbstractions.INSTANCE.isBrainswept(v)) { + public static InteractionResult interactWithBrainswept(Player player, Level world, InteractionHand hand, + Entity entity, @Nullable EntityHitResult hitResult) { + if (entity instanceof Mob mob && IXplatAbstractions.INSTANCE.isBrainswept(mob)) { return InteractionResult.FAIL; } return InteractionResult.PASS; } - public static InteractionResult copyBrainsweepFromVillager(LivingEntity original, LivingEntity outcome) { + public static InteractionResult copyBrainsweepPostTransformation(LivingEntity original, LivingEntity outcome) { if (original instanceof Mob mOriginal && outcome instanceof Mob mOutcome - && IXplatAbstractions.INSTANCE.isBrainswept(mOriginal) && Brainsweeping.isValidTarget(mOutcome)) { + && IXplatAbstractions.INSTANCE.isBrainswept(mOriginal)) { IXplatAbstractions.INSTANCE.brainsweep(mOutcome); } return InteractionResult.PASS; diff --git a/Common/src/main/java/at/petrak/hexcasting/common/recipe/BrainsweepRecipe.java b/Common/src/main/java/at/petrak/hexcasting/common/recipe/BrainsweepRecipe.java index b19bed30..10c055f2 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/recipe/BrainsweepRecipe.java +++ b/Common/src/main/java/at/petrak/hexcasting/common/recipe/BrainsweepRecipe.java @@ -6,9 +6,10 @@ import at.petrak.hexcasting.common.recipe.ingredient.brainsweep.BrainsweepIngred import com.google.gson.JsonObject; import net.minecraft.network.FriendlyByteBuf; import net.minecraft.resources.ResourceLocation; +import net.minecraft.server.level.ServerLevel; import net.minecraft.util.GsonHelper; import net.minecraft.world.Container; -import net.minecraft.world.entity.npc.Villager; +import net.minecraft.world.entity.Entity; import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.crafting.Recipe; import net.minecraft.world.item.crafting.RecipeSerializer; @@ -21,13 +22,14 @@ import org.jetbrains.annotations.NotNull; // God I am a horrible person public record BrainsweepRecipe( - ResourceLocation id, - StateIngredient blockIn, - BrainsweepIngredient villagerIn, - BlockState result + ResourceLocation id, + StateIngredient blockIn, + BrainsweepIngredient entityIn, + int mediaCost, + BlockState result ) implements Recipe { - public boolean matches(BlockState blockIn, Villager villagerIn) { - return this.blockIn.test(blockIn) && this.villagerIn.test(villagerIn); + public boolean matches(BlockState blockIn, Entity victim, ServerLevel level) { + return this.blockIn.test(blockIn) && this.entityIn.test(victim, level); } @Override @@ -84,15 +86,17 @@ public record BrainsweepRecipe( @Override public @NotNull BrainsweepRecipe fromJson(ResourceLocation recipeID, JsonObject json) { var blockIn = StateIngredientHelper.deserialize(GsonHelper.getAsJsonObject(json, "blockIn")); - var villagerIn = BrainsweepIngredient.deserialize(GsonHelper.getAsJsonObject(json, "villagerIn")); + var villagerIn = BrainsweepIngredient.deserialize(GsonHelper.getAsJsonObject(json, "entityIn")); + var cost = GsonHelper.getAsInt(json, "cost"); var result = StateIngredientHelper.readBlockState(GsonHelper.getAsJsonObject(json, "result")); - return new BrainsweepRecipe(recipeID, blockIn, villagerIn, result); + return new BrainsweepRecipe(recipeID, blockIn, villagerIn, cost, result); } @Override public void toNetwork(FriendlyByteBuf buf, BrainsweepRecipe recipe) { recipe.blockIn.write(buf); - recipe.villagerIn.write(buf); + recipe.entityIn.write(buf); + buf.writeVarInt(recipe.mediaCost); buf.writeVarInt(Block.getId(recipe.result)); } @@ -100,8 +104,9 @@ public record BrainsweepRecipe( public @NotNull BrainsweepRecipe fromNetwork(ResourceLocation recipeID, FriendlyByteBuf buf) { var blockIn = StateIngredientHelper.read(buf); var villagerIn = BrainsweepIngredient.read(buf); + var cost = buf.readVarInt(); var result = Block.stateById(buf.readVarInt()); - return new BrainsweepRecipe(recipeID, blockIn, villagerIn, result); + return new BrainsweepRecipe(recipeID, blockIn, villagerIn, cost, result); } } } diff --git a/Common/src/main/java/at/petrak/hexcasting/common/recipe/ingredient/brainsweep/BrainsweepIngredient.java b/Common/src/main/java/at/petrak/hexcasting/common/recipe/ingredient/brainsweep/BrainsweepIngredient.java index 1f55f593..f110ce88 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/recipe/ingredient/brainsweep/BrainsweepIngredient.java +++ b/Common/src/main/java/at/petrak/hexcasting/common/recipe/ingredient/brainsweep/BrainsweepIngredient.java @@ -3,14 +3,16 @@ package at.petrak.hexcasting.common.recipe.ingredient.brainsweep; import com.google.gson.JsonObject; import net.minecraft.network.FriendlyByteBuf; import net.minecraft.network.chat.Component; +import net.minecraft.server.level.ServerLevel; import net.minecraft.util.GsonHelper; import net.minecraft.util.StringRepresentable; import net.minecraft.world.entity.Entity; import java.util.List; -import java.util.function.Predicate; -public abstract class BrainsweepIngredient implements Predicate { +public abstract class BrainsweepIngredient { + public abstract boolean test(Entity entity, ServerLevel level); + public abstract List getTooltip(boolean advanced); public abstract JsonObject serialize(); @@ -21,8 +23,7 @@ public abstract class BrainsweepIngredient implements Predicate { var type = buf.readVarInt(); return switch (Type.values()[type]) { case VILLAGER -> VillagerBrainsweepIngredient.read(buf); - case ENTITY -> { - } + case ENTITY -> EntityBrainsweepIngredient.read(buf); }; } @@ -31,7 +32,7 @@ public abstract class BrainsweepIngredient implements Predicate { var type = Type.valueOf(typestr); return switch (type) { case VILLAGER -> VillagerBrainsweepIngredient.deserialize(json); - case ENTITY -> null; + case ENTITY -> EntityBrainsweepIngredient.deserialize(json); }; } diff --git a/Common/src/main/java/at/petrak/hexcasting/common/recipe/ingredient/brainsweep/EntityBrainsweepIngredient.java b/Common/src/main/java/at/petrak/hexcasting/common/recipe/ingredient/brainsweep/EntityBrainsweepIngredient.java index 8ba7460c..e317734e 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/recipe/ingredient/brainsweep/EntityBrainsweepIngredient.java +++ b/Common/src/main/java/at/petrak/hexcasting/common/recipe/ingredient/brainsweep/EntityBrainsweepIngredient.java @@ -1,30 +1,35 @@ package at.petrak.hexcasting.common.recipe.ingredient.brainsweep; +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonElement; import com.google.gson.JsonObject; -import net.minecraft.advancements.critereon.DeserializationContext; import net.minecraft.advancements.critereon.EntityPredicate; -import net.minecraft.advancements.critereon.SerializationContext; import net.minecraft.network.FriendlyByteBuf; import net.minecraft.network.chat.Component; +import net.minecraft.server.level.ServerLevel; import net.minecraft.world.entity.Entity; -import net.minecraft.world.level.storage.loot.predicates.LootItemCondition; import java.util.List; +// Code based on: +// https://github.com/SlimeKnights/Mantle/blob/1.18.2/src/main/java/slimeknights/mantle/recipe/ingredient/EntityIngredient.java +// Licensed under MIT public class EntityBrainsweepIngredient extends BrainsweepIngredient { - public final EntityPredicate.Composite requirements; + public static final Gson GSON = new GsonBuilder().create(); + + public final EntityPredicate requirements; // Just tell the player what it is you want public final Component tooltip; - protected EntityBrainsweepIngredient(EntityPredicate.Composite requirements, Component tooltip) { - super(); + public EntityBrainsweepIngredient(EntityPredicate requirements, Component tooltip) { this.requirements = requirements; this.tooltip = tooltip; } @Override - public boolean test(Entity entity) { - return false; + public boolean test(Entity entity, ServerLevel level) { + return this.requirements.matches(level, null, entity); } @Override @@ -35,17 +40,32 @@ public class EntityBrainsweepIngredient extends BrainsweepIngredient { @Override public JsonObject serialize() { var obj = new JsonObject(); - obj.add("requirements", this.requirements.toJson(SerializationContext.INSTANCE)); + obj.addProperty("type", "entity"); + + obj.add("requirements", this.requirements.serializeToJson()); obj.addProperty("tooltip", Component.Serializer.toJson(this.tooltip)); return obj; } @Override public void write(FriendlyByteBuf buf) { + buf.writeVarInt(Type.ENTITY.ordinal()); + buf.writeUtf(this.requirements.serializeToJson().toString()); + buf.writeUtf(Component.Serializer.toJson(this.tooltip)); } public static EntityBrainsweepIngredient deserialize(JsonObject obj) { - var reqs = EntityPredicate.Composite.fromJson(obj, "requirements", DeserializationContext) + var reqs = EntityPredicate.fromJson(obj.get("requirements")); + var tooltip = Component.Serializer.fromJson(obj.get("tooltip")); + return new EntityBrainsweepIngredient(reqs, tooltip); + } + + public static EntityBrainsweepIngredient read(FriendlyByteBuf buf) { + var reqsObj = GSON.fromJson(buf.readUtf(), JsonElement.class); + + var reqs = EntityPredicate.fromJson(reqsObj); + var tooltip = Component.Serializer.fromJson(buf.readUtf()); + return new EntityBrainsweepIngredient(reqs, tooltip); } } diff --git a/Common/src/main/java/at/petrak/hexcasting/common/recipe/ingredient/brainsweep/VillagerBrainsweepIngredient.java b/Common/src/main/java/at/petrak/hexcasting/common/recipe/ingredient/brainsweep/VillagerBrainsweepIngredient.java index 4d4ff14a..12fa8048 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/recipe/ingredient/brainsweep/VillagerBrainsweepIngredient.java +++ b/Common/src/main/java/at/petrak/hexcasting/common/recipe/ingredient/brainsweep/VillagerBrainsweepIngredient.java @@ -8,6 +8,7 @@ import net.minecraft.network.FriendlyByteBuf; import net.minecraft.network.chat.Component; import net.minecraft.network.chat.MutableComponent; import net.minecraft.resources.ResourceLocation; +import net.minecraft.server.level.ServerLevel; import net.minecraft.util.GsonHelper; import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.EntityType; @@ -26,27 +27,26 @@ public class VillagerBrainsweepIngredient extends BrainsweepIngredient { private final @Nullable ResourceLocation biome; private final int minLevel; - protected VillagerBrainsweepIngredient( - @Nullable ResourceLocation profession, - @Nullable ResourceLocation biome, // aka their "type" - int minLevel + public VillagerBrainsweepIngredient( + @Nullable ResourceLocation profession, + @Nullable ResourceLocation biome, // aka their "type" + int minLevel ) { - super(); this.profession = profession; this.biome = biome; this.minLevel = minLevel; } @Override - public boolean test(Entity entity) { + public boolean test(Entity entity, ServerLevel level) { if (!(entity instanceof Villager villager)) return false; var data = villager.getVillagerData(); ResourceLocation profID = IXplatAbstractions.INSTANCE.getID(data.getProfession()); return (this.profession == null || this.profession.equals(profID)) - && (this.biome == null || this.biome.equals(Registry.VILLAGER_TYPE.getKey(data.getType()))) - && this.minLevel <= data.getLevel(); + && (this.biome == null || this.biome.equals(Registry.VILLAGER_TYPE.getKey(data.getType()))) + && this.minLevel <= data.getLevel(); } @Override @@ -57,10 +57,10 @@ public class VillagerBrainsweepIngredient extends BrainsweepIngredient { if (advanced) { if (minLevel >= 5) { tooltip.add(Component.translatable("hexcasting.tooltip.brainsweep.level", 5) - .withStyle(ChatFormatting.DARK_GRAY)); + .withStyle(ChatFormatting.DARK_GRAY)); } else if (minLevel > 1) { tooltip.add(Component.translatable("hexcasting.tooltip.brainsweep.min_level", minLevel) - .withStyle(ChatFormatting.DARK_GRAY)); + .withStyle(ChatFormatting.DARK_GRAY)); } if (biome != null) { @@ -68,7 +68,7 @@ public class VillagerBrainsweepIngredient extends BrainsweepIngredient { } ResourceLocation displayId = Objects.requireNonNullElseGet(profession, - () -> Registry.ENTITY_TYPE.getKey(EntityType.VILLAGER)); + () -> Registry.ENTITY_TYPE.getKey(EntityType.VILLAGER)); tooltip.add(Component.literal(displayId.toString()).withStyle(ChatFormatting.DARK_GRAY)); } @@ -153,14 +153,15 @@ public class VillagerBrainsweepIngredient extends BrainsweepIngredient { public static VillagerBrainsweepIngredient deserialize(JsonObject json) { ResourceLocation profession = null; - if (json.has("profession")) { + if (json.has("profession") && !json.get("profession").isJsonNull()) { profession = new ResourceLocation(GsonHelper.getAsString(json, "profession")); } ResourceLocation biome = null; - if (json.has("biome")) { + if (json.has("biome") && !json.get("biome").isJsonNull()) { biome = new ResourceLocation(GsonHelper.getAsString(json, "biome")); } int minLevel = GsonHelper.getAsInt(json, "minLevel"); + int cost = GsonHelper.getAsInt(json, "cost"); return new VillagerBrainsweepIngredient(profession, biome, minLevel); } diff --git a/Common/src/main/java/at/petrak/hexcasting/datagen/recipe/HexplatRecipes.kt b/Common/src/main/java/at/petrak/hexcasting/datagen/recipe/HexplatRecipes.kt index c75b1ea0..55c4c465 100644 --- a/Common/src/main/java/at/petrak/hexcasting/datagen/recipe/HexplatRecipes.kt +++ b/Common/src/main/java/at/petrak/hexcasting/datagen/recipe/HexplatRecipes.kt @@ -2,6 +2,7 @@ package at.petrak.hexcasting.datagen.recipe import at.petrak.hexcasting.api.HexAPI import at.petrak.hexcasting.api.advancements.OvercastTrigger +import at.petrak.hexcasting.api.misc.MediaConstants import at.petrak.hexcasting.api.mod.HexItemTags import at.petrak.hexcasting.common.items.ItemStaff import at.petrak.hexcasting.common.items.colorizer.ItemPrideColorizer @@ -10,7 +11,7 @@ import at.petrak.hexcasting.common.lib.HexItems import at.petrak.hexcasting.common.recipe.SealFocusRecipe import at.petrak.hexcasting.common.recipe.SealSpellbookRecipe import at.petrak.hexcasting.common.recipe.ingredient.StateIngredientHelper -import at.petrak.hexcasting.common.recipe.ingredient.brainsweep.BrainsweepIngredient +import at.petrak.hexcasting.common.recipe.ingredient.brainsweep.VillagerBrainsweepIngredient import at.petrak.hexcasting.datagen.IXplatConditionsBuilder import at.petrak.hexcasting.datagen.IXplatIngredients import at.petrak.hexcasting.datagen.recipe.builders.BrainsweepRecipeBuilder @@ -36,9 +37,9 @@ import net.minecraft.world.level.block.Blocks import java.util.function.Consumer class HexplatRecipes( - val generator: DataGenerator, - val ingredients: IXplatIngredients, - val conditions: (RecipeBuilder) -> IXplatConditionsBuilder + val generator: DataGenerator, + val ingredients: IXplatIngredients, + val conditions: (RecipeBuilder) -> IXplatConditionsBuilder ) : PaucalRecipeProvider(generator, HexAPI.MOD_ID) { override fun makeRecipes(recipes: Consumer) { @@ -56,78 +57,78 @@ class HexplatRecipes( wandRecipe(recipes, HexItems.STAFF_EDIFIED, HexBlocks.EDIFIED_PLANKS.asItem()) ringCornered(HexItems.FOCUS, 1, - ingredients.glowstoneDust(), - ingredients.leather(), - Ingredient.of(HexItems.CHARGED_AMETHYST)) - .unlockedBy("has_item", hasItem(HexItemTags.STAVES)) - .save(recipes) + ingredients.glowstoneDust(), + ingredients.leather(), + Ingredient.of(HexItems.CHARGED_AMETHYST)) + .unlockedBy("has_item", hasItem(HexItemTags.STAVES)) + .save(recipes) ShapedRecipeBuilder.shaped(HexItems.SPELLBOOK) - .define('N', ingredients.goldNugget()) - .define('B', Items.WRITABLE_BOOK) - .define('A', HexItems.CHARGED_AMETHYST) - .define('F', Items.CHORUS_FRUIT) // i wanna gate this behind the end SOMEHOW - // hey look its my gender ^^ - .pattern("NBA") - .pattern("NFA") - .pattern("NBA") - .unlockedBy("has_focus", hasItem(HexItems.FOCUS)) - .unlockedBy("has_chorus", hasItem(Items.CHORUS_FRUIT)).save(recipes) + .define('N', ingredients.goldNugget()) + .define('B', Items.WRITABLE_BOOK) + .define('A', HexItems.CHARGED_AMETHYST) + .define('F', Items.CHORUS_FRUIT) // i wanna gate this behind the end SOMEHOW + // hey look its my gender ^^ + .pattern("NBA") + .pattern("NFA") + .pattern("NBA") + .unlockedBy("has_focus", hasItem(HexItems.FOCUS)) + .unlockedBy("has_chorus", hasItem(Items.CHORUS_FRUIT)).save(recipes) ringCornerless( - HexItems.CYPHER, 1, - ingredients.copperIngot(), - Ingredient.of(HexItems.AMETHYST_DUST)) - .unlockedBy("has_item", hasItem(HexItemTags.STAVES)).save(recipes) + HexItems.CYPHER, 1, + ingredients.copperIngot(), + Ingredient.of(HexItems.AMETHYST_DUST)) + .unlockedBy("has_item", hasItem(HexItemTags.STAVES)).save(recipes) ringCornerless( - HexItems.TRINKET, 1, - ingredients.ironIngot(), - Ingredient.of(Items.AMETHYST_SHARD)) - .unlockedBy("has_item", hasItem(HexItemTags.STAVES)).save(recipes) + HexItems.TRINKET, 1, + ingredients.ironIngot(), + Ingredient.of(Items.AMETHYST_SHARD)) + .unlockedBy("has_item", hasItem(HexItemTags.STAVES)).save(recipes) ShapedRecipeBuilder.shaped(HexItems.ARTIFACT) - .define('F', ingredients.goldIngot()) - .define('A', HexItems.CHARGED_AMETHYST) - // why in god's name does minecraft have two different places for item tags - .define('D', ItemTags.MUSIC_DISCS) - .pattern(" F ") - .pattern("FAF") - .pattern(" D ") - .unlockedBy("has_item", hasItem(HexItemTags.STAVES)).save(recipes) + .define('F', ingredients.goldIngot()) + .define('A', HexItems.CHARGED_AMETHYST) + // why in god's name does minecraft have two different places for item tags + .define('D', ItemTags.MUSIC_DISCS) + .pattern(" F ") + .pattern("FAF") + .pattern(" D ") + .unlockedBy("has_item", hasItem(HexItemTags.STAVES)).save(recipes) ringCornerless(HexItems.SCRYING_LENS, 1, Items.GLASS, HexItems.AMETHYST_DUST) - .unlockedBy("has_item", hasItem(HexItemTags.STAVES)).save(recipes) + .unlockedBy("has_item", hasItem(HexItemTags.STAVES)).save(recipes) ShapedRecipeBuilder.shaped(HexItems.ABACUS) - .define('S', Items.STICK) - .define('A', Items.AMETHYST_SHARD) - .define('W', ItemTags.PLANKS) - .pattern("WAW") - .pattern("SAS") - .pattern("WAW") - .unlockedBy("has_item", hasItem(HexItemTags.STAVES)).save(recipes) + .define('S', Items.STICK) + .define('A', Items.AMETHYST_SHARD) + .define('W', ItemTags.PLANKS) + .pattern("WAW") + .pattern("SAS") + .pattern("WAW") + .unlockedBy("has_item", hasItem(HexItemTags.STAVES)).save(recipes) // Why am I like this ShapedRecipeBuilder.shaped(HexItems.SUBMARINE_SANDWICH) - .define('S', Items.STICK) - .define('A', Items.AMETHYST_SHARD) - .define('C', Items.COOKED_BEEF) - .define('B', Items.BREAD) - .pattern(" SA") - .pattern(" C ") - .pattern(" B ") - .unlockedBy("has_item", hasItem(Items.AMETHYST_SHARD)).save(recipes) + .define('S', Items.STICK) + .define('A', Items.AMETHYST_SHARD) + .define('C', Items.COOKED_BEEF) + .define('B', Items.BREAD) + .pattern(" SA") + .pattern(" C ") + .pattern(" B ") + .unlockedBy("has_item", hasItem(Items.AMETHYST_SHARD)).save(recipes) for (dye in DyeColor.values()) { val item = HexItems.DYE_COLORIZERS[dye]!! ShapedRecipeBuilder.shaped(item) - .define('D', HexItems.AMETHYST_DUST) - .define('C', DyeItem.byColor(dye)) - .pattern(" D ") - .pattern("DCD") - .pattern(" D ") - .unlockedBy("has_item", hasItem(HexItems.AMETHYST_DUST)).save(recipes) + .define('D', HexItems.AMETHYST_DUST) + .define('C', DyeItem.byColor(dye)) + .pattern(" D ") + .pattern("DCD") + .pattern(" D ") + .unlockedBy("has_item", hasItem(HexItems.AMETHYST_DUST)).save(recipes) } gayRecipe(recipes, ItemPrideColorizer.Type.AGENDER, Ingredient.of(Items.GLASS)) @@ -144,337 +145,337 @@ class HexplatRecipes( gayRecipe(recipes, ItemPrideColorizer.Type.LESBIAN, Ingredient.of(Items.HONEYCOMB)) gayRecipe(recipes, ItemPrideColorizer.Type.NONBINARY, Ingredient.of(Items.MOSS_BLOCK)) gayRecipe(recipes, ItemPrideColorizer.Type.PANSEXUAL, ingredients.whenModIngredient( - Ingredient.of(Items.CARROT), - "farmersdelight", - CompatIngredientValue.of("farmersdelight:skillet") + Ingredient.of(Items.CARROT), + "farmersdelight", + CompatIngredientValue.of("farmersdelight:skillet") )) gayRecipe(recipes, ItemPrideColorizer.Type.PLURAL, Ingredient.of(Items.REPEATER)) gayRecipe(recipes, ItemPrideColorizer.Type.TRANSGENDER, Ingredient.of(Items.EGG)) ShapedRecipeBuilder.shaped(HexItems.UUID_COLORIZER) - .define('B', Items.BOWL) - .define('D', HexItems.AMETHYST_DUST) - .define('C', Items.AMETHYST_SHARD) - .pattern(" C ") - .pattern(" D ") - .pattern(" B ") - .unlockedBy("has_item", hasItem(HexItems.AMETHYST_DUST)).save(recipes) + .define('B', Items.BOWL) + .define('D', HexItems.AMETHYST_DUST) + .define('C', Items.AMETHYST_SHARD) + .pattern(" C ") + .pattern(" D ") + .pattern(" B ") + .unlockedBy("has_item", hasItem(HexItems.AMETHYST_DUST)).save(recipes) ShapedRecipeBuilder.shaped(HexItems.SCROLL_SMOL) - .define('P', Items.PAPER) - .define('A', Items.AMETHYST_SHARD) - .pattern(" A") - .pattern("P ") - .unlockedBy("has_item", hasItem(Items.AMETHYST_SHARD)).save(recipes) + .define('P', Items.PAPER) + .define('A', Items.AMETHYST_SHARD) + .pattern(" A") + .pattern("P ") + .unlockedBy("has_item", hasItem(Items.AMETHYST_SHARD)).save(recipes) ShapedRecipeBuilder.shaped(HexItems.SCROLL_MEDIUM) - .define('P', Items.PAPER) - .define('A', Items.AMETHYST_SHARD) - .pattern(" A") - .pattern("PP ") - .pattern("PP ") - .unlockedBy("has_item", hasItem(Items.AMETHYST_SHARD)).save(recipes) + .define('P', Items.PAPER) + .define('A', Items.AMETHYST_SHARD) + .pattern(" A") + .pattern("PP ") + .pattern("PP ") + .unlockedBy("has_item", hasItem(Items.AMETHYST_SHARD)).save(recipes) ShapedRecipeBuilder.shaped(HexItems.SCROLL_LARGE) - .define('P', Items.PAPER) - .define('A', Items.AMETHYST_SHARD) - .pattern("PPA") - .pattern("PPP") - .pattern("PPP") - .unlockedBy("has_item", hasItem(Items.AMETHYST_SHARD)).save(recipes) + .define('P', Items.PAPER) + .define('A', Items.AMETHYST_SHARD) + .pattern("PPA") + .pattern("PPP") + .pattern("PPP") + .unlockedBy("has_item", hasItem(Items.AMETHYST_SHARD)).save(recipes) ShapedRecipeBuilder.shaped(HexItems.SLATE, 6) - .define('S', Items.DEEPSLATE) - .define('A', HexItems.AMETHYST_DUST) - .pattern(" A ") - .pattern("SSS") - .unlockedBy("has_item", hasItem(HexItems.AMETHYST_DUST)).save(recipes) + .define('S', Items.DEEPSLATE) + .define('A', HexItems.AMETHYST_DUST) + .pattern(" A ") + .pattern("SSS") + .unlockedBy("has_item", hasItem(HexItems.AMETHYST_DUST)).save(recipes) ShapedRecipeBuilder.shaped(HexItems.JEWELER_HAMMER) - .define('I', ingredients.ironIngot()) - .define('N', ingredients.ironNugget()) - .define('A', Items.AMETHYST_SHARD) - .define('S', ingredients.stick()) - .pattern("IAN") - .pattern(" S ") - .pattern(" S ") - .unlockedBy("has_item", hasItem(Items.AMETHYST_SHARD)).save(recipes) + .define('I', ingredients.ironIngot()) + .define('N', ingredients.ironNugget()) + .define('A', Items.AMETHYST_SHARD) + .define('S', ingredients.stick()) + .pattern("IAN") + .pattern(" S ") + .pattern(" S ") + .unlockedBy("has_item", hasItem(Items.AMETHYST_SHARD)).save(recipes) ShapedRecipeBuilder.shaped(HexBlocks.SLATE_BLOCK) - .define('S', HexItems.SLATE) - .pattern("S") - .pattern("S") - .unlockedBy("has_item", hasItem(HexItems.SLATE)) - .save(recipes, modLoc("slate_block_from_slates")) + .define('S', HexItems.SLATE) + .pattern("S") + .pattern("S") + .unlockedBy("has_item", hasItem(HexItems.SLATE)) + .save(recipes, modLoc("slate_block_from_slates")) ringAll(HexBlocks.SLATE_BLOCK, 8, Blocks.DEEPSLATE, HexItems.AMETHYST_DUST) - .unlockedBy("has_item", hasItem(HexItems.SLATE)).save(recipes) + .unlockedBy("has_item", hasItem(HexItems.SLATE)).save(recipes) packing(HexItems.AMETHYST_DUST, HexBlocks.AMETHYST_DUST_BLOCK.asItem(), "amethyst_dust", - false, recipes) + false, recipes) ringAll(HexBlocks.AMETHYST_TILES, 8, Blocks.AMETHYST_BLOCK, HexItems.AMETHYST_DUST) - .unlockedBy("has_item", hasItem(HexItems.AMETHYST_DUST)).save(recipes) + .unlockedBy("has_item", hasItem(HexItems.AMETHYST_DUST)).save(recipes) SingleItemRecipeBuilder.stonecutting(Ingredient.of(Blocks.AMETHYST_BLOCK), HexBlocks.AMETHYST_TILES) - .unlockedBy("has_item", hasItem(Blocks.AMETHYST_BLOCK)) - .save(recipes, modLoc("stonecutting/amethyst_tiles")) + .unlockedBy("has_item", hasItem(Blocks.AMETHYST_BLOCK)) + .save(recipes, modLoc("stonecutting/amethyst_tiles")) ringAll(HexBlocks.SCROLL_PAPER, 8, Items.PAPER, Items.AMETHYST_SHARD) - .unlockedBy("has_item", hasItem(Items.AMETHYST_SHARD)).save(recipes) + .unlockedBy("has_item", hasItem(Items.AMETHYST_SHARD)).save(recipes) ShapelessRecipeBuilder.shapeless(HexBlocks.ANCIENT_SCROLL_PAPER, 8) - .requires(ingredients.dyes()[DyeColor.BROWN]!!) - .requires(HexBlocks.SCROLL_PAPER, 8) - .unlockedBy("has_item", hasItem(HexBlocks.SCROLL_PAPER)).save(recipes) + .requires(ingredients.dyes()[DyeColor.BROWN]!!) + .requires(HexBlocks.SCROLL_PAPER, 8) + .unlockedBy("has_item", hasItem(HexBlocks.SCROLL_PAPER)).save(recipes) stack(HexBlocks.SCROLL_PAPER_LANTERN, 1, HexBlocks.SCROLL_PAPER, Items.TORCH) - .unlockedBy("has_item", hasItem(HexBlocks.SCROLL_PAPER)).save(recipes) + .unlockedBy("has_item", hasItem(HexBlocks.SCROLL_PAPER)).save(recipes) stack(HexBlocks.ANCIENT_SCROLL_PAPER_LANTERN, 1, HexBlocks.ANCIENT_SCROLL_PAPER, Items.TORCH) - .unlockedBy("has_item", hasItem(HexBlocks.ANCIENT_SCROLL_PAPER)).save(recipes) + .unlockedBy("has_item", hasItem(HexBlocks.ANCIENT_SCROLL_PAPER)).save(recipes) ShapelessRecipeBuilder.shapeless(HexBlocks.ANCIENT_SCROLL_PAPER_LANTERN, 8) - .requires(ingredients.dyes()[DyeColor.BROWN]!!) - .requires(HexBlocks.SCROLL_PAPER_LANTERN, 8) - .unlockedBy("has_item", hasItem(HexBlocks.SCROLL_PAPER_LANTERN)) - .save(recipes, modLoc("ageing_scroll_paper_lantern")) + .requires(ingredients.dyes()[DyeColor.BROWN]!!) + .requires(HexBlocks.SCROLL_PAPER_LANTERN, 8) + .unlockedBy("has_item", hasItem(HexBlocks.SCROLL_PAPER_LANTERN)) + .save(recipes, modLoc("ageing_scroll_paper_lantern")) stack(HexBlocks.SCONCE, 4, - Ingredient.of(HexItems.CHARGED_AMETHYST), - ingredients.copperIngot()) - .unlockedBy("has_item", hasItem(HexItems.CHARGED_AMETHYST)).save(recipes) + Ingredient.of(HexItems.CHARGED_AMETHYST), + ingredients.copperIngot()) + .unlockedBy("has_item", hasItem(HexItems.CHARGED_AMETHYST)).save(recipes) ShapelessRecipeBuilder.shapeless(HexBlocks.EDIFIED_PLANKS, 4) - .requires(HexItemTags.EDIFIED_LOGS) - .unlockedBy("has_item", hasItem(HexItemTags.EDIFIED_LOGS)).save(recipes) + .requires(HexItemTags.EDIFIED_LOGS) + .unlockedBy("has_item", hasItem(HexItemTags.EDIFIED_LOGS)).save(recipes) ShapedRecipeBuilder.shaped(HexBlocks.EDIFIED_WOOD, 3) - .define('W', HexBlocks.EDIFIED_LOG) - .pattern("WW") - .pattern("WW") - .unlockedBy("has_item", hasItem(HexBlocks.EDIFIED_LOG)).save(recipes) + .define('W', HexBlocks.EDIFIED_LOG) + .pattern("WW") + .pattern("WW") + .unlockedBy("has_item", hasItem(HexBlocks.EDIFIED_LOG)).save(recipes) ShapedRecipeBuilder.shaped(HexBlocks.STRIPPED_EDIFIED_WOOD, 3) - .define('W', HexBlocks.STRIPPED_EDIFIED_LOG) - .pattern("WW") - .pattern("WW") - .unlockedBy("has_item", hasItem(HexBlocks.STRIPPED_EDIFIED_LOG)).save(recipes) + .define('W', HexBlocks.STRIPPED_EDIFIED_LOG) + .pattern("WW") + .pattern("WW") + .unlockedBy("has_item", hasItem(HexBlocks.STRIPPED_EDIFIED_LOG)).save(recipes) ring(HexBlocks.EDIFIED_PANEL, 8, - HexItemTags.EDIFIED_PLANKS, null) - .unlockedBy("has_item", hasItem(HexItemTags.EDIFIED_PLANKS)).save(recipes) + HexItemTags.EDIFIED_PLANKS, null) + .unlockedBy("has_item", hasItem(HexItemTags.EDIFIED_PLANKS)).save(recipes) ShapedRecipeBuilder.shaped(HexBlocks.EDIFIED_TILE, 6) - .define('W', HexItemTags.EDIFIED_PLANKS) - .pattern("WW ") - .pattern("W W") - .pattern(" WW") - .unlockedBy("has_item", hasItem(HexItemTags.EDIFIED_PLANKS)).save(recipes) + .define('W', HexItemTags.EDIFIED_PLANKS) + .pattern("WW ") + .pattern("W W") + .pattern(" WW") + .unlockedBy("has_item", hasItem(HexItemTags.EDIFIED_PLANKS)).save(recipes) ShapedRecipeBuilder.shaped(HexBlocks.EDIFIED_DOOR, 3) - .define('W', HexItemTags.EDIFIED_PLANKS) - .pattern("WW") - .pattern("WW") - .pattern("WW") - .unlockedBy("has_item", hasItem(HexItemTags.EDIFIED_PLANKS)).save(recipes) + .define('W', HexItemTags.EDIFIED_PLANKS) + .pattern("WW") + .pattern("WW") + .pattern("WW") + .unlockedBy("has_item", hasItem(HexItemTags.EDIFIED_PLANKS)).save(recipes) ShapedRecipeBuilder.shaped(HexBlocks.EDIFIED_TRAPDOOR, 2) - .define('W', HexItemTags.EDIFIED_PLANKS) - .pattern("WWW") - .pattern("WWW") - .unlockedBy("has_item", hasItem(HexItemTags.EDIFIED_PLANKS)).save(recipes) + .define('W', HexItemTags.EDIFIED_PLANKS) + .pattern("WWW") + .pattern("WWW") + .unlockedBy("has_item", hasItem(HexItemTags.EDIFIED_PLANKS)).save(recipes) ShapedRecipeBuilder.shaped(HexBlocks.EDIFIED_STAIRS, 4) - .define('W', HexItemTags.EDIFIED_PLANKS) - .pattern("W ") - .pattern("WW ") - .pattern("WWW") - .unlockedBy("has_item", hasItem(HexItemTags.EDIFIED_PLANKS)).save(recipes) + .define('W', HexItemTags.EDIFIED_PLANKS) + .pattern("W ") + .pattern("WW ") + .pattern("WWW") + .unlockedBy("has_item", hasItem(HexItemTags.EDIFIED_PLANKS)).save(recipes) ShapedRecipeBuilder.shaped(HexBlocks.EDIFIED_SLAB, 6) - .define('W', HexItemTags.EDIFIED_PLANKS) - .pattern("WWW") - .unlockedBy("has_item", hasItem(HexItemTags.EDIFIED_PLANKS)).save(recipes) + .define('W', HexItemTags.EDIFIED_PLANKS) + .pattern("WWW") + .unlockedBy("has_item", hasItem(HexItemTags.EDIFIED_PLANKS)).save(recipes) ShapedRecipeBuilder.shaped(HexBlocks.EDIFIED_PRESSURE_PLATE, 1) - .define('W', HexItemTags.EDIFIED_PLANKS) - .pattern("WW") - .unlockedBy("has_item", hasItem(HexItemTags.EDIFIED_PLANKS)).save(recipes) + .define('W', HexItemTags.EDIFIED_PLANKS) + .pattern("WW") + .unlockedBy("has_item", hasItem(HexItemTags.EDIFIED_PLANKS)).save(recipes) ShapelessRecipeBuilder.shapeless(HexBlocks.EDIFIED_BUTTON) - .requires(HexItemTags.EDIFIED_PLANKS) - .unlockedBy("has_item", hasItem(HexItemTags.EDIFIED_PLANKS)).save(recipes) + .requires(HexItemTags.EDIFIED_PLANKS) + .unlockedBy("has_item", hasItem(HexItemTags.EDIFIED_PLANKS)).save(recipes) val enlightenment = OvercastTrigger.Instance( - EntityPredicate.Composite.ANY, - MinMaxBounds.Ints.ANY, // add a little bit of slop here - MinMaxBounds.Doubles.atLeast(0.8), - MinMaxBounds.Doubles.between(0.1, 2.05) + EntityPredicate.Composite.ANY, + MinMaxBounds.Ints.ANY, // add a little bit of slop here + MinMaxBounds.Doubles.atLeast(0.8), + MinMaxBounds.Doubles.between(0.1, 2.05) ) ShapedRecipeBuilder.shaped(HexBlocks.EMPTY_IMPETUS) - .define('B', Items.IRON_BARS) - .define('A', HexItems.CHARGED_AMETHYST) - .define('S', HexBlocks.SLATE_BLOCK) - .define('P', Items.PURPUR_BLOCK) - .pattern("PSS") - .pattern("BAB") - .pattern("SSP") - .unlockedBy("enlightenment", enlightenment).save(recipes) + .define('B', Items.IRON_BARS) + .define('A', HexItems.CHARGED_AMETHYST) + .define('S', HexBlocks.SLATE_BLOCK) + .define('P', Items.PURPUR_BLOCK) + .pattern("PSS") + .pattern("BAB") + .pattern("SSP") + .unlockedBy("enlightenment", enlightenment).save(recipes) ShapedRecipeBuilder.shaped(HexBlocks.EMPTY_DIRECTRIX) - .define('C', Items.COMPARATOR) - .define('O', Items.OBSERVER) - .define('A', HexItems.CHARGED_AMETHYST) - .define('S', HexBlocks.SLATE_BLOCK) - .pattern("CSS") - .pattern("OAO") - .pattern("SSC") - .unlockedBy("enlightenment", enlightenment).save(recipes) + .define('C', Items.COMPARATOR) + .define('O', Items.OBSERVER) + .define('A', HexItems.CHARGED_AMETHYST) + .define('S', HexBlocks.SLATE_BLOCK) + .pattern("CSS") + .pattern("OAO") + .pattern("SSC") + .unlockedBy("enlightenment", enlightenment).save(recipes) ShapedRecipeBuilder.shaped(HexBlocks.AKASHIC_BOOKSHELF) - .define('L', HexItemTags.EDIFIED_LOGS) - .define('P', HexItemTags.EDIFIED_PLANKS) - .define('C', Items.BOOK) - /*this is the*/.pattern("LPL") // and what i have for you today is - .pattern("CCC") - .pattern("LPL") - .unlockedBy("enlightenment", enlightenment).save(recipes) + .define('L', HexItemTags.EDIFIED_LOGS) + .define('P', HexItemTags.EDIFIED_PLANKS) + .define('C', Items.BOOK) + /*this is the*/.pattern("LPL") // and what i have for you today is + .pattern("CCC") + .pattern("LPL") + .unlockedBy("enlightenment", enlightenment).save(recipes) ShapedRecipeBuilder.shaped(HexBlocks.AKASHIC_LIGATURE) - .define('L', HexItemTags.EDIFIED_LOGS) - .define('P', HexItemTags.EDIFIED_PLANKS) - .define('C', HexItems.CHARGED_AMETHYST) - .pattern("LPL") - .pattern("CCC") - .pattern("LPL") - .unlockedBy("enlightenment", enlightenment).save(recipes) + .define('L', HexItemTags.EDIFIED_LOGS) + .define('P', HexItemTags.EDIFIED_PLANKS) + .define('C', HexItems.CHARGED_AMETHYST) + .pattern("LPL") + .pattern("CCC") + .pattern("LPL") + .unlockedBy("enlightenment", enlightenment).save(recipes) BrainsweepRecipeBuilder(StateIngredientHelper.of(Blocks.AMETHYST_BLOCK), - BrainsweepIngredient(null, null, 3), - Blocks.BUDDING_AMETHYST.defaultBlockState()) - .unlockedBy("enlightenment", enlightenment) - .save(recipes, modLoc("brainsweep/budding_amethyst")) + VillagerBrainsweepIngredient(null, null, 3), + Blocks.BUDDING_AMETHYST.defaultBlockState(), MediaConstants.CRYSTAL_UNIT * 10) + .unlockedBy("enlightenment", enlightenment) + .save(recipes, modLoc("brainsweep/budding_amethyst")) BrainsweepRecipeBuilder(StateIngredientHelper.of(HexBlocks.EMPTY_IMPETUS), - BrainsweepIngredient(ResourceLocation("toolsmith"), null, 2), - HexBlocks.IMPETUS_RIGHTCLICK.defaultBlockState()) - .unlockedBy("enlightenment", enlightenment) - .save(recipes, modLoc("brainsweep/impetus_rightclick")) + VillagerBrainsweepIngredient(ResourceLocation("toolsmith"), null, 2), + HexBlocks.IMPETUS_RIGHTCLICK.defaultBlockState(), MediaConstants.CRYSTAL_UNIT * 10) + .unlockedBy("enlightenment", enlightenment) + .save(recipes, modLoc("brainsweep/impetus_rightclick")) BrainsweepRecipeBuilder(StateIngredientHelper.of(HexBlocks.EMPTY_IMPETUS), - BrainsweepIngredient(ResourceLocation("fletcher"), null, 2), - HexBlocks.IMPETUS_LOOK.defaultBlockState()) - .unlockedBy("enlightenment", enlightenment) - .save(recipes, modLoc("brainsweep/impetus_look")) + VillagerBrainsweepIngredient(ResourceLocation("fletcher"), null, 2), + HexBlocks.IMPETUS_LOOK.defaultBlockState(), MediaConstants.CRYSTAL_UNIT * 10) + .unlockedBy("enlightenment", enlightenment) + .save(recipes, modLoc("brainsweep/impetus_look")) BrainsweepRecipeBuilder(StateIngredientHelper.of(HexBlocks.EMPTY_IMPETUS), - BrainsweepIngredient(ResourceLocation("cleric"), null, 2), - HexBlocks.IMPETUS_STOREDPLAYER.defaultBlockState()) - .unlockedBy("enlightenment", enlightenment) - .save(recipes, modLoc("brainsweep/impetus_storedplayer")) + VillagerBrainsweepIngredient(ResourceLocation("cleric"), null, 2), + HexBlocks.IMPETUS_STOREDPLAYER.defaultBlockState(), MediaConstants.CRYSTAL_UNIT * 10) + .unlockedBy("enlightenment", enlightenment) + .save(recipes, modLoc("brainsweep/impetus_storedplayer")) BrainsweepRecipeBuilder(StateIngredientHelper.of(HexBlocks.EMPTY_DIRECTRIX), - BrainsweepIngredient(ResourceLocation("mason"), null, 1), - HexBlocks.DIRECTRIX_REDSTONE.defaultBlockState()) - .unlockedBy("enlightenment", enlightenment) - .save(recipes, modLoc("brainsweep/directrix_redstone")) + VillagerBrainsweepIngredient(ResourceLocation("mason"), null, 1), + HexBlocks.DIRECTRIX_REDSTONE.defaultBlockState(), MediaConstants.CRYSTAL_UNIT * 10) + .unlockedBy("enlightenment", enlightenment) + .save(recipes, modLoc("brainsweep/directrix_redstone")) BrainsweepRecipeBuilder(StateIngredientHelper.of(HexBlocks.AKASHIC_LIGATURE), - BrainsweepIngredient(ResourceLocation("librarian"), null, 5), - HexBlocks.AKASHIC_RECORD.defaultBlockState()) - .unlockedBy("enlightenment", enlightenment) - .save(recipes, modLoc("brainsweep/akashic_record")) + VillagerBrainsweepIngredient(ResourceLocation("librarian"), null, 5), + HexBlocks.AKASHIC_RECORD.defaultBlockState(), MediaConstants.CRYSTAL_UNIT * 10) + .unlockedBy("enlightenment", enlightenment) + .save(recipes, modLoc("brainsweep/akashic_record")) // Create compat CreateCrushingRecipeBuilder() - .withInput(Blocks.AMETHYST_CLUSTER) - .duration(150) - .withOutput(Items.AMETHYST_SHARD, 7) - .withOutput(HexItems.AMETHYST_DUST, 5) - .withOutput(0.25f, HexItems.CHARGED_AMETHYST) - .withConditions() - .whenModLoaded("create") - .save(recipes, ResourceLocation("create", "crushing/amethyst_cluster")) + .withInput(Blocks.AMETHYST_CLUSTER) + .duration(150) + .withOutput(Items.AMETHYST_SHARD, 7) + .withOutput(HexItems.AMETHYST_DUST, 5) + .withOutput(0.25f, HexItems.CHARGED_AMETHYST) + .withConditions() + .whenModLoaded("create") + .save(recipes, ResourceLocation("create", "crushing/amethyst_cluster")) CreateCrushingRecipeBuilder() - .withInput(Blocks.AMETHYST_BLOCK) - .duration(150) - .withOutput(Items.AMETHYST_SHARD, 3) - .withOutput(0.5f, HexItems.AMETHYST_DUST, 4) - .withConditions() - .whenModLoaded("create") - .save(recipes, ResourceLocation("create", "crushing/amethyst_block")) + .withInput(Blocks.AMETHYST_BLOCK) + .duration(150) + .withOutput(Items.AMETHYST_SHARD, 3) + .withOutput(0.5f, HexItems.AMETHYST_DUST, 4) + .withConditions() + .whenModLoaded("create") + .save(recipes, ResourceLocation("create", "crushing/amethyst_block")) CreateCrushingRecipeBuilder() - .withInput(Items.AMETHYST_SHARD) - .duration(150) - .withOutput(HexItems.AMETHYST_DUST, 4) - .withOutput(0.5f, HexItems.AMETHYST_DUST) - .withConditions() - .whenModLoaded("create") - .save(recipes, modLoc("compat/create/crushing/amethyst_shard")) + .withInput(Items.AMETHYST_SHARD) + .duration(150) + .withOutput(HexItems.AMETHYST_DUST, 4) + .withOutput(0.5f, HexItems.AMETHYST_DUST) + .withConditions() + .whenModLoaded("create") + .save(recipes, modLoc("compat/create/crushing/amethyst_shard")) // FD compat FarmersDelightCuttingRecipeBuilder() - .withInput(HexBlocks.EDIFIED_LOG) - .withTool(ingredients.axeStrip()) - .withOutput(HexBlocks.STRIPPED_EDIFIED_LOG) - .withOutput("farmersdelight:tree_bark") - .withSound(SoundEvents.AXE_STRIP) - .withConditions() - .whenModLoaded("farmersdelight") - .save(recipes, modLoc("compat/farmersdelight/cutting/akashic_log")) + .withInput(HexBlocks.EDIFIED_LOG) + .withTool(ingredients.axeStrip()) + .withOutput(HexBlocks.STRIPPED_EDIFIED_LOG) + .withOutput("farmersdelight:tree_bark") + .withSound(SoundEvents.AXE_STRIP) + .withConditions() + .whenModLoaded("farmersdelight") + .save(recipes, modLoc("compat/farmersdelight/cutting/akashic_log")) FarmersDelightCuttingRecipeBuilder() - .withInput(HexBlocks.EDIFIED_WOOD) - .withTool(ingredients.axeStrip()) - .withOutput(HexBlocks.STRIPPED_EDIFIED_WOOD) - .withOutput("farmersdelight:tree_bark") - .withSound(SoundEvents.AXE_STRIP) - .withConditions() - .whenModLoaded("farmersdelight") - .save(recipes, modLoc("compat/farmersdelight/cutting/akashic_wood")) + .withInput(HexBlocks.EDIFIED_WOOD) + .withTool(ingredients.axeStrip()) + .withOutput(HexBlocks.STRIPPED_EDIFIED_WOOD) + .withOutput("farmersdelight:tree_bark") + .withSound(SoundEvents.AXE_STRIP) + .withConditions() + .whenModLoaded("farmersdelight") + .save(recipes, modLoc("compat/farmersdelight/cutting/akashic_wood")) FarmersDelightCuttingRecipeBuilder() - .withInput(HexBlocks.EDIFIED_TRAPDOOR) - .withTool(ingredients.axeDig()) - .withOutput(HexBlocks.EDIFIED_PLANKS) - .withConditions() - .whenModLoaded("farmersdelight") - .save(recipes, modLoc("compat/farmersdelight/cutting/akashic_trapdoor")) + .withInput(HexBlocks.EDIFIED_TRAPDOOR) + .withTool(ingredients.axeDig()) + .withOutput(HexBlocks.EDIFIED_PLANKS) + .withConditions() + .whenModLoaded("farmersdelight") + .save(recipes, modLoc("compat/farmersdelight/cutting/akashic_trapdoor")) FarmersDelightCuttingRecipeBuilder() - .withInput(HexBlocks.EDIFIED_DOOR) - .withTool(ingredients.axeDig()) - .withOutput(HexBlocks.EDIFIED_PLANKS) - .withConditions() - .whenModLoaded("farmersdelight") - .save(recipes, modLoc("compat/farmersdelight/cutting/akashic_door")) + .withInput(HexBlocks.EDIFIED_DOOR) + .withTool(ingredients.axeDig()) + .withOutput(HexBlocks.EDIFIED_PLANKS) + .withConditions() + .whenModLoaded("farmersdelight") + .save(recipes, modLoc("compat/farmersdelight/cutting/akashic_door")) } private fun wandRecipe(recipes: Consumer, wand: ItemStaff, plank: Item) { ShapedRecipeBuilder.shaped(wand) - .define('W', plank) - .define('S', Items.STICK) - .define('A', HexItems.CHARGED_AMETHYST) - .pattern(" SA") - .pattern(" WS") - .pattern("S ") - .unlockedBy("has_item", hasItem(HexItems.CHARGED_AMETHYST)) - .save(recipes) + .define('W', plank) + .define('S', Items.STICK) + .define('A', HexItems.CHARGED_AMETHYST) + .pattern(" SA") + .pattern(" WS") + .pattern("S ") + .unlockedBy("has_item", hasItem(HexItems.CHARGED_AMETHYST)) + .save(recipes) } private fun gayRecipe(recipes: Consumer, type: ItemPrideColorizer.Type, material: Ingredient) { val colorizer = HexItems.PRIDE_COLORIZERS[type]!! ShapedRecipeBuilder.shaped(colorizer) - .define('D', HexItems.AMETHYST_DUST) - .define('C', material) - .pattern(" D ") - .pattern("DCD") - .pattern(" D ") - .unlockedBy("has_item", hasItem(HexItems.AMETHYST_DUST)) - .save(recipes) + .define('D', HexItems.AMETHYST_DUST) + .define('C', material) + .pattern(" D ") + .pattern("DCD") + .pattern(" D ") + .unlockedBy("has_item", hasItem(HexItems.AMETHYST_DUST)) + .save(recipes) } private fun specialRecipe(consumer: Consumer, serializer: SimpleRecipeSerializer<*>) { diff --git a/Common/src/main/java/at/petrak/hexcasting/datagen/recipe/builders/BrainsweepRecipeBuilder.java b/Common/src/main/java/at/petrak/hexcasting/datagen/recipe/builders/BrainsweepRecipeBuilder.java index 9166c53e..d2b99fed 100644 --- a/Common/src/main/java/at/petrak/hexcasting/datagen/recipe/builders/BrainsweepRecipeBuilder.java +++ b/Common/src/main/java/at/petrak/hexcasting/datagen/recipe/builders/BrainsweepRecipeBuilder.java @@ -21,16 +21,19 @@ import org.jetbrains.annotations.Nullable; import java.util.function.Consumer; public class BrainsweepRecipeBuilder implements RecipeBuilder { - private StateIngredient blockIn; - private BrainsweepIngredient villagerIn; + private final StateIngredient blockIn; + private final BrainsweepIngredient villagerIn; + private final int mediaCost; private final BlockState result; private final Advancement.Builder advancement; - public BrainsweepRecipeBuilder(StateIngredient blockIn, BrainsweepIngredient villagerIn, BlockState result) { + public BrainsweepRecipeBuilder(StateIngredient blockIn, BrainsweepIngredient villagerIn, BlockState result, + int mediaCost) { this.blockIn = blockIn; this.villagerIn = villagerIn; this.result = result; + this.mediaCost = mediaCost; this.advancement = Advancement.Builder.advancement(); } @@ -57,23 +60,24 @@ public class BrainsweepRecipeBuilder implements RecipeBuilder { } this.advancement.parent(new ResourceLocation("recipes/root")) - .addCriterion("has_the_recipe", RecipeUnlockedTrigger.unlocked(pRecipeId)) - .rewards(AdvancementRewards.Builder.recipe(pRecipeId)) - .requirements(RequirementsStrategy.OR); + .addCriterion("has_the_recipe", RecipeUnlockedTrigger.unlocked(pRecipeId)) + .rewards(AdvancementRewards.Builder.recipe(pRecipeId)) + .requirements(RequirementsStrategy.OR); pFinishedRecipeConsumer.accept(new Result( - pRecipeId, - this.blockIn, this.villagerIn, this.result, - this.advancement, - new ResourceLocation(pRecipeId.getNamespace(), "recipes/brainsweep/" + pRecipeId.getPath()))); + pRecipeId, + this.blockIn, this.villagerIn, this.mediaCost, this.result, + this.advancement, + new ResourceLocation(pRecipeId.getNamespace(), "recipes/brainsweep/" + pRecipeId.getPath()))); } public record Result(ResourceLocation id, StateIngredient blockIn, BrainsweepIngredient villagerIn, - BlockState result, Advancement.Builder advancement, + int mediaCost, BlockState result, Advancement.Builder advancement, ResourceLocation advancementId) implements FinishedRecipe { @Override public void serializeRecipeData(JsonObject json) { json.add("blockIn", this.blockIn.serialize()); - json.add("villagerIn", this.villagerIn.serialize()); + json.add("entityIn", this.villagerIn.serialize()); + json.addProperty("cost", this.mediaCost); json.add("result", StateIngredientHelper.serializeBlockState(this.result)); } diff --git a/Common/src/main/java/at/petrak/hexcasting/interop/patchouli/BrainsweepProcessor.java b/Common/src/main/java/at/petrak/hexcasting/interop/patchouli/BrainsweepProcessor.java index 80c4a65d..18ef268c 100644 --- a/Common/src/main/java/at/petrak/hexcasting/interop/patchouli/BrainsweepProcessor.java +++ b/Common/src/main/java/at/petrak/hexcasting/interop/patchouli/BrainsweepProcessor.java @@ -47,11 +47,11 @@ public class BrainsweepProcessor implements IComponentProcessor { } case "entity" -> { - var profession = Objects.requireNonNullElse(this.recipe.villagerIn().profession(), + var profession = Objects.requireNonNullElse(this.recipe.entityIn().profession(), new ResourceLocation("toolsmith")); - var biome = Objects.requireNonNullElse(this.recipe.villagerIn().biome(), + var biome = Objects.requireNonNullElse(this.recipe.entityIn().biome(), new ResourceLocation("plains")); - var level = this.recipe.villagerIn().minLevel(); + var level = this.recipe.entityIn().minLevel(); var iHatePatchouli = String.format( "minecraft:villager{VillagerData:{profession:'%s',type:'%s',level:%d}}", profession, biome, level); @@ -59,7 +59,7 @@ public class BrainsweepProcessor implements IComponentProcessor { } case "entityTooltip" -> { Minecraft mc = Minecraft.getInstance(); - return IVariable.wrapList(this.recipe.villagerIn() + return IVariable.wrapList(this.recipe.entityIn() .getTooltip(mc.options.advancedItemTooltips) .stream() .map(IVariable::from) diff --git a/Common/src/main/java/at/petrak/hexcasting/mixin/MixinMob.java b/Common/src/main/java/at/petrak/hexcasting/mixin/MixinMob.java index 9fa7af63..9404606e 100644 --- a/Common/src/main/java/at/petrak/hexcasting/mixin/MixinMob.java +++ b/Common/src/main/java/at/petrak/hexcasting/mixin/MixinMob.java @@ -1,6 +1,6 @@ package at.petrak.hexcasting.mixin; -import at.petrak.hexcasting.common.misc.Brainsweeping; +import at.petrak.hexcasting.xplat.IXplatAbstractions; import net.minecraft.world.entity.Mob; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.injection.At; @@ -13,7 +13,7 @@ public class MixinMob { @Inject(method = "serverAiStep", at = @At("HEAD"), cancellable = true) private void onRegisterBrainGoals(CallbackInfo ci) { var self = (Mob) (Object) this; - if (Brainsweeping.isBrainswept(self)) { + if (IXplatAbstractions.INSTANCE.isBrainswept(self)) { ci.cancel(); } } @@ -21,7 +21,7 @@ public class MixinMob { @Inject(method = "playAmbientSound", at = @At("HEAD"), cancellable = true) protected void onPlayAmbientSound(CallbackInfo ci) { var self = (Mob) (Object) this; - if (Brainsweeping.isBrainswept(self)) { + if (IXplatAbstractions.INSTANCE.isBrainswept(self)) { ci.cancel(); } } diff --git a/Common/src/main/resources/assets/hexcasting/lang/en_us.json b/Common/src/main/resources/assets/hexcasting/lang/en_us.json index 57b6ceff..8e825c94 100644 --- a/Common/src/main/resources/assets/hexcasting/lang/en_us.json +++ b/Common/src/main/resources/assets/hexcasting/lang/en_us.json @@ -253,7 +253,7 @@ "command.hexcasting.pats.specific.success": "Gave %s with id %s to %s", "command.hexcasting.recalc": "Recalculated patterns", "command.hexcasting.brainsweep": "Brainswept %s", - "command.hexcasting.brainsweep.fail.badtype": "%s is not a villager", + "command.hexcasting.brainsweep.fail.badtype": "%s is not a mob", "command.hexcasting.brainsweep.fail.already": "%s is already empty", "hexcasting.pattern.unknown": "Unknown pattern resource location %s", "hexcasting.debug.media_withdrawn": "%s - Media withdrawn: %s", @@ -561,8 +561,8 @@ "hexcasting.mishap.bad_block": "Expected %s at %s, but got %s", "hexcasting.mishap.bad_block.sapling": "a sapling", "hexcasting.mishap.bad_block.replaceable": "somewhere to place a block", - "hexcasting.mishap.bad_brainsweep": "The %s rejected the villager's mind", - "hexcasting.mishap.already_brainswept": "The villager has already been used", + "hexcasting.mishap.bad_brainsweep": "The %s rejected the being's mind", + "hexcasting.mishap.already_brainswept": "The mind has already been used", "hexcasting.mishap.no_spell_circle": "%s requires a spell circle", "hexcasting.mishap.others_name": "Tried to invade the privacy of %s's soul", "hexcasting.mishap.others_name.self": "Tried to divulge my Name too recklessly", @@ -714,7 +714,7 @@ "hexcasting.entry.mishaps2": "Enlightened Mishaps", "hexcasting.page.mishaps2.1": "I have discovered new and horrifying modes of failure. I must not succumb to them.", "hexcasting.page.mishaps2.bad_mindflay.title": "Inert Mindflay", - "hexcasting.page.mishaps2.bad_mindflay": "Attempted to flay the mind of a villager that I have either already used, or of a character not suitable for the target block.$(br2)Causes dark green sparks, and kills the subject. If another villager sees that, I doubt they would look on it favorably.", + "hexcasting.page.mishaps2.bad_mindflay": "Attempted to flay the mind of something that I have either already used, or of a character not suitable for the target block.$(br2)Causes dark green sparks, and kills the subject. If a villager sees that, I doubt they would look on it favorably.", "hexcasting.page.mishaps2.no_circle.title": "Lack Spell Circle", "hexcasting.page.mishaps2.no_circle": "Tried to cast an action requiring a spell circle without a spell circle.$(br2)Causes light blue sparks, and upends my inventory onto the ground.", "hexcasting.page.mishaps2.no_record.title": "Lack Akashic Record", diff --git a/Fabric/src/main/java/at/petrak/hexcasting/fabric/FabricHexInitializer.kt b/Fabric/src/main/java/at/petrak/hexcasting/fabric/FabricHexInitializer.kt index f694a5e2..f3c5e2e7 100644 --- a/Fabric/src/main/java/at/petrak/hexcasting/fabric/FabricHexInitializer.kt +++ b/Fabric/src/main/java/at/petrak/hexcasting/fabric/FabricHexInitializer.kt @@ -63,8 +63,8 @@ object FabricHexInitializer : ModInitializer { } fun initListeners() { - UseEntityCallback.EVENT.register(Brainsweeping::tradeWithVillager) - VillagerConversionCallback.EVENT.register(Brainsweeping::copyBrainsweepFromVillager) + UseEntityCallback.EVENT.register(Brainsweeping::interactWithBrainswept) + VillagerConversionCallback.EVENT.register(Brainsweeping::copyBrainsweepPostTransformation) AttackBlockCallback.EVENT.register { player, world, _, pos, _ -> // SUCCESS cancels further processing and, on the client, sends a packet to the server. // PASS falls back to further processing. diff --git a/Fabric/src/main/java/at/petrak/hexcasting/fabric/interop/emi/HexEMIPlugin.java b/Fabric/src/main/java/at/petrak/hexcasting/fabric/interop/emi/HexEMIPlugin.java index d5a1c489..3054676d 100644 --- a/Fabric/src/main/java/at/petrak/hexcasting/fabric/interop/emi/HexEMIPlugin.java +++ b/Fabric/src/main/java/at/petrak/hexcasting/fabric/interop/emi/HexEMIPlugin.java @@ -39,24 +39,24 @@ public class HexEMIPlugin implements EmiPlugin { private static final ResourceLocation SIMPLIFIED_ICON_PROFESSION = modLoc("textures/gui/villager_profession.png"); public static final EmiRecipeCategory BRAINSWEEP = new EmiRecipeCategory(BRAINSWEEP_ID, - new PatternRendererEMI(BRAINSWEEP_ID, 16, 16), - new EmiTexture(SIMPLIFIED_ICON_BRAINSWEEP, 0, 0, 16, 16, 16, 16, 16, 16)); + new PatternRendererEMI(BRAINSWEEP_ID, 16, 16), + new EmiTexture(SIMPLIFIED_ICON_BRAINSWEEP, 0, 0, 16, 16, 16, 16, 16, 16)); public static final EmiRecipeCategory PHIAL = new EmiRecipeCategory(PHIAL_ID, - new PatternRendererEMI(PHIAL_ID, 12, 12).shift(2, 2), - new EmiTexture(SIMPLIFIED_ICON_PHIAL, 0, 0, 16, 16, 16, 16, 16, 16)); + new PatternRendererEMI(PHIAL_ID, 12, 12).shift(2, 2), + new EmiTexture(SIMPLIFIED_ICON_PHIAL, 0, 0, 16, 16, 16, 16, 16, 16)); public static final EmiRecipeCategory EDIFY = new EmiRecipeCategory(EDIFY_ID, - new PatternRendererEMI(EDIFY_ID, 16, 16).strokeOrder(false), - new EmiTexture(SIMPLIFIED_ICON_EDIFY, 0, 0, 16, 16, 16, 16, 16, 16)); + new PatternRendererEMI(EDIFY_ID, 16, 16).strokeOrder(false), + new EmiTexture(SIMPLIFIED_ICON_EDIFY, 0, 0, 16, 16, 16, 16, 16, 16)); public static final EmiRecipeCategory VILLAGER_LEVELING = new EmiRecipeCategory(VILLAGER_LEVELING_ID, - EmiStack.of(Items.EMERALD), - new EmiTexture(SIMPLIFIED_ICON_LEVELING, 0, 0, 16, 16, 16, 16, 16, 16)); + EmiStack.of(Items.EMERALD), + new EmiTexture(SIMPLIFIED_ICON_LEVELING, 0, 0, 16, 16, 16, 16, 16, 16)); public static final EmiRecipeCategory VILLAGER_PROFESSION = new EmiRecipeCategory(VILLAGER_PROFESSION_ID, - EmiStack.of(Blocks.LECTERN), - new EmiTexture(SIMPLIFIED_ICON_PROFESSION, 0, 0, 16, 16, 16, 16, 16, 16)); + EmiStack.of(Blocks.LECTERN), + new EmiTexture(SIMPLIFIED_ICON_PROFESSION, 0, 0, 16, 16, 16, 16, 16, 16)); @Override public void register(EmiRegistry registry) { @@ -70,10 +70,10 @@ public class HexEMIPlugin implements EmiPlugin { registry.addWorkstation(EDIFY, EmiIngredient.of(HexItemTags.STAVES)); for (BrainsweepRecipe recipe : registry.getRecipeManager() - .getAllRecipesFor(HexRecipeStuffRegistry.BRAINSWEEP_TYPE)) { + .getAllRecipesFor(HexRecipeStuffRegistry.BRAINSWEEP_TYPE)) { var inputs = EmiIngredient.of(recipe.blockIn().getDisplayedStacks().stream() - .map(EmiStack::of).toList()); - var villagerInput = VillagerEmiStack.atLevelOrHigher(recipe.villagerIn(), true); + .map(EmiStack::of).toList()); + var villagerInput = VillagerEmiStack.atLevelOrHigher(recipe.entityIn(), true); var output = EmiStack.of(recipe.result().getBlock()); registry.addRecipe(new EmiBrainsweepRecipe(inputs, villagerInput, output, recipe.getId())); } @@ -94,28 +94,28 @@ public class HexEMIPlugin implements EmiPlugin { Set states = VillagerEmiStack.matchingStatesForProfession(profession); if (!states.isEmpty()) { List workstations = states.stream() - .map(BlockState::getBlock) - .map(Block::asItem) - .distinct() - .filter((it) -> it != Items.AIR) - .toList(); + .map(BlockState::getBlock) + .map(Block::asItem) + .distinct() + .filter((it) -> it != Items.AIR) + .toList(); if (!workstations.isEmpty()) { registry.addWorkstation(VILLAGER_LEVELING, - EmiIngredient.of(workstations.stream().map(EmiStack::of).toList())); + EmiIngredient.of(workstations.stream().map(EmiStack::of).toList())); registry.addWorkstation(VILLAGER_PROFESSION, - EmiIngredient.of(workstations.stream().map(EmiStack::of).toList())); + EmiIngredient.of(workstations.stream().map(EmiStack::of).toList())); registry.addRecipe(new EmiProfessionRecipe(new VillagerEmiStack(basicVillager), - EmiIngredient.of(workstations.stream().map(EmiStack::of).toList()), - new VillagerEmiStack(manWithJob), poiRecipeId)); + EmiIngredient.of(workstations.stream().map(EmiStack::of).toList()), + new VillagerEmiStack(manWithJob), poiRecipeId)); for (int lvl = 1; lvl < 5; lvl++) { ResourceLocation levelRecipeId = modLoc( - "villager/levelup/" + lvl + "/" + id.getNamespace() + "/" + id.getPath()); + "villager/levelup/" + lvl + "/" + id.getNamespace() + "/" + id.getPath()); var manWithBadJob = new BrainsweepIngredient(id, null, lvl); var manWithBetterJob = new BrainsweepIngredient(id, null, lvl + 1); registry.addRecipe(new EmiLevelupRecipe(new VillagerEmiStack(manWithBadJob), - new VillagerEmiStack(manWithBetterJob), levelRecipeId)); + new VillagerEmiStack(manWithBetterJob), levelRecipeId)); } } } diff --git a/Forge/src/main/java/at/petrak/hexcasting/forge/ForgeHexInitializer.java b/Forge/src/main/java/at/petrak/hexcasting/forge/ForgeHexInitializer.java index 8479a00a..06b4706d 100644 --- a/Forge/src/main/java/at/petrak/hexcasting/forge/ForgeHexInitializer.java +++ b/Forge/src/main/java/at/petrak/hexcasting/forge/ForgeHexInitializer.java @@ -112,7 +112,7 @@ public class ForgeHexInitializer { // https://github.com/VazkiiMods/Botania/blob/1.18.x/Forge/src/main/java/vazkii/botania/forge/ForgeCommonInitializer.java private static void bind(ResourceKey> registry, - Consumer> source) { + Consumer> source) { getModEventBus().addListener((RegisterEvent event) -> { if (registry.equals(event.getRegistryKey())) { source.accept((t, rl) -> event.register(registry, rl, () -> t)); @@ -159,7 +159,7 @@ public class ForgeHexInitializer { HexAPI.LOGGER.info(PatternRegistry.getPatternCountInfo())); evBus.addListener((PlayerInteractEvent.EntityInteract evt) -> { - var res = Brainsweeping.tradeWithVillager( + var res = Brainsweeping.interactWithBrainswept( evt.getEntity(), evt.getLevel(), evt.getHand(), evt.getTarget(), null); if (res.consumesAction()) { evt.setCanceled(true); @@ -167,7 +167,7 @@ public class ForgeHexInitializer { } }); evBus.addListener((LivingConversionEvent.Post evt) -> - Brainsweeping.copyBrainsweepFromVillager(evt.getEntity(), evt.getOutcome())); + Brainsweeping.copyBrainsweepPostTransformation(evt.getEntity(), evt.getOutcome())); evBus.addListener((LivingEvent.LivingTickEvent evt) -> { OpFlight.INSTANCE.tickDownFlight(evt.getEntity()); diff --git a/Forge/src/main/java/at/petrak/hexcasting/forge/interop/jei/BrainsweepRecipeCategory.java b/Forge/src/main/java/at/petrak/hexcasting/forge/interop/jei/BrainsweepRecipeCategory.java index b0985bb0..3d42d3ac 100644 --- a/Forge/src/main/java/at/petrak/hexcasting/forge/interop/jei/BrainsweepRecipeCategory.java +++ b/Forge/src/main/java/at/petrak/hexcasting/forge/interop/jei/BrainsweepRecipeCategory.java @@ -70,7 +70,7 @@ public class BrainsweepRecipeCategory implements IRecipeCategory Date: Wed, 23 Nov 2022 09:32:07 +0800 Subject: [PATCH 09/95] fix --- Common/src/main/resources/assets/hexcasting/lang/zh_cn.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Common/src/main/resources/assets/hexcasting/lang/zh_cn.json b/Common/src/main/resources/assets/hexcasting/lang/zh_cn.json index 1be26881..72b24205 100644 --- a/Common/src/main/resources/assets/hexcasting/lang/zh_cn.json +++ b/Common/src/main/resources/assets/hexcasting/lang/zh_cn.json @@ -577,8 +577,8 @@ "hexcasting.mishap.divide_by_zero.sin": "%s的正弦", "hexcasting.mishap.divide_by_zero.cos": "%s的余弦", "hexcasting.mishap.no_akashic_record": "%s处无阿卡夏记录", - "hexcasting.mishap.disallowed": "%s已被服务器管理员禁止施法", - "hexcasting.mishap.disallowed_circle": "%s已被服务器管理员禁止使用法术环", + "hexcasting.mishap.disallowed": "%s已被服务器管理员禁用于施法", + "hexcasting.mishap.disallowed_circle": "%s已被服务器管理员禁用于法术环", "hexcasting.mishap.invalid_spell_datum_type": "尝试将某无效类型的值用作SpellDatum:%s(class %s)。这是模组中的bug。", "hexcasting.mishap.unknown": "%s抛出异常(%s)。这是模组中的bug。", "hexcasting.mishap.shame": "你真是可耻!", From 4a26dbf706df455e89394b1e916ae0b694b8ada4 Mon Sep 17 00:00:00 2001 From: ChuijkYahus <94828194+ChuijkYahus@users.noreply.github.com> Date: Wed, 23 Nov 2022 18:09:47 +0800 Subject: [PATCH 10/95] fix --- Common/src/main/resources/assets/hexcasting/lang/zh_cn.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Common/src/main/resources/assets/hexcasting/lang/zh_cn.json b/Common/src/main/resources/assets/hexcasting/lang/zh_cn.json index 72b24205..5276baf3 100644 --- a/Common/src/main/resources/assets/hexcasting/lang/zh_cn.json +++ b/Common/src/main/resources/assets/hexcasting/lang/zh_cn.json @@ -1039,7 +1039,7 @@ "hexcasting.entry.meta": "元运行", "hexcasting.page.meta.eval.1": "移除栈顶的图案列表,然后就像我用$(l:items/staff)$(item)法杖/$施法一样依次运行(直到碰到$(l:patterns/meta#hexcasting:halt)$(action)卡戎之策略/$)。如果一个 iota 已用$(l:patterns/patterns_as_iotas#hexcasting:escape)$(action)考察/$或$(l:patterns/patterns_as_iotas#hexcasting:open_paren)$(action)类似手段/$作为图案加入栈中,那么该 iota 将在运行时被加到栈中。否则其将在非图案元素运行失败。", - "hexcasting.page.meta.eval.2": "若与$(l:items/focus)$(item)核心/$同时使用,它将提供$(italic)极为/$强大的操控能力。$(br2)距我找到的一张奇特卷轴所称,它还将自然的咒法体系变为了一个“图灵完备”的系统。$(br2)然而,$(hex)咒术/$能重复执行自身的次数是有限的——自然不会对失控的法术手软的!$(br2)此外,若让图案不在我的引导下操控能量,那么任何事故都可能导致后续操作不稳定甚至直接执行不了。", + "hexcasting.page.meta.eval.2": "若与$(l:items/focus)$(item)核心/$同时使用,它将提供$(italic)极为/$强大的操控能力。$(br2)据我找到的一张奇特卷轴所称,它还将自然的咒法体系变为了一个“图灵完备”的系统。$(br2)然而,$(hex)咒术/$能重复执行自身的次数是有限的——自然不会对失控的法术手软的!$(br2)此外,若让图案不在我的引导下操控能量,那么任何事故都可能导致后续操作不稳定甚至直接执行不了。", "hexcasting.page.meta.for_each.1": "移除栈中的一个图案列表和一个列表,然后对后一列表中的每个元素运行前一图案列表中的图案。", "hexcasting.page.meta.for_each.2": "更确切地说,对应后一列表中的每个元素,它将:$(li)创建一个新栈,其中包括当前栈中的所有元素和后一列表中的一个元素。$(li)绘制前一列表中的所有图案。$(li)将该栈中剩余的所有元素存进一个列表。$(br)在所有元素都运行一遍后,将该列表压入原本的栈中。$(br2)也难怪精通此操作的人都疯了。", "hexcasting.page.meta.halt.1": "这个图案将强制停止$(hex)咒术/$的施放。它独自出现可能没什么用,我只要不绘制图案或是放下法杖就行了。", @@ -1087,7 +1087,7 @@ "hexcasting.entry.nadirs": "天底法术", "hexcasting.page.nadirs.1": "此类法术会给予某一实体一个负面药水效果。它们都接受一个实体作为效果受体,和一两个数。其中第一个数是持续时间,第二个数(若有)是效果强度(以 1 起始)。$(br2)每种法术都有一个“基础消耗”,实际消耗为基础消耗乘以效果强度的平方。", - "hexcasting.page.nadirs.2": "距某些传说所言,这些法术和它们的姊妹法术——$(l:patterns/great_spells/zeniths)$(action)天顶法术/$,都是“……由另一个世界的魔法启发的。在那个世界里,强大的魔法师会从四处收集魔法并决斗至死。不幸的是,许多信息都没翻译过来……”$(br2)也许这就是它们名字怪异的原因。", + "hexcasting.page.nadirs.2": "据某些传说所言,这些法术和它们的姊妹法术——$(l:patterns/great_spells/zeniths)$(action)天顶法术/$,都是“……由另一个世界的魔法启发的。在那个世界里,强大的魔法师会从四处收集魔法并决斗至死。不幸的是,许多信息都没翻译过来……”$(br2)也许这就是它们名字怪异的原因。", "hexcasting.page.nadirs.potion/weakness": "给予$(thing)虚弱/$。每 10 秒持续时间的基础消耗为 1 个$(l:items/amethyst)$(item)紫水晶粉/$。", "hexcasting.page.nadirs.potion/levitation": "给予$(thing)飘浮/$。每 5 秒持续时间的基础消耗为 1 个$(l:items/amethyst)$(item)紫水晶粉/$。", "hexcasting.page.nadirs.potion/wither": "给予$(thing)凋零/$。每 1 秒持续时间的基础消耗为 1 个$(l:items/amethyst)$(item)紫水晶粉/$。", From 71891078f85ce23455d3def0530067c5eba35907 Mon Sep 17 00:00:00 2001 From: ChuijkYahus <94828194+ChuijkYahus@users.noreply.github.com> Date: Thu, 24 Nov 2022 01:32:24 +0800 Subject: [PATCH 11/95] fix --- Common/src/main/resources/assets/hexcasting/lang/zh_cn.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Common/src/main/resources/assets/hexcasting/lang/zh_cn.json b/Common/src/main/resources/assets/hexcasting/lang/zh_cn.json index 5276baf3..42101422 100644 --- a/Common/src/main/resources/assets/hexcasting/lang/zh_cn.json +++ b/Common/src/main/resources/assets/hexcasting/lang/zh_cn.json @@ -505,7 +505,7 @@ "hexcasting.spell.hexcasting:interop/pehkui/set": "改变缩放", "hexcasting.mishap.invalid_pattern": "该图案不对应任何操作", - "hexcasting.mishap.unescaped": "本应运行一个图案,实际却运行了%s", + "hexcasting.mishap.unescaped": "本应运行一个图案,而实际运行了%s", "hexcasting.mishap.invalid_value": "%1$s本应在栈下标为%3$s处接受%2$s,而实际接受了%4$s", "hexcasting.mishap.invalid_value.class.double": "一个数", "hexcasting.mishap.invalid_value.class.boolean": "一个布尔值", @@ -560,7 +560,7 @@ "hexcasting.mishap.bad_item.colorizer": "一个染色剂", "hexcasting.mishap.bad_block": "本应在%2$s处接受%1$s,而实际接受了%3$s", "hexcasting.mishap.bad_block.sapling": "一个树苗", - "hexcasting.mishap.bad_block.replaceable": "一个放置方块的地方", + "hexcasting.mishap.bad_block.replaceable": "一个可放置方块的地方", "hexcasting.mishap.bad_brainsweep": "%s排斥此村民的意识", "hexcasting.mishap.already_brainswept": "此村民已被使用", "hexcasting.mishap.no_spell_circle": "%s需在法术环上执行", From 71904e282c383f7f609ca5f0e92aeda8e46c1d0f Mon Sep 17 00:00:00 2001 From: ChuijkYahus <94828194+ChuijkYahus@users.noreply.github.com> Date: Thu, 24 Nov 2022 09:35:01 +0800 Subject: [PATCH 12/95] fix --- Common/src/main/resources/assets/hexcasting/lang/zh_cn.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Common/src/main/resources/assets/hexcasting/lang/zh_cn.json b/Common/src/main/resources/assets/hexcasting/lang/zh_cn.json index 42101422..b7d92fd0 100644 --- a/Common/src/main/resources/assets/hexcasting/lang/zh_cn.json +++ b/Common/src/main/resources/assets/hexcasting/lang/zh_cn.json @@ -1043,7 +1043,7 @@ "hexcasting.page.meta.for_each.1": "移除栈中的一个图案列表和一个列表,然后对后一列表中的每个元素运行前一图案列表中的图案。", "hexcasting.page.meta.for_each.2": "更确切地说,对应后一列表中的每个元素,它将:$(li)创建一个新栈,其中包括当前栈中的所有元素和后一列表中的一个元素。$(li)绘制前一列表中的所有图案。$(li)将该栈中剩余的所有元素存进一个列表。$(br)在所有元素都运行一遍后,将该列表压入原本的栈中。$(br2)也难怪精通此操作的人都疯了。", "hexcasting.page.meta.halt.1": "这个图案将强制停止$(hex)咒术/$的施放。它独自出现可能没什么用,我只要不绘制图案或是放下法杖就行了。", - "hexcasting.page.meta.halt.2": "但当与$(l:patterns/meta#hexcasting:eval)$(action)赫尔墨斯之策略/$或$(l:patterns/meta#hexcasting:for_each)$(action)托特之策略/$一起使用时,它就将发挥$(italic)大/$用。那些图案会碰到这个休止符,但$(hex)咒术/$本身不会停止,停止运行的是那些策略。它可以用来防止$(l:patterns/meta#hexcasting:for_each)$(action)托特之策略/$将每个 iota 都运行一遍。这便是逃离疯狂的密道。", + "hexcasting.page.meta.halt.2": "但当与$(l:patterns/meta#hexcasting:eval)$(action)赫尔墨斯之策略/$或$(l:patterns/meta#hexcasting:for_each)$(action)托特之策略/$一起使用时,它就将发挥$(italic)大/$用。那些图案会碰到这个休止符,但$(hex)咒术/$本身不会停止,停止运行的是那些策略。它可以用来防止$(l:patterns/meta#hexcasting:for_each)$(action)托特之策略/$将每个 iota 都运行一遍。这便是逃离疯狂的秘道。", "hexcasting.entry.circle_patterns": "法术环图案", "hexcasting.page.circle_patterns.disclaimer": "这些图案只能在$(l:greatwork/spellcircles)$(item)法术环/$上运行。尝试用$(l:items/staff)$(item)法杖/$绘制它们会招致可怖的事故。", From 33ba0ee4e121ef0973411de41a9e0cf623eb93fe Mon Sep 17 00:00:00 2001 From: "petrak@" Date: Tue, 29 Nov 2022 12:07:08 -0500 Subject: [PATCH 13/95] rrgh --- .../at/petrak/hexcasting/client/RenderLib.kt | 7 +- .../common/command/BrainsweepCommand.java | 16 +-- .../brainsweep/BrainsweepIngredient.java | 3 + .../VillagerBrainsweepIngredient.java | 24 ++++- .../patchouli/BrainsweepProcessor.java | 27 +++-- .../mixin/MixinAbstractVillager.java | 4 +- .../hexcasting/mixin/MixinLivingEntity.java | 24 +++++ .../petrak/hexcasting/mixin/MixinRaider.java | 7 +- .../hexcasting/mixin/MixinVillager.java | 14 +-- .../petrak/hexcasting/mixin/MixinWitch.java | 7 +- ...miStack.java => BrainsweepeeEmiStack.java} | 42 ++++---- .../fabric/interop/emi/EmiLevelupRecipe.java | 2 +- .../interop/emi/EmiProfessionRecipe.java | 3 +- .../fabric/interop/emi/EmiVillagerRecipe.java | 6 +- .../fabric/interop/emi/HexEMIPlugin.java | 101 ++++++++---------- .../9fb1092f32d4fcbf9e061ffd718d4ec689c6c95e | 14 +-- .../recipes/brainsweep/akashic_record.json | 9 +- .../recipes/brainsweep/budding_amethyst.json | 7 +- .../brainsweep/directrix_redstone.json | 9 +- .../recipes/brainsweep/impetus_look.json | 9 +- .../brainsweep/impetus_rightclick.json | 9 +- .../brainsweep/impetus_storedplayer.json | 9 +- .../forge/network/MsgBrainsweepAck.java | 4 +- 23 files changed, 200 insertions(+), 157 deletions(-) create mode 100644 Common/src/main/java/at/petrak/hexcasting/mixin/MixinLivingEntity.java rename Fabric/src/main/java/at/petrak/hexcasting/fabric/interop/emi/{VillagerEmiStack.java => BrainsweepeeEmiStack.java} (82%) diff --git a/Common/src/main/java/at/petrak/hexcasting/client/RenderLib.kt b/Common/src/main/java/at/petrak/hexcasting/client/RenderLib.kt index 305e2979..29d914d9 100644 --- a/Common/src/main/java/at/petrak/hexcasting/client/RenderLib.kt +++ b/Common/src/main/java/at/petrak/hexcasting/client/RenderLib.kt @@ -20,14 +20,10 @@ import net.minecraft.client.Minecraft import net.minecraft.client.gui.screens.Screen import net.minecraft.client.renderer.MultiBufferSource import net.minecraft.core.BlockPos -import net.minecraft.core.Registry import net.minecraft.util.FastColor import net.minecraft.util.Mth import net.minecraft.world.entity.Entity -import net.minecraft.world.entity.EntityType import net.minecraft.world.entity.npc.Villager -import net.minecraft.world.entity.npc.VillagerProfession -import net.minecraft.world.entity.npc.VillagerType import net.minecraft.world.item.ItemStack import net.minecraft.world.level.Level import net.minecraft.world.level.levelgen.SingleThreadedRandomSource @@ -427,6 +423,8 @@ fun transferMsToGl(ms: PoseStack, toRun: Runnable) { private var villager: Villager? by weakMapped(Villager::level) fun prepareVillagerForRendering(ingredient: BrainsweepIngredient, level: Level): Villager { + throw NotImplementedError() + /* val minLevel: Int = ingredient.minLevel() val profession: VillagerProfession = Registry.VILLAGER_PROFESSION.getOptional(ingredient.profession()) .orElse(VillagerProfession.NONE) @@ -445,6 +443,7 @@ fun prepareVillagerForRendering(ingredient: BrainsweepIngredient, level: Level): .setLevel(minLevel) return instantiatedVillager + */ } @JvmOverloads diff --git a/Common/src/main/java/at/petrak/hexcasting/common/command/BrainsweepCommand.java b/Common/src/main/java/at/petrak/hexcasting/common/command/BrainsweepCommand.java index 6e00437d..5b0c5d5d 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/command/BrainsweepCommand.java +++ b/Common/src/main/java/at/petrak/hexcasting/common/command/BrainsweepCommand.java @@ -1,29 +1,29 @@ package at.petrak.hexcasting.common.command; -import at.petrak.hexcasting.common.misc.Brainsweeping; +import at.petrak.hexcasting.xplat.IXplatAbstractions; import com.mojang.brigadier.builder.LiteralArgumentBuilder; import net.minecraft.commands.CommandSourceStack; import net.minecraft.commands.Commands; import net.minecraft.commands.arguments.EntityArgument; import net.minecraft.network.chat.Component; -import net.minecraft.world.entity.npc.Villager; +import net.minecraft.world.entity.Mob; public class BrainsweepCommand { public static void add(LiteralArgumentBuilder cmd) { cmd.then(Commands.literal("brainsweep") .requires(dp -> dp.hasPermission(Commands.LEVEL_ADMINS)) .then(Commands.argument("villager", EntityArgument.entity()).executes(ctx -> { - var target = EntityArgument.getEntity(ctx, "villager"); - if (target instanceof Villager v) { - if (Brainsweeping.isBrainswept(v)) { + var target = EntityArgument.getEntity(ctx, "target"); + if (target instanceof Mob mob) { + if (IXplatAbstractions.INSTANCE.isBrainswept(mob)) { ctx.getSource().sendFailure( Component.translatable("command.hexcasting.brainsweep.fail.already", - v.getDisplayName())); + mob.getDisplayName())); return 0; } - Brainsweeping.brainsweep(v); + IXplatAbstractions.INSTANCE.brainsweep(mob); ctx.getSource().sendSuccess( - Component.translatable("command.hexcasting.brainsweep", v.getDisplayName()), true); + Component.translatable("command.hexcasting.brainsweep", mob.getDisplayName()), true); return 1; } else { ctx.getSource().sendFailure( diff --git a/Common/src/main/java/at/petrak/hexcasting/common/recipe/ingredient/brainsweep/BrainsweepIngredient.java b/Common/src/main/java/at/petrak/hexcasting/common/recipe/ingredient/brainsweep/BrainsweepIngredient.java index f110ce88..096e132b 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/recipe/ingredient/brainsweep/BrainsweepIngredient.java +++ b/Common/src/main/java/at/petrak/hexcasting/common/recipe/ingredient/brainsweep/BrainsweepIngredient.java @@ -1,6 +1,7 @@ package at.petrak.hexcasting.common.recipe.ingredient.brainsweep; import com.google.gson.JsonObject; +import net.minecraft.client.multiplayer.ClientLevel; import net.minecraft.network.FriendlyByteBuf; import net.minecraft.network.chat.Component; import net.minecraft.server.level.ServerLevel; @@ -19,6 +20,8 @@ public abstract class BrainsweepIngredient { public abstract void write(FriendlyByteBuf buf); + public abstract Entity exampleEntity(ClientLevel level); + public static BrainsweepIngredient read(FriendlyByteBuf buf) { var type = buf.readVarInt(); return switch (Type.values()[type]) { diff --git a/Common/src/main/java/at/petrak/hexcasting/common/recipe/ingredient/brainsweep/VillagerBrainsweepIngredient.java b/Common/src/main/java/at/petrak/hexcasting/common/recipe/ingredient/brainsweep/VillagerBrainsweepIngredient.java index 12fa8048..8c5d734a 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/recipe/ingredient/brainsweep/VillagerBrainsweepIngredient.java +++ b/Common/src/main/java/at/petrak/hexcasting/common/recipe/ingredient/brainsweep/VillagerBrainsweepIngredient.java @@ -3,6 +3,7 @@ package at.petrak.hexcasting.common.recipe.ingredient.brainsweep; import at.petrak.hexcasting.xplat.IXplatAbstractions; import com.google.gson.JsonObject; import net.minecraft.ChatFormatting; +import net.minecraft.client.multiplayer.ClientLevel; import net.minecraft.core.Registry; import net.minecraft.network.FriendlyByteBuf; import net.minecraft.network.chat.Component; @@ -13,6 +14,8 @@ import net.minecraft.util.GsonHelper; import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.EntityType; import net.minecraft.world.entity.npc.Villager; +import net.minecraft.world.entity.npc.VillagerProfession; +import net.minecraft.world.entity.npc.VillagerType; import org.jetbrains.annotations.Nullable; import java.util.ArrayList; @@ -23,9 +26,9 @@ import java.util.Objects; * Special case for villagers so we can have biome/profession/level reqs */ public class VillagerBrainsweepIngredient extends BrainsweepIngredient { - private final @Nullable ResourceLocation profession; - private final @Nullable ResourceLocation biome; - private final int minLevel; + public final @Nullable ResourceLocation profession; + public final @Nullable ResourceLocation biome; + public final int minLevel; public VillagerBrainsweepIngredient( @Nullable ResourceLocation profession, @@ -49,6 +52,21 @@ public class VillagerBrainsweepIngredient extends BrainsweepIngredient { && this.minLevel <= data.getLevel(); } + @Override + public Entity exampleEntity(ClientLevel level) { + var type = this.biome == null + ? VillagerType.PLAINS + : Registry.VILLAGER_TYPE.get(this.biome); + var out = new Villager(EntityType.VILLAGER, level, type); + + var profession = this.profession == null + ? VillagerProfession.TOOLSMITH + : Registry.VILLAGER_PROFESSION.get(this.profession); + out.getVillagerData().setProfession(profession); + out.getVillagerData().setLevel(Math.max(this.minLevel, 1)); + return out; + } + @Override public List getTooltip(boolean advanced) { List tooltip = new ArrayList<>(); diff --git a/Common/src/main/java/at/petrak/hexcasting/interop/patchouli/BrainsweepProcessor.java b/Common/src/main/java/at/petrak/hexcasting/interop/patchouli/BrainsweepProcessor.java index 18ef268c..0ac3b51f 100644 --- a/Common/src/main/java/at/petrak/hexcasting/interop/patchouli/BrainsweepProcessor.java +++ b/Common/src/main/java/at/petrak/hexcasting/interop/patchouli/BrainsweepProcessor.java @@ -2,6 +2,8 @@ package at.petrak.hexcasting.interop.patchouli; import at.petrak.hexcasting.common.recipe.BrainsweepRecipe; import at.petrak.hexcasting.common.recipe.HexRecipeStuffRegistry; +import at.petrak.hexcasting.common.recipe.ingredient.brainsweep.EntityBrainsweepIngredient; +import at.petrak.hexcasting.common.recipe.ingredient.brainsweep.VillagerBrainsweepIngredient; import net.minecraft.client.Minecraft; import net.minecraft.resources.ResourceLocation; import net.minecraft.world.item.ItemStack; @@ -47,15 +49,22 @@ public class BrainsweepProcessor implements IComponentProcessor { } case "entity" -> { - var profession = Objects.requireNonNullElse(this.recipe.entityIn().profession(), - new ResourceLocation("toolsmith")); - var biome = Objects.requireNonNullElse(this.recipe.entityIn().biome(), - new ResourceLocation("plains")); - var level = this.recipe.entityIn().minLevel(); - var iHatePatchouli = String.format( - "minecraft:villager{VillagerData:{profession:'%s',type:'%s',level:%d}}", - profession, biome, level); - return IVariable.wrap(iHatePatchouli); + if (this.recipe.entityIn() instanceof VillagerBrainsweepIngredient villager) { + var profession = Objects.requireNonNullElse(villager.profession, + new ResourceLocation("toolsmith")); + var biome = Objects.requireNonNullElse(villager.biome, + new ResourceLocation("plains")); + var level = villager.minLevel; + var iHatePatchouli = String.format( + "minecraft:villager{VillagerData:{profession:'%s',type:'%s',level:%d}}", + profession, biome, level); + return IVariable.wrap(iHatePatchouli); + } else if (this.recipe.entityIn() instanceof EntityBrainsweepIngredient entity) { + // TODO + return IVariable.wrap("minecraft:chicken"); + } else { + throw new IllegalStateException(); + } } case "entityTooltip" -> { Minecraft mc = Minecraft.getInstance(); diff --git a/Common/src/main/java/at/petrak/hexcasting/mixin/MixinAbstractVillager.java b/Common/src/main/java/at/petrak/hexcasting/mixin/MixinAbstractVillager.java index b9cef5af..344e60ef 100644 --- a/Common/src/main/java/at/petrak/hexcasting/mixin/MixinAbstractVillager.java +++ b/Common/src/main/java/at/petrak/hexcasting/mixin/MixinAbstractVillager.java @@ -1,6 +1,6 @@ package at.petrak.hexcasting.mixin; -import at.petrak.hexcasting.common.misc.Brainsweeping; +import at.petrak.hexcasting.xplat.IXplatAbstractions; import net.minecraft.world.entity.npc.AbstractVillager; import net.minecraft.world.item.trading.MerchantOffers; import org.spongepowered.asm.mixin.Mixin; @@ -14,7 +14,7 @@ public class MixinAbstractVillager { @Inject(method = "getOffers", at = @At("HEAD"), cancellable = true) private void nixOffers(CallbackInfoReturnable cir) { var self = (AbstractVillager) (Object) this; - if (Brainsweeping.isBrainswept(self)) { + if (IXplatAbstractions.INSTANCE.isBrainswept(self)) { cir.setReturnValue(new MerchantOffers()); } } diff --git a/Common/src/main/java/at/petrak/hexcasting/mixin/MixinLivingEntity.java b/Common/src/main/java/at/petrak/hexcasting/mixin/MixinLivingEntity.java new file mode 100644 index 00000000..c3dbc47b --- /dev/null +++ b/Common/src/main/java/at/petrak/hexcasting/mixin/MixinLivingEntity.java @@ -0,0 +1,24 @@ +package at.petrak.hexcasting.mixin; + +import at.petrak.hexcasting.xplat.IXplatAbstractions; +import net.minecraft.world.entity.LivingEntity; +import net.minecraft.world.entity.Mob; +import net.minecraft.world.entity.ai.Brain; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.Inject; +import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; + +// Nuke the brain at the source +@Mixin(LivingEntity.class) +public abstract class MixinLivingEntity { + @Inject(method = "getBrain", at = @At("RETURN")) + private void removeBrain(CallbackInfoReturnable> cir) { + var self = (LivingEntity) (Object) this; + if (self instanceof Mob mob && IXplatAbstractions.INSTANCE.isBrainswept(mob)) { + var brain = cir.getReturnValue(); + brain.removeAllBehaviors(); + cir.setReturnValue(brain); + } + } +} diff --git a/Common/src/main/java/at/petrak/hexcasting/mixin/MixinRaider.java b/Common/src/main/java/at/petrak/hexcasting/mixin/MixinRaider.java index e7a6eaf6..cb1d92ed 100644 --- a/Common/src/main/java/at/petrak/hexcasting/mixin/MixinRaider.java +++ b/Common/src/main/java/at/petrak/hexcasting/mixin/MixinRaider.java @@ -1,6 +1,6 @@ package at.petrak.hexcasting.mixin; -import at.petrak.hexcasting.common.misc.Brainsweeping; +import at.petrak.hexcasting.xplat.IXplatAbstractions; import net.minecraft.world.entity.raid.Raider; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.injection.At; @@ -9,9 +9,10 @@ import org.spongepowered.asm.mixin.injection.Redirect; // Prevents the witch from joining a raid @Mixin(Raider.class) public class MixinRaider { - @Redirect(method = "aiStep", at = @At(value = "INVOKE", target = "Lnet/minecraft/world/entity/raid/Raider;isAlive()Z")) + @Redirect(method = "aiStep", at = @At(value = "INVOKE", target = "Lnet/minecraft/world/entity/raid/Raider;isAlive" + + "()Z")) private boolean isAliveForAiPurposes(Raider instance) { var self = (Raider) (Object) this; - return self.isAlive() && !Brainsweeping.isBrainswept(self); + return self.isAlive() && !IXplatAbstractions.INSTANCE.isBrainswept(self); } } diff --git a/Common/src/main/java/at/petrak/hexcasting/mixin/MixinVillager.java b/Common/src/main/java/at/petrak/hexcasting/mixin/MixinVillager.java index e6d30fd6..4f577f72 100644 --- a/Common/src/main/java/at/petrak/hexcasting/mixin/MixinVillager.java +++ b/Common/src/main/java/at/petrak/hexcasting/mixin/MixinVillager.java @@ -1,6 +1,6 @@ package at.petrak.hexcasting.mixin; -import at.petrak.hexcasting.common.misc.Brainsweeping; +import at.petrak.hexcasting.xplat.IXplatAbstractions; import net.minecraft.world.entity.npc.Villager; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.injection.At; @@ -11,18 +11,10 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; // Prevents the villager from any of its brain goals @Mixin(Villager.class) public class MixinVillager { - @Inject(method = "registerBrainGoals", at = @At("HEAD"), cancellable = true) - private void onRegisterBrainGoals(CallbackInfo ci) { - var self = (Villager) (Object) this; - if (Brainsweeping.isBrainswept(self)) { - ci.cancel(); - } - } - @Inject(method = "canBreed", at = @At("HEAD"), cancellable = true) private void preventBreeding(CallbackInfoReturnable cir) { var self = (Villager) (Object) this; - if (Brainsweeping.isBrainswept(self)) { + if (IXplatAbstractions.INSTANCE.isBrainswept(self)) { cir.setReturnValue(false); } } @@ -30,7 +22,7 @@ public class MixinVillager { @Inject(method = "setUnhappy", at = @At("HEAD"), cancellable = true) private void preventUnhappiness(CallbackInfo ci) { var self = (Villager) (Object) this; - if (Brainsweeping.isBrainswept(self)) { + if (IXplatAbstractions.INSTANCE.isBrainswept(self)) { ci.cancel(); } } diff --git a/Common/src/main/java/at/petrak/hexcasting/mixin/MixinWitch.java b/Common/src/main/java/at/petrak/hexcasting/mixin/MixinWitch.java index 17174979..fe23cebe 100644 --- a/Common/src/main/java/at/petrak/hexcasting/mixin/MixinWitch.java +++ b/Common/src/main/java/at/petrak/hexcasting/mixin/MixinWitch.java @@ -1,6 +1,6 @@ package at.petrak.hexcasting.mixin; -import at.petrak.hexcasting.common.misc.Brainsweeping; +import at.petrak.hexcasting.xplat.IXplatAbstractions; import net.minecraft.world.entity.monster.Witch; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.injection.At; @@ -9,9 +9,10 @@ import org.spongepowered.asm.mixin.injection.Redirect; // Prevents the witch from drinking potions @Mixin(Witch.class) public class MixinWitch { - @Redirect(method = "aiStep", at = @At(value = "INVOKE", target = "Lnet/minecraft/world/entity/monster/Witch;isAlive()Z")) + @Redirect(method = "aiStep", at = @At(value = "INVOKE", target = "Lnet/minecraft/world/entity/monster/Witch;" + + "isAlive()Z")) private boolean isAliveForAiPurposes(Witch instance) { var self = (Witch) (Object) this; - return self.isAlive() && !Brainsweeping.isBrainswept(self); + return self.isAlive() && !IXplatAbstractions.INSTANCE.isBrainswept(self); } } diff --git a/Fabric/src/main/java/at/petrak/hexcasting/fabric/interop/emi/VillagerEmiStack.java b/Fabric/src/main/java/at/petrak/hexcasting/fabric/interop/emi/BrainsweepeeEmiStack.java similarity index 82% rename from Fabric/src/main/java/at/petrak/hexcasting/fabric/interop/emi/VillagerEmiStack.java rename to Fabric/src/main/java/at/petrak/hexcasting/fabric/interop/emi/BrainsweepeeEmiStack.java index 481057ae..9a30ba45 100644 --- a/Fabric/src/main/java/at/petrak/hexcasting/fabric/interop/emi/VillagerEmiStack.java +++ b/Fabric/src/main/java/at/petrak/hexcasting/fabric/interop/emi/BrainsweepeeEmiStack.java @@ -33,64 +33,64 @@ import java.util.stream.Collectors; import static at.petrak.hexcasting.api.HexAPI.modLoc; import static at.petrak.hexcasting.client.RenderLib.renderEntity; -public class VillagerEmiStack extends EmiStack { +public class BrainsweepeeEmiStack extends EmiStack { private final VillagerEntry entry; public final BrainsweepIngredient ingredient; public final boolean mindless; private final ResourceLocation id; - public VillagerEmiStack(BrainsweepIngredient villager) { + public BrainsweepeeEmiStack(BrainsweepIngredient villager) { this(villager, false); } - public VillagerEmiStack(BrainsweepIngredient villager, boolean mindless) { + public BrainsweepeeEmiStack(BrainsweepIngredient villager, boolean mindless) { this(villager, mindless, 1); } - public VillagerEmiStack(BrainsweepIngredient villager, boolean mindless, long amount) { + public BrainsweepeeEmiStack(BrainsweepIngredient villager, boolean mindless, long amount) { entry = new VillagerEntry(new VillagerVariant(villager, mindless)); this.ingredient = villager; this.mindless = mindless; this.amount = amount; // This is so scuffed this.id = modLoc((Objects.toString(villager.profession()) + villager.minLevel() + mindless) - .replace(':', '-')); + .replace(':', '-')); } public static Set matchingStatesForProfession(VillagerProfession profession) { return Registry.POINT_OF_INTEREST_TYPE.holders() - .filter(profession.heldJobSite()) - .flatMap(it -> it.value().matchingStates().stream()) - .collect(Collectors.toSet()); + .filter(profession.heldJobSite()) + .flatMap(it -> it.value().matchingStates().stream()) + .collect(Collectors.toSet()); } public static EmiIngredient atLevelOrHigher(BrainsweepIngredient ingredient, boolean remainder) { if (ingredient.profession() == null) { return EmiIngredient.of(Registry.VILLAGER_PROFESSION.stream() - .filter(it -> matchingStatesForProfession(it).isEmpty()) - .map(it -> atLevelOrHigher(new BrainsweepIngredient(Registry.VILLAGER_PROFESSION.getKey(it), - ingredient.biome(), ingredient.minLevel()), true)) - .toList()); + .filter(it -> matchingStatesForProfession(it).isEmpty()) + .map(it -> atLevelOrHigher(new BrainsweepIngredient(Registry.VILLAGER_PROFESSION.getKey(it), + ingredient.biome(), ingredient.minLevel()), true)) + .toList()); } - VillagerEmiStack stack = new VillagerEmiStack(ingredient).orHigher(true); + BrainsweepeeEmiStack stack = new BrainsweepeeEmiStack(ingredient).orHigher(true); if (remainder) { - stack.setRemainder(new VillagerEmiStack(ingredient, true)); + stack.setRemainder(new BrainsweepeeEmiStack(ingredient, true)); } return stack; } private boolean orHigher = false; - public VillagerEmiStack orHigher(boolean orHigher) { + public BrainsweepeeEmiStack orHigher(boolean orHigher) { this.orHigher = orHigher; return this; } @Override public EmiStack copy() { - VillagerEmiStack e = new VillagerEmiStack(ingredient, mindless, amount); + BrainsweepeeEmiStack e = new BrainsweepeeEmiStack(ingredient, mindless, amount); e.orHigher(orHigher).setRemainder(getRemainder().copy()); e.comparison = comparison; return e; @@ -136,7 +136,7 @@ public class VillagerEmiStack extends EmiStack { } ResourceLocation displayId = Objects.requireNonNullElseGet(ingredient.profession(), - () -> Registry.ENTITY_TYPE.getKey(EntityType.VILLAGER)); + () -> Registry.ENTITY_TYPE.getKey(EntityType.VILLAGER)); tooltip.add(Component.literal(displayId.toString()).withStyle(ChatFormatting.DARK_GRAY)); } @@ -150,9 +150,9 @@ public class VillagerEmiStack extends EmiStack { @Override public List getTooltip() { List list = getTooltipText().stream() - .map(Component::getVisualOrderText) - .map(ClientTooltipComponent::create) - .collect(Collectors.toList()); + .map(Component::getVisualOrderText) + .map(ClientTooltipComponent::create) + .collect(Collectors.toList()); if (!getRemainder().isEmpty()) { list.add(EmiTooltipComponents.getRemainderTooltipComponent(this)); } @@ -175,7 +175,7 @@ public class VillagerEmiStack extends EmiStack { RenderSystem.enableBlend(); RenderSystem.setShaderColor(1.0F, 1.0F, 1.0F, 1.0F); renderEntity(poseStack, villager, level, x + 8, y + 16, ClientTickCounter.getTotal(), 8, 0, - mindless ? (it) -> new FakeBufferSource(it, HexRenderTypes::getGrayscaleLayer) : it -> it); + mindless ? (it) -> new FakeBufferSource(it, HexRenderTypes::getGrayscaleLayer) : it -> it); } } diff --git a/Fabric/src/main/java/at/petrak/hexcasting/fabric/interop/emi/EmiLevelupRecipe.java b/Fabric/src/main/java/at/petrak/hexcasting/fabric/interop/emi/EmiLevelupRecipe.java index 1e2d6ecd..0f9a6ba3 100644 --- a/Fabric/src/main/java/at/petrak/hexcasting/fabric/interop/emi/EmiLevelupRecipe.java +++ b/Fabric/src/main/java/at/petrak/hexcasting/fabric/interop/emi/EmiLevelupRecipe.java @@ -9,7 +9,7 @@ import net.minecraft.world.item.Items; import java.util.List; public class EmiLevelupRecipe extends EmiVillagerRecipe { - public EmiLevelupRecipe(EmiIngredient input, VillagerEmiStack result, ResourceLocation id) { + public EmiLevelupRecipe(EmiIngredient input, BrainsweepeeEmiStack result, ResourceLocation id) { super(input, EmiStack.of(Items.EMERALD), result, id, false); } diff --git a/Fabric/src/main/java/at/petrak/hexcasting/fabric/interop/emi/EmiProfessionRecipe.java b/Fabric/src/main/java/at/petrak/hexcasting/fabric/interop/emi/EmiProfessionRecipe.java index 926b2558..eefd23fc 100644 --- a/Fabric/src/main/java/at/petrak/hexcasting/fabric/interop/emi/EmiProfessionRecipe.java +++ b/Fabric/src/main/java/at/petrak/hexcasting/fabric/interop/emi/EmiProfessionRecipe.java @@ -5,7 +5,8 @@ import dev.emi.emi.api.stack.EmiIngredient; import net.minecraft.resources.ResourceLocation; public class EmiProfessionRecipe extends EmiVillagerRecipe { - public EmiProfessionRecipe(EmiIngredient input, EmiIngredient catalyst, VillagerEmiStack result, ResourceLocation id) { + public EmiProfessionRecipe(EmiIngredient input, EmiIngredient catalyst, BrainsweepeeEmiStack result, + ResourceLocation id) { super(input, catalyst, result, id); } diff --git a/Fabric/src/main/java/at/petrak/hexcasting/fabric/interop/emi/EmiVillagerRecipe.java b/Fabric/src/main/java/at/petrak/hexcasting/fabric/interop/emi/EmiVillagerRecipe.java index 92f7177a..1b25673c 100644 --- a/Fabric/src/main/java/at/petrak/hexcasting/fabric/interop/emi/EmiVillagerRecipe.java +++ b/Fabric/src/main/java/at/petrak/hexcasting/fabric/interop/emi/EmiVillagerRecipe.java @@ -18,11 +18,13 @@ public abstract class EmiVillagerRecipe implements EmiRecipe { protected final EmiIngredient catalyst; protected final EmiStack result; - public EmiVillagerRecipe(EmiIngredient input, EmiIngredient catalyst, VillagerEmiStack result, ResourceLocation id) { + public EmiVillagerRecipe(EmiIngredient input, EmiIngredient catalyst, BrainsweepeeEmiStack result, + ResourceLocation id) { this(input, catalyst, result, id, true); } - public EmiVillagerRecipe(EmiIngredient input, EmiIngredient catalyst, VillagerEmiStack result, ResourceLocation id, boolean isCatalyst) { + public EmiVillagerRecipe(EmiIngredient input, EmiIngredient catalyst, BrainsweepeeEmiStack result, + ResourceLocation id, boolean isCatalyst) { this.isCatalyst = isCatalyst; this.input = input; this.catalyst = catalyst; diff --git a/Fabric/src/main/java/at/petrak/hexcasting/fabric/interop/emi/HexEMIPlugin.java b/Fabric/src/main/java/at/petrak/hexcasting/fabric/interop/emi/HexEMIPlugin.java index 3054676d..9f0f9dba 100644 --- a/Fabric/src/main/java/at/petrak/hexcasting/fabric/interop/emi/HexEMIPlugin.java +++ b/Fabric/src/main/java/at/petrak/hexcasting/fabric/interop/emi/HexEMIPlugin.java @@ -3,7 +3,6 @@ package at.petrak.hexcasting.fabric.interop.emi; import at.petrak.hexcasting.api.mod.HexItemTags; import at.petrak.hexcasting.common.recipe.BrainsweepRecipe; import at.petrak.hexcasting.common.recipe.HexRecipeStuffRegistry; -import at.petrak.hexcasting.common.recipe.ingredient.brainsweep.BrainsweepIngredient; import at.petrak.hexcasting.interop.utils.PhialRecipeStackBuilder; import dev.emi.emi.api.EmiPlugin; import dev.emi.emi.api.EmiRegistry; @@ -11,17 +10,7 @@ import dev.emi.emi.api.recipe.EmiRecipeCategory; import dev.emi.emi.api.render.EmiTexture; import dev.emi.emi.api.stack.EmiIngredient; import dev.emi.emi.api.stack.EmiStack; -import net.minecraft.core.Registry; import net.minecraft.resources.ResourceLocation; -import net.minecraft.world.entity.npc.VillagerProfession; -import net.minecraft.world.item.Item; -import net.minecraft.world.item.Items; -import net.minecraft.world.level.block.Block; -import net.minecraft.world.level.block.Blocks; -import net.minecraft.world.level.block.state.BlockState; - -import java.util.List; -import java.util.Set; import static at.petrak.hexcasting.api.HexAPI.modLoc; @@ -50,21 +39,21 @@ public class HexEMIPlugin implements EmiPlugin { new PatternRendererEMI(EDIFY_ID, 16, 16).strokeOrder(false), new EmiTexture(SIMPLIFIED_ICON_EDIFY, 0, 0, 16, 16, 16, 16, 16, 16)); - public static final EmiRecipeCategory VILLAGER_LEVELING = new EmiRecipeCategory(VILLAGER_LEVELING_ID, - EmiStack.of(Items.EMERALD), - new EmiTexture(SIMPLIFIED_ICON_LEVELING, 0, 0, 16, 16, 16, 16, 16, 16)); - - public static final EmiRecipeCategory VILLAGER_PROFESSION = new EmiRecipeCategory(VILLAGER_PROFESSION_ID, - EmiStack.of(Blocks.LECTERN), - new EmiTexture(SIMPLIFIED_ICON_PROFESSION, 0, 0, 16, 16, 16, 16, 16, 16)); +// public static final EmiRecipeCategory VILLAGER_LEVELING = new EmiRecipeCategory(VILLAGER_LEVELING_ID, +// EmiStack.of(Items.EMERALD), +// new EmiTexture(SIMPLIFIED_ICON_LEVELING, 0, 0, 16, 16, 16, 16, 16, 16)); +// +// public static final EmiRecipeCategory VILLAGER_PROFESSION = new EmiRecipeCategory(VILLAGER_PROFESSION_ID, +// EmiStack.of(Blocks.LECTERN), +// new EmiTexture(SIMPLIFIED_ICON_PROFESSION, 0, 0, 16, 16, 16, 16, 16, 16)); @Override public void register(EmiRegistry registry) { registry.addCategory(BRAINSWEEP); registry.addCategory(PHIAL); registry.addCategory(EDIFY); - registry.addCategory(VILLAGER_LEVELING); - registry.addCategory(VILLAGER_PROFESSION); +// registry.addCategory(VILLAGER_LEVELING); +// registry.addCategory(VILLAGER_PROFESSION); registry.addWorkstation(BRAINSWEEP, EmiIngredient.of(HexItemTags.STAVES)); registry.addWorkstation(PHIAL, EmiIngredient.of(HexItemTags.STAVES)); registry.addWorkstation(EDIFY, EmiIngredient.of(HexItemTags.STAVES)); @@ -73,7 +62,6 @@ public class HexEMIPlugin implements EmiPlugin { .getAllRecipesFor(HexRecipeStuffRegistry.BRAINSWEEP_TYPE)) { var inputs = EmiIngredient.of(recipe.blockIn().getDisplayedStacks().stream() .map(EmiStack::of).toList()); - var villagerInput = VillagerEmiStack.atLevelOrHigher(recipe.entityIn(), true); var output = EmiStack.of(recipe.result().getBlock()); registry.addRecipe(new EmiBrainsweepRecipe(inputs, villagerInput, output, recipe.getId())); } @@ -84,41 +72,40 @@ public class HexEMIPlugin implements EmiPlugin { registry.addRecipe(new EmiEdifyRecipe()); - var basicVillager = new BrainsweepIngredient(null, null, 1); - - for (VillagerProfession profession : Registry.VILLAGER_PROFESSION) { - ResourceLocation id = Registry.VILLAGER_PROFESSION.getKey(profession); - ResourceLocation poiRecipeId = modLoc("villager/poi/" + id.getNamespace() + "/" + id.getPath()); - var manWithJob = new BrainsweepIngredient(id, null, 1); - - Set states = VillagerEmiStack.matchingStatesForProfession(profession); - if (!states.isEmpty()) { - List workstations = states.stream() - .map(BlockState::getBlock) - .map(Block::asItem) - .distinct() - .filter((it) -> it != Items.AIR) - .toList(); - - if (!workstations.isEmpty()) { - registry.addWorkstation(VILLAGER_LEVELING, - EmiIngredient.of(workstations.stream().map(EmiStack::of).toList())); - registry.addWorkstation(VILLAGER_PROFESSION, - EmiIngredient.of(workstations.stream().map(EmiStack::of).toList())); - registry.addRecipe(new EmiProfessionRecipe(new VillagerEmiStack(basicVillager), - EmiIngredient.of(workstations.stream().map(EmiStack::of).toList()), - new VillagerEmiStack(manWithJob), poiRecipeId)); - - for (int lvl = 1; lvl < 5; lvl++) { - ResourceLocation levelRecipeId = modLoc( - "villager/levelup/" + lvl + "/" + id.getNamespace() + "/" + id.getPath()); - var manWithBadJob = new BrainsweepIngredient(id, null, lvl); - var manWithBetterJob = new BrainsweepIngredient(id, null, lvl + 1); - registry.addRecipe(new EmiLevelupRecipe(new VillagerEmiStack(manWithBadJob), - new VillagerEmiStack(manWithBetterJob), levelRecipeId)); - } - } - } - } +// var basicVillager = new BrainsweepIngredient(null, null, 1); +// for (VillagerProfession profession : Registry.VILLAGER_PROFESSION) { +// ResourceLocation id = Registry.VILLAGER_PROFESSION.getKey(profession); +// ResourceLocation poiRecipeId = modLoc("villager/poi/" + id.getNamespace() + "/" + id.getPath()); +// var manWithJob = new BrainsweepIngredient(id, null, 1); +// +// Set states = BrainsweepeeEmiStack.matchingStatesForProfession(profession); +// if (!states.isEmpty()) { +// List workstations = states.stream() +// .map(BlockState::getBlock) +// .map(Block::asItem) +// .distinct() +// .filter((it) -> it != Items.AIR) +// .toList(); +// +// if (!workstations.isEmpty()) { +// registry.addWorkstation(VILLAGER_LEVELING, +// EmiIngredient.of(workstations.stream().map(EmiStack::of).toList())); +// registry.addWorkstation(VILLAGER_PROFESSION, +// EmiIngredient.of(workstations.stream().map(EmiStack::of).toList())); +// registry.addRecipe(new EmiProfessionRecipe(new BrainsweepeeEmiStack(basicVillager), +// EmiIngredient.of(workstations.stream().map(EmiStack::of).toList()), +// new BrainsweepeeEmiStack(manWithJob), poiRecipeId)); +// +// for (int lvl = 1; lvl < 5; lvl++) { +// ResourceLocation levelRecipeId = modLoc( +// "villager/levelup/" + lvl + "/" + id.getNamespace() + "/" + id.getPath()); +// var manWithBadJob = new BrainsweepIngredient(id, null, lvl); +// var manWithBetterJob = new BrainsweepIngredient(id, null, lvl + 1); +// registry.addRecipe(new EmiLevelupRecipe(new BrainsweepeeEmiStack(manWithBadJob), +// new BrainsweepeeEmiStack(manWithBetterJob), levelRecipeId)); +// } +// } +// } +// } } } diff --git a/Forge/src/generated/resources/.cache/9fb1092f32d4fcbf9e061ffd718d4ec689c6c95e b/Forge/src/generated/resources/.cache/9fb1092f32d4fcbf9e061ffd718d4ec689c6c95e index f98b1702..5da627b8 100644 --- a/Forge/src/generated/resources/.cache/9fb1092f32d4fcbf9e061ffd718d4ec689c6c95e +++ b/Forge/src/generated/resources/.cache/9fb1092f32d4fcbf9e061ffd718d4ec689c6c95e @@ -1,4 +1,4 @@ -// 1.19.2 2022-11-09T19:46:44.013201 Recipes +// 1.19.2 2022-11-23T20:06:32.313241156 Recipes 29056d8bbc023668564ee81f4eb8b2a11411cf4a data/create/recipes/crushing/amethyst_block.json 5bb0b70967a422bfd88c01fa1af64e9b98781fd1 data/create/recipes/crushing/amethyst_cluster.json 8d6f58c45be52e22559fdbc2806ee48ab40d133c data/hexcasting/advancements/recipes/brainsweep/brainsweep/akashic_record.json @@ -102,12 +102,12 @@ f0849d723141b9f02798d474da6594f78755dd51 data/hexcasting/recipes/amethyst_tiles. 260f89eb21b360ea8b7fdbd23f9977d03ab57149 data/hexcasting/recipes/ancient_scroll_paper_lantern.json 1880b1519b100f2185ed27a9bfd8f98e83fa728f data/hexcasting/recipes/artifact.json 6f5ee50706640e9be82810e22388fc7b2bce13b1 data/hexcasting/recipes/birch_staff.json -3514bb0e92046ca12dfd10afb3c47084434f84c2 data/hexcasting/recipes/brainsweep/akashic_record.json -63d9172717dd1cbb587fc9d92fd69f47b1bb3307 data/hexcasting/recipes/brainsweep/budding_amethyst.json -9bd09d681a608e465feb6d6a63d0b021920c7a1d data/hexcasting/recipes/brainsweep/directrix_redstone.json -ae676c825f58eefb2bfbbd866db13dbb59deff0e data/hexcasting/recipes/brainsweep/impetus_look.json -773860888fb2d695b775f3afb93b16f43795bcc6 data/hexcasting/recipes/brainsweep/impetus_rightclick.json -c86adafd19871ba67f0b7b693247c0a5bdec1020 data/hexcasting/recipes/brainsweep/impetus_storedplayer.json +9d4405e831b27dfa6dad7f42f7c2a298de6049a7 data/hexcasting/recipes/brainsweep/akashic_record.json +12b4e03df1c9115dd94790ff27b818c2b7c335d3 data/hexcasting/recipes/brainsweep/budding_amethyst.json +adc3ad0e6cbf522ebe73cc1301089b6b9a4873c0 data/hexcasting/recipes/brainsweep/directrix_redstone.json +67ceb2990df8405119a6ef76af1bb3f9aab5dace data/hexcasting/recipes/brainsweep/impetus_look.json +b864b6c88f1026a371fd72cd7f43bd3b57376c00 data/hexcasting/recipes/brainsweep/impetus_rightclick.json +8f6956c2d1293948d2f1e2ae9eefe890c9168900 data/hexcasting/recipes/brainsweep/impetus_storedplayer.json c4e770cfd4d855d5b4fdc66e424d58621302f51a data/hexcasting/recipes/compat/create/crushing/amethyst_shard.json 64ee84a9bce988bacde0911d05d0f3834e0b1ae7 data/hexcasting/recipes/compat/farmersdelight/cutting/akashic_door.json f398f4a10736f967482dd1d254d37c7ba9e67bb0 data/hexcasting/recipes/compat/farmersdelight/cutting/akashic_log.json diff --git a/Forge/src/generated/resources/data/hexcasting/recipes/brainsweep/akashic_record.json b/Forge/src/generated/resources/data/hexcasting/recipes/brainsweep/akashic_record.json index 65f772c8..9f087e42 100644 --- a/Forge/src/generated/resources/data/hexcasting/recipes/brainsweep/akashic_record.json +++ b/Forge/src/generated/resources/data/hexcasting/recipes/brainsweep/akashic_record.json @@ -4,11 +4,12 @@ "type": "block", "block": "hexcasting:akashic_connector" }, - "result": { - "name": "hexcasting:akashic_record" - }, - "villagerIn": { + "cost": 1000000, + "entityIn": { "minLevel": 5, "profession": "minecraft:librarian" + }, + "result": { + "name": "hexcasting:akashic_record" } } \ No newline at end of file diff --git a/Forge/src/generated/resources/data/hexcasting/recipes/brainsweep/budding_amethyst.json b/Forge/src/generated/resources/data/hexcasting/recipes/brainsweep/budding_amethyst.json index 0d7b8aeb..821ada6e 100644 --- a/Forge/src/generated/resources/data/hexcasting/recipes/brainsweep/budding_amethyst.json +++ b/Forge/src/generated/resources/data/hexcasting/recipes/brainsweep/budding_amethyst.json @@ -4,10 +4,11 @@ "type": "block", "block": "minecraft:amethyst_block" }, + "cost": 1000000, + "entityIn": { + "minLevel": 3 + }, "result": { "name": "minecraft:budding_amethyst" - }, - "villagerIn": { - "minLevel": 3 } } \ No newline at end of file diff --git a/Forge/src/generated/resources/data/hexcasting/recipes/brainsweep/directrix_redstone.json b/Forge/src/generated/resources/data/hexcasting/recipes/brainsweep/directrix_redstone.json index cd6f95c3..a20511db 100644 --- a/Forge/src/generated/resources/data/hexcasting/recipes/brainsweep/directrix_redstone.json +++ b/Forge/src/generated/resources/data/hexcasting/recipes/brainsweep/directrix_redstone.json @@ -4,6 +4,11 @@ "type": "block", "block": "hexcasting:empty_directrix" }, + "cost": 1000000, + "entityIn": { + "minLevel": 1, + "profession": "minecraft:mason" + }, "result": { "name": "hexcasting:directrix_redstone", "properties": { @@ -11,9 +16,5 @@ "facing": "north", "powered": "false" } - }, - "villagerIn": { - "minLevel": 1, - "profession": "minecraft:mason" } } \ No newline at end of file diff --git a/Forge/src/generated/resources/data/hexcasting/recipes/brainsweep/impetus_look.json b/Forge/src/generated/resources/data/hexcasting/recipes/brainsweep/impetus_look.json index 1eaa96b3..0a45783f 100644 --- a/Forge/src/generated/resources/data/hexcasting/recipes/brainsweep/impetus_look.json +++ b/Forge/src/generated/resources/data/hexcasting/recipes/brainsweep/impetus_look.json @@ -4,15 +4,16 @@ "type": "block", "block": "hexcasting:empty_impetus" }, + "cost": 1000000, + "entityIn": { + "minLevel": 2, + "profession": "minecraft:fletcher" + }, "result": { "name": "hexcasting:impetus_look", "properties": { "energized": "false", "facing": "north" } - }, - "villagerIn": { - "minLevel": 2, - "profession": "minecraft:fletcher" } } \ No newline at end of file diff --git a/Forge/src/generated/resources/data/hexcasting/recipes/brainsweep/impetus_rightclick.json b/Forge/src/generated/resources/data/hexcasting/recipes/brainsweep/impetus_rightclick.json index a92539c0..de05a0c4 100644 --- a/Forge/src/generated/resources/data/hexcasting/recipes/brainsweep/impetus_rightclick.json +++ b/Forge/src/generated/resources/data/hexcasting/recipes/brainsweep/impetus_rightclick.json @@ -4,15 +4,16 @@ "type": "block", "block": "hexcasting:empty_impetus" }, + "cost": 1000000, + "entityIn": { + "minLevel": 2, + "profession": "minecraft:toolsmith" + }, "result": { "name": "hexcasting:impetus_rightclick", "properties": { "energized": "false", "facing": "north" } - }, - "villagerIn": { - "minLevel": 2, - "profession": "minecraft:toolsmith" } } \ No newline at end of file diff --git a/Forge/src/generated/resources/data/hexcasting/recipes/brainsweep/impetus_storedplayer.json b/Forge/src/generated/resources/data/hexcasting/recipes/brainsweep/impetus_storedplayer.json index ea63f87c..f662bbba 100644 --- a/Forge/src/generated/resources/data/hexcasting/recipes/brainsweep/impetus_storedplayer.json +++ b/Forge/src/generated/resources/data/hexcasting/recipes/brainsweep/impetus_storedplayer.json @@ -4,6 +4,11 @@ "type": "block", "block": "hexcasting:empty_impetus" }, + "cost": 1000000, + "entityIn": { + "minLevel": 2, + "profession": "minecraft:cleric" + }, "result": { "name": "hexcasting:impetus_storedplayer", "properties": { @@ -11,9 +16,5 @@ "facing": "north", "powered": "true" } - }, - "villagerIn": { - "minLevel": 2, - "profession": "minecraft:cleric" } } \ No newline at end of file diff --git a/Forge/src/main/java/at/petrak/hexcasting/forge/network/MsgBrainsweepAck.java b/Forge/src/main/java/at/petrak/hexcasting/forge/network/MsgBrainsweepAck.java index 1ed1f6ff..909dde8c 100644 --- a/Forge/src/main/java/at/petrak/hexcasting/forge/network/MsgBrainsweepAck.java +++ b/Forge/src/main/java/at/petrak/hexcasting/forge/network/MsgBrainsweepAck.java @@ -1,7 +1,7 @@ package at.petrak.hexcasting.forge.network; -import at.petrak.hexcasting.common.misc.Brainsweeping; import at.petrak.hexcasting.common.network.IMessage; +import at.petrak.hexcasting.xplat.IXplatAbstractions; import io.netty.buffer.ByteBuf; import net.minecraft.client.Minecraft; import net.minecraft.network.FriendlyByteBuf; @@ -46,7 +46,7 @@ public record MsgBrainsweepAck(int target) implements IMessage { if (level != null) { Entity entity = level.getEntity(msg.target()); if (entity instanceof Mob living) { - Brainsweeping.brainsweep(living); + IXplatAbstractions.INSTANCE.brainsweep(living); } } } From 30c81e2008bcc947f31cf7cd9386d66b673e16f2 Mon Sep 17 00:00:00 2001 From: "petrak@" Date: Tue, 29 Nov 2022 12:18:01 -0500 Subject: [PATCH 14/95] close #331, document 2dup, and clean up langfile --- .../assets/hexcasting/lang/en_us.json | 18 ++++++------------ .../en_us/entries/patterns/stackmanip.json | 15 ++++++++------- 2 files changed, 14 insertions(+), 19 deletions(-) diff --git a/Common/src/main/resources/assets/hexcasting/lang/en_us.json b/Common/src/main/resources/assets/hexcasting/lang/en_us.json index 57b6ceff..24106279 100644 --- a/Common/src/main/resources/assets/hexcasting/lang/en_us.json +++ b/Common/src/main/resources/assets/hexcasting/lang/en_us.json @@ -253,7 +253,7 @@ "command.hexcasting.pats.specific.success": "Gave %s with id %s to %s", "command.hexcasting.recalc": "Recalculated patterns", "command.hexcasting.brainsweep": "Brainswept %s", - "command.hexcasting.brainsweep.fail.badtype": "%s is not a villager", + "command.hexcasting.brainsweep.fail.badtype": "%s is not a mob", "command.hexcasting.brainsweep.fail.already": "%s is already empty", "hexcasting.pattern.unknown": "Unknown pattern resource location %s", "hexcasting.debug.media_withdrawn": "%s - Media withdrawn: %s", @@ -561,8 +561,8 @@ "hexcasting.mishap.bad_block": "Expected %s at %s, but got %s", "hexcasting.mishap.bad_block.sapling": "a sapling", "hexcasting.mishap.bad_block.replaceable": "somewhere to place a block", - "hexcasting.mishap.bad_brainsweep": "The %s rejected the villager's mind", - "hexcasting.mishap.already_brainswept": "The villager has already been used", + "hexcasting.mishap.bad_brainsweep": "The %s rejected the being's mind", + "hexcasting.mishap.already_brainswept": "The mind has already been used", "hexcasting.mishap.no_spell_circle": "%s requires a spell circle", "hexcasting.mishap.others_name": "Tried to invade the privacy of %s's soul", "hexcasting.mishap.others_name.self": "Tried to divulge my Name too recklessly", @@ -714,7 +714,7 @@ "hexcasting.entry.mishaps2": "Enlightened Mishaps", "hexcasting.page.mishaps2.1": "I have discovered new and horrifying modes of failure. I must not succumb to them.", "hexcasting.page.mishaps2.bad_mindflay.title": "Inert Mindflay", - "hexcasting.page.mishaps2.bad_mindflay": "Attempted to flay the mind of a villager that I have either already used, or of a character not suitable for the target block.$(br2)Causes dark green sparks, and kills the subject. If another villager sees that, I doubt they would look on it favorably.", + "hexcasting.page.mishaps2.bad_mindflay": "Attempted to flay the mind of something that I have either already used, or of a character not suitable for the target block.$(br2)Causes dark green sparks, and kills the subject. If a villager sees that, I doubt they would look on it favorably.", "hexcasting.page.mishaps2.no_circle.title": "Lack Spell Circle", "hexcasting.page.mishaps2.no_circle": "Tried to cast an action requiring a spell circle without a spell circle.$(br2)Causes light blue sparks, and upends my inventory onto the ground.", "hexcasting.page.mishaps2.no_record.title": "Lack Akashic Record", @@ -939,23 +939,17 @@ "hexcasting.entry.stackmanip": "Stack Manipulation", "hexcasting.page.stackmanip.pseudo-novice.title": "Novice's Gambit", - "hexcasting.page.stackmanip.pseudo-novice": "Removes the first iota from the stack.", - "hexcasting.page.stackmanip.duplicate": "Duplicates the top iota of the stack.", + "hexcasting.page.stackmanip.pseudo-novice": "Removes the first iota from the stack.$(br2)This seems to be a special case of $(l:patterns/stackmanip#hexcasting:mask)$(action)Bookkeeper's Gambit/$.", "hexcasting.page.stackmanip.swap": "Swaps the top two iotas of the stack.", - "hexcasting.page.stackmanip.over": "Duplicates the iota second from the top to the top. [0, 1] becomes [0, 1, 0].", "hexcasting.page.stackmanip.rotate": "Yanks the iota third from the top of the stack to the top. [0, 1, 2] becomes [1, 2, 0].", "hexcasting.page.stackmanip.rotate_reverse": "Yanks the top iota to the third position. [0, 1, 2] becomes [2, 0, 1].", + "hexcasting.page.stackmanip.duplicate": "Duplicates the top iota of the stack.", "hexcasting.page.stackmanip.over": "Copy the second-to-last iota of the stack to the top. [0, 1] becomes [0, 1, 0].", "hexcasting.page.stackmanip.tuck": "Copy the top iota of the stack, then put it under the second iota. [0, 1] becomes [1, 0, 1].", "hexcasting.page.stackmanip.2dup": "Copy the top two iotas of the stack. [0, 1] becomes [0, 1, 0, 1].", "hexcasting.page.stackmanip.duplicate_n": "Removes the number at the top of the stack, then copies the top iota of the stack that number of times. (A count of 2 results in two of the iota on the stack, not three.)", "hexcasting.page.stackmanip.fisherman": "Grabs the element in the stack indexed by the number and brings it to the top.", "hexcasting.page.stackmanip.fisherman/copy": "Like $(action)Fisherman's Gambit/$, but instead of moving the iota, copies it.", - "hexcasting.page.stackmanip.stack_len": "Pushes the size of the stack as a number to the top of the stack. (For example, a stack of [0, 1] will become [0, 1, 2].)", - "hexcasting.page.stackmanip.last_n_list": "Remove $(italic)num/$ elements from the stack, then add them to a list at the top of the stack.", - "hexcasting.page.stackmanip.splat": "Remove the list at the top of the stack, then push its contents to the stack.", - "hexcasting.page.stackmanip.duplicate": "Duplicates the top iota of the stack.", - "hexcasting.page.stackmanip.duplicate_n": "Removes the number at the top of the stack, then copies the top iota of the stack that number of times. (A count of 2 results in two of the iota on the stack, not three.)", "hexcasting.page.stackmanip.mask.1": "An infinite family of actions that keep or remove elements at the top of the stack based on the sequence of dips and lines.", "hexcasting.page.stackmanip.mask.2": "Assuming that I draw a Bookkeeper's Gambit pattern left-to-right, the number of iotas the action will require is determined by the horizontal distance covered by the pattern. From deepest in the stack to shallowest, a flat line will keep the iota, whereas a triangle dipping down will remove it.$(br2)If my stack contains $(italic)0, 1, 2/$ from deepest to shallowest, drawing the first pattern opposite will give me $(italic)1/$, the second will give me $(italic)0/$, and the third will give me $(italic)0, 2/$ (the 0 at the bottom is left untouched).", "hexcasting.page.stackmanip.swizzle.1": "Rearranges the top elements of the stack based on the given numerical code, which is the index of the permutation wanted.", diff --git a/Common/src/main/resources/data/hexcasting/patchouli_books/thehexbook/en_us/entries/patterns/stackmanip.json b/Common/src/main/resources/data/hexcasting/patchouli_books/thehexbook/en_us/entries/patterns/stackmanip.json index 08faa62c..04b72502 100644 --- a/Common/src/main/resources/data/hexcasting/patchouli_books/thehexbook/en_us/entries/patterns/stackmanip.json +++ b/Common/src/main/resources/data/hexcasting/patchouli_books/thehexbook/en_us/entries/patterns/stackmanip.json @@ -82,7 +82,7 @@ "type": "hexcasting:pattern", "op_id": "hexcasting:fisherman", "anchor": "hexcasting:fisherman", - "input": "num", + "input": "number", "output": "any", "text": "hexcasting.page.stackmanip.fisherman" }, @@ -90,7 +90,7 @@ "type": "hexcasting:pattern", "op_id": "hexcasting:fisherman/copy", "anchor": "hexcasting:fisherman/copy", - "input": "num", + "input": "number", "output": "any", "text": "hexcasting.page.stackmanip.fisherman/copy" }, @@ -139,12 +139,13 @@ "url": "https://github.com/gamma-delta/HexMod/wiki/Table-of-Lehmer-Codes-for-Swindler's-Gambit" }, { + "_comment": "i hate that I have to put this here at the end. two-page design bad", "type": "hexcasting:pattern", - "op_id": "hexcasting:stack_len", - "anchor": "hexcasting:stack_len", - "input": "", - "output": "num", - "text": "hexcasting.page.stackmanip.stack_len" + "op_id": "hexcasting:2dup", + "anchor": "hexcasting:2dup", + "input": "any, any", + "output": "any, any, any, any", + "text": "hexcasting.page.stackmanip.2dup" } ] } From de8e84cdbd305836792ca456d95528c23c3f8c3d Mon Sep 17 00:00:00 2001 From: "petrak@" Date: Tue, 29 Nov 2022 12:35:12 -0500 Subject: [PATCH 15/95] probably fix #329? i wasn't able to reproduce --- .../petrak/hexcasting/api/spell/casting/CastingHarness.kt | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/Common/src/main/java/at/petrak/hexcasting/api/spell/casting/CastingHarness.kt b/Common/src/main/java/at/petrak/hexcasting/api/spell/casting/CastingHarness.kt index 8fa68d83..cf799b84 100644 --- a/Common/src/main/java/at/petrak/hexcasting/api/spell/casting/CastingHarness.kt +++ b/Common/src/main/java/at/petrak/hexcasting/api/spell/casting/CastingHarness.kt @@ -35,6 +35,7 @@ import net.minecraft.network.chat.Component import net.minecraft.resources.ResourceLocation import net.minecraft.server.level.ServerLevel import net.minecraft.sounds.SoundSource +import net.minecraft.util.Mth import net.minecraft.world.level.gameevent.GameEvent import net.minecraft.world.phys.Vec3 import kotlin.math.min @@ -541,14 +542,14 @@ class CastingHarness private constructor( if (allowOvercast && costLeft > 0) { // Cast from HP! val mediaToHealth = HexConfig.common().mediaToHealthRate() - val healthtoRemove = costLeft.toDouble() / mediaToHealth + val healthToRemove = costLeft.toDouble() / mediaToHealth val mediaAbleToCastFromHP = this.ctx.caster.health * mediaToHealth val mediaToActuallyPayFor = min(mediaAbleToCastFromHP.toInt(), costLeft) costLeft -= if (!fake) { - Mishap.trulyHurt(this.ctx.caster, HexDamageSources.OVERCAST, healthtoRemove.toFloat()) + Mishap.trulyHurt(this.ctx.caster, HexDamageSources.OVERCAST, healthToRemove.toFloat()) - val actuallyTaken = (mediaAbleToCastFromHP - (this.ctx.caster.health * mediaToHealth)).toInt() + val actuallyTaken = Mth.ceil(mediaAbleToCastFromHP - (this.ctx.caster.health * mediaToHealth)) HexAdvancementTriggers.OVERCAST_TRIGGER.trigger(this.ctx.caster, actuallyTaken) this.ctx.caster.awardStat(HexStatistics.MEDIA_OVERCAST, mediaCost - costLeft) From 3a8dfa6cc818f423d2662b66e826d0dbf2db05c1 Mon Sep 17 00:00:00 2001 From: "petrak@" Date: Tue, 29 Nov 2022 13:42:31 -0500 Subject: [PATCH 16/95] fix #329 and fix #332 --- .../e5c5eb35b4ba40351ecb7d9f04c3527f2f5779b0 | 6 +++--- .../hexcasting/advancements/enlightenment.json | 4 ++-- .../data/hexcasting/advancements/opened_eyes.json | 2 +- .../api/advancements/OvercastTrigger.java | 4 +++- .../api/spell/casting/CastingHarness.kt | 3 ++- .../hexcasting/datagen/HexAdvancements.java | 15 +++++++-------- 6 files changed, 18 insertions(+), 16 deletions(-) diff --git a/Common/src/generated/resources/.cache/e5c5eb35b4ba40351ecb7d9f04c3527f2f5779b0 b/Common/src/generated/resources/.cache/e5c5eb35b4ba40351ecb7d9f04c3527f2f5779b0 index 010e48c1..b46c34f8 100644 --- a/Common/src/generated/resources/.cache/e5c5eb35b4ba40351ecb7d9f04c3527f2f5779b0 +++ b/Common/src/generated/resources/.cache/e5c5eb35b4ba40351ecb7d9f04c3527f2f5779b0 @@ -1,7 +1,7 @@ -// 1.19.2 2022-11-09T19:44:43.405259 Advancements +// 1.19.2 2022-11-29T13:33:14.877218824 Advancements b21f0b7f0cda29a7e84693df8139f2fecfeea960 data/hexcasting/advancements/aaa_wasteful_cast.json 9d8b41dd8ddfccdf2cd19433d8d7d3cf934e64db data/hexcasting/advancements/aab_big_cast.json -ef61c93d776c6f212820af20909a4c1d92822baf data/hexcasting/advancements/enlightenment.json +425b42f6da5fd6498053f565dce1f171997dbb8b data/hexcasting/advancements/enlightenment.json 8f97205fa79270eab688aa3019d6fe7dd8c8b0d3 data/hexcasting/advancements/lore.json 2f5ad49936d58c7097ac7f8fbbf3f66f9f90fd2c data/hexcasting/advancements/lore/experiment1.json 9a4eba1c9d7868906e8ea1b4ec287f54a2c379b5 data/hexcasting/advancements/lore/experiment2.json @@ -11,6 +11,6 @@ ef06ae5bd79e2c52291fbfb3c69bc2f74a604477 data/hexcasting/advancements/lore/terab 74fbb1ce0e3acf982325b9e9205f774a67956c3c data/hexcasting/advancements/lore/terabithia3.json 861374b7c144ccdbbd031a3f5042af6718ba42bf data/hexcasting/advancements/lore/terabithia4.json e26db8dfa825b7ac572d59a548b610db7c7bf736 data/hexcasting/advancements/lore/terabithia5.json -2acbfb4efe2a72a1986c8dbe62ad8d93e9613e99 data/hexcasting/advancements/opened_eyes.json +bf319d71d9e706f9131c9484be1bc83ca2b8b6a3 data/hexcasting/advancements/opened_eyes.json d19039a73324eb7532d035d08442f3b68bb13bcb data/hexcasting/advancements/root.json b1b82068d65d6872c258d905d4f78499e8227ccf data/hexcasting/advancements/y_u_no_cast_angy.json diff --git a/Common/src/generated/resources/data/hexcasting/advancements/enlightenment.json b/Common/src/generated/resources/data/hexcasting/advancements/enlightenment.json index a4c76966..4488f207 100644 --- a/Common/src/generated/resources/data/hexcasting/advancements/enlightenment.json +++ b/Common/src/generated/resources/data/hexcasting/advancements/enlightenment.json @@ -7,8 +7,8 @@ "min": 0.8 }, "mojang_i_am_begging_and_crying_please_add_an_entity_health_criterion": { - "max": 2.05, - "min": 0.1 + "max": 1.0, + "min": 2.2250738585072014E-308 } }, "trigger": "hexcasting:overcast" diff --git a/Common/src/generated/resources/data/hexcasting/advancements/opened_eyes.json b/Common/src/generated/resources/data/hexcasting/advancements/opened_eyes.json index 908477ac..fde10466 100644 --- a/Common/src/generated/resources/data/hexcasting/advancements/opened_eyes.json +++ b/Common/src/generated/resources/data/hexcasting/advancements/opened_eyes.json @@ -4,7 +4,7 @@ "health_used": { "conditions": { "mojang_i_am_begging_and_crying_please_add_an_entity_health_criterion": { - "min": 0.1 + "min": 0.0 } }, "trigger": "hexcasting:overcast" diff --git a/Common/src/main/java/at/petrak/hexcasting/api/advancements/OvercastTrigger.java b/Common/src/main/java/at/petrak/hexcasting/api/advancements/OvercastTrigger.java index 7b5b8d74..ae972d1c 100644 --- a/Common/src/main/java/at/petrak/hexcasting/api/advancements/OvercastTrigger.java +++ b/Common/src/main/java/at/petrak/hexcasting/api/advancements/OvercastTrigger.java @@ -15,7 +15,8 @@ public class OvercastTrigger extends SimpleCriterionTrigger 0) { // Cast from HP! val mediaToHealth = HexConfig.common().mediaToHealthRate() - val healthToRemove = costLeft.toDouble() / mediaToHealth + val healthToRemove = max(costLeft.toDouble() / mediaToHealth, 0.5) val mediaAbleToCastFromHP = this.ctx.caster.health * mediaToHealth val mediaToActuallyPayFor = min(mediaAbleToCastFromHP.toInt(), costLeft) diff --git a/Common/src/main/java/at/petrak/hexcasting/datagen/HexAdvancements.java b/Common/src/main/java/at/petrak/hexcasting/datagen/HexAdvancements.java index 2b1651d3..9f220aa5 100644 --- a/Common/src/main/java/at/petrak/hexcasting/datagen/HexAdvancements.java +++ b/Common/src/main/java/at/petrak/hexcasting/datagen/HexAdvancements.java @@ -5,19 +5,15 @@ import at.petrak.hexcasting.api.advancements.FailToCastGreatSpellTrigger; import at.petrak.hexcasting.api.advancements.OvercastTrigger; import at.petrak.hexcasting.api.advancements.SpendMediaTrigger; import at.petrak.hexcasting.api.misc.MediaConstants; +import at.petrak.hexcasting.api.mod.HexItemTags; import at.petrak.hexcasting.common.items.ItemLoreFragment; import at.petrak.hexcasting.common.lib.HexBlocks; -import at.petrak.hexcasting.api.mod.HexItemTags; import at.petrak.hexcasting.common.lib.HexItems; import at.petrak.paucal.api.datagen.PaucalAdvancementProvider; import net.minecraft.advancements.Advancement; import net.minecraft.advancements.DisplayInfo; import net.minecraft.advancements.FrameType; import net.minecraft.advancements.critereon.*; -import net.minecraft.advancements.critereon.EntityPredicate; -import net.minecraft.advancements.critereon.InventoryChangeTrigger; -import net.minecraft.advancements.critereon.ItemPredicate; -import net.minecraft.advancements.critereon.MinMaxBounds; import net.minecraft.data.DataGenerator; import net.minecraft.network.chat.Component; import net.minecraft.resources.ResourceLocation; @@ -77,7 +73,7 @@ public class HexAdvancements extends PaucalAdvancementProvider { MinMaxBounds.Ints.ANY, MinMaxBounds.Doubles.ANY, // you can't just kill yourself - MinMaxBounds.Doubles.atLeast(0.1))) + MinMaxBounds.Doubles.atLeast(0.0))) .save(consumer, prefix("opened_eyes")); Advancement.Builder.advancement() @@ -90,9 +86,12 @@ public class HexAdvancements extends PaucalAdvancementProvider { .addCriterion("health_used", new OvercastTrigger.Instance(EntityPredicate.Composite.ANY, MinMaxBounds.Ints.ANY, - // add a little bit of slop here + // add a little bit of slop here. use 80% or more health ... MinMaxBounds.Doubles.atLeast(0.8), - MinMaxBounds.Doubles.between(0.1, 2.05))) + // and be left with under 1 healthpoint (half a heart) + // TODO this means if 80% of your health is less than half a heart, so if you have 2.5 hearts or + // less, you can't become enlightened. + MinMaxBounds.Doubles.between(Double.MIN_NORMAL, 1.0))) .save(consumer, prefix("enlightenment")); var loreRoot = Advancement.Builder.advancement() From 725aa894d41dadcc1b1a75c27648242d88671eca Mon Sep 17 00:00:00 2001 From: "petrak@" Date: Tue, 29 Nov 2022 14:21:38 -0500 Subject: [PATCH 17/95] probably fix #327? --- .../hexcasting/api/PatternRegistry.java | 14 +++-- .../casting/operators/spells/OpBlink.kt | 2 +- .../operators/spells/great/OpTeleport.kt | 19 +++++-- .../common/command/ListPatternsCommand.java | 55 ++++++++++--------- .../common/command/PatternResLocArgument.java | 6 +- 5 files changed, 56 insertions(+), 40 deletions(-) diff --git a/Common/src/main/java/at/petrak/hexcasting/api/PatternRegistry.java b/Common/src/main/java/at/petrak/hexcasting/api/PatternRegistry.java index 28a6b33e..7e8bae1e 100644 --- a/Common/src/main/java/at/petrak/hexcasting/api/PatternRegistry.java +++ b/Common/src/main/java/at/petrak/hexcasting/api/PatternRegistry.java @@ -34,7 +34,7 @@ public class PatternRegistry { new ConcurrentHashMap<>(); public static void mapPattern(HexPattern pattern, ResourceLocation id, - Action action) throws RegisterPatternException { + Action action) throws RegisterPatternException { mapPattern(pattern, id, action, false); } @@ -42,7 +42,7 @@ public class PatternRegistry { * Associate a given angle signature with a SpellOperator. */ public static void mapPattern(HexPattern pattern, ResourceLocation id, Action action, - boolean isPerWorld) throws RegisterPatternException { + boolean isPerWorld) throws RegisterPatternException { if (actionLookup.containsKey(id)) { throw new RegisterPatternException("The operator with id `%s` was already registered to: %s", id, actionLookup.get(id)); @@ -83,7 +83,7 @@ public class PatternRegistry { * Internal use only. */ public static Pair matchPatternAndID(HexPattern pat, - ServerLevel overworld) throws MishapInvalidPattern { + ServerLevel overworld) throws MishapInvalidPattern { // Pipeline: // patterns are registered here every time the game boots // when we try to look @@ -143,7 +143,8 @@ public class PatternRegistry { return actionLookup.get(it.opId); } - // Currently, there's no way to look up the name of a Great Spell, as the client is unaware of the correct mapping. + // Currently, there's no way to look up the name of a Great Spell, as the client is unaware of the correct + // mapping. // TODO: add code to match any pattern in the shape of a Great Spell to its operator. // var ds = overworld.getDataStorage(); @@ -160,6 +161,8 @@ public class PatternRegistry { /** * Internal use only. + *

+ * Map of signatures to (op id, canonical start dir) */ public static Map> getPerWorldPatterns(ServerLevel overworld) { var ds = overworld.getDataStorage(); @@ -301,7 +304,8 @@ public class PatternRegistry { return new Save(map, missingEntries); } - private static void scrungle(Map> lookup, HexPattern prototype, ResourceLocation opId, long seed) { + private static void scrungle(Map> lookup, HexPattern prototype, + ResourceLocation opId, long seed) { var scrungled = EulerPathFinder.findAltDrawing(prototype, seed, it -> { var sig = it.anglesSignature(); return !lookup.containsKey(sig) && diff --git a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/spells/OpBlink.kt b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/spells/OpBlink.kt index 94fcdaa3..3ef6fd0b 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/spells/OpBlink.kt +++ b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/spells/OpBlink.kt @@ -47,7 +47,7 @@ object OpBlink : SpellAction { private data class Spell(val target: Entity, val delta: Double) : RenderedSpell { override fun cast(ctx: CastingContext) { val delta = target.lookAngle.scale(delta) - OpTeleport.teleportRespectSticky(target, delta) + OpTeleport.teleportRespectSticky(target, delta, ctx.world) } } } 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 f5c38869..6389cdd6 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 @@ -9,9 +9,13 @@ import at.petrak.hexcasting.api.spell.mishaps.MishapLocationTooFarAway import at.petrak.hexcasting.common.lib.HexEntityTags import at.petrak.hexcasting.common.network.MsgBlinkAck import at.petrak.hexcasting.xplat.IXplatAbstractions +import net.minecraft.core.BlockPos +import net.minecraft.server.level.ServerLevel import net.minecraft.server.level.ServerPlayer +import net.minecraft.server.level.TicketType import net.minecraft.world.entity.Entity import net.minecraft.world.item.enchantment.EnchantmentHelper +import net.minecraft.world.level.ChunkPos import net.minecraft.world.phys.Vec3 // TODO while we're making breaking changes I *really* want to have the vector in the entity's local space @@ -51,7 +55,7 @@ object OpTeleport : SpellAction { // TODO make this not a magic number (config?) if (distance < 32768.0) { - teleportRespectSticky(teleportee, delta) + teleportRespectSticky(teleportee, delta, ctx.world) } if (teleportee is ServerPlayer && teleportee == ctx.caster) { @@ -87,8 +91,9 @@ object OpTeleport : SpellAction { } } - fun teleportRespectSticky(teleportee: Entity, delta: Vec3) { + fun teleportRespectSticky(teleportee: Entity, delta: Vec3, world: ServerLevel) { val base = teleportee.rootVehicle + val target = base.position().add(delta) val playersToUpdate = mutableListOf() val indirect = base.indirectPassengers @@ -100,7 +105,6 @@ object OpTeleport : SpellAction { if (sticky) { // this handles teleporting the passengers - val target = base.position().add(delta) base.teleportTo(target.x, target.y, target.z) indirect .filterIsInstance() @@ -109,14 +113,21 @@ object OpTeleport : SpellAction { // Break it into two stacks teleportee.stopRiding() teleportee.passengers.forEach(Entity::stopRiding) - teleportee.setPos(teleportee.position().add(delta)) if (teleportee is ServerPlayer) { playersToUpdate.add(teleportee) + } else { + teleportee.setPos(teleportee.position().add(delta)) } } for (player in playersToUpdate) { + // See TeleportCommand + val chunkPos = ChunkPos(BlockPos(delta)) + // the `1` is apparently for "distance." i'm not sure what it does but this is what + // /tp does + world.chunkSource.addRegionTicket(TicketType.POST_TELEPORT, chunkPos, 1, player.id) player.connection.resetPosition() + player.setPos(target) IXplatAbstractions.INSTANCE.sendPacketToPlayer(player, MsgBlinkAck(delta)) } } diff --git a/Common/src/main/java/at/petrak/hexcasting/common/command/ListPatternsCommand.java b/Common/src/main/java/at/petrak/hexcasting/common/command/ListPatternsCommand.java index a5d75185..3114896c 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/command/ListPatternsCommand.java +++ b/Common/src/main/java/at/petrak/hexcasting/common/command/ListPatternsCommand.java @@ -22,32 +22,33 @@ import java.util.List; public class ListPatternsCommand { public static void add(LiteralArgumentBuilder cmd) { cmd.then(Commands.literal("patterns") - .requires(dp -> dp.hasPermission(Commands.LEVEL_GAMEMASTERS)) - .then(Commands.literal("list") - .executes(ctx -> list(ctx.getSource()))) - .then(Commands.literal("give") - .then(Commands.argument("patternName", PatternResLocArgument.id()) - .executes(ctx -> - giveOne(ctx.getSource(), - getDefaultTarget(ctx.getSource()), - ResourceLocationArgument.getId(ctx, "patternName"), - PatternResLocArgument.getPattern(ctx, "patternName"))) - .then(Commands.argument("targets", EntityArgument.players()) - .executes(ctx -> - giveOne(ctx.getSource(), - EntityArgument.getPlayers(ctx, "targets"), - ResourceLocationArgument.getId(ctx, "patternName"), - PatternResLocArgument.getPattern(ctx, "patternName")))))) - .then(Commands.literal("giveAll") + .requires(dp -> dp.hasPermission(Commands.LEVEL_GAMEMASTERS)) + .then(Commands.literal("list") + .executes(ctx -> list(ctx.getSource()))) + .then(Commands.literal("give") + .then(Commands.argument("patternName", PatternResLocArgument.id()) .executes(ctx -> - giveAll(ctx.getSource(), - getDefaultTarget(ctx.getSource()))) + giveOne(ctx.getSource(), + getDefaultTarget(ctx.getSource()), + ResourceLocationArgument.getId(ctx, "patternName"), + PatternResLocArgument.getPattern(ctx, "patternName"))) .then(Commands.argument("targets", EntityArgument.players()) .executes(ctx -> - giveAll(ctx.getSource(), - EntityArgument.getPlayers(ctx, "targets"))))) - ); + giveOne(ctx.getSource(), + EntityArgument.getPlayers(ctx, "targets"), + ResourceLocationArgument.getId(ctx, "patternName"), + PatternResLocArgument.getPattern(ctx, "patternName")))))) + .then(Commands.literal("giveAll") + .executes(ctx -> + giveAll(ctx.getSource(), + getDefaultTarget(ctx.getSource()))) + .then(Commands.argument("targets", EntityArgument.players()) + .executes(ctx -> + giveAll(ctx.getSource(), + EntityArgument.getPlayers(ctx, "targets"))))) + ); } + private static Collection getDefaultTarget(CommandSourceStack source) { if (source.getEntity() instanceof ServerPlayer player) { return List.of(player); @@ -78,14 +79,14 @@ public class ListPatternsCommand { if (!targets.isEmpty()) { var lookup = PatternRegistry.getPerWorldPatterns(source.getLevel()); - lookup.forEach((pattern, entry) -> { + lookup.forEach((sig, entry) -> { var opId = entry.getFirst(); var startDir = entry.getSecond(); var tag = new CompoundTag(); tag.putString(ItemScroll.TAG_OP_ID, opId.toString()); tag.put(ItemScroll.TAG_PATTERN, - HexPattern.fromAngles(pattern, startDir).serializeToNBT()); + HexPattern.fromAngles(sig, startDir).serializeToNBT()); var stack = new ItemStack(HexItems.SCROLL_LARGE); stack.setTag(tag); @@ -110,12 +111,12 @@ public class ListPatternsCommand { } } - private static int giveOne(CommandSourceStack source, Collection targets, ResourceLocation patternName, HexPattern pat) { + private static int giveOne(CommandSourceStack source, Collection targets, + ResourceLocation patternName, HexPattern pat) { if (!targets.isEmpty()) { var tag = new CompoundTag(); tag.putString(ItemScroll.TAG_OP_ID, patternName.toString()); - tag.put(ItemScroll.TAG_PATTERN, - pat.serializeToNBT()); + tag.put(ItemScroll.TAG_PATTERN, pat.serializeToNBT()); var stack = new ItemStack(HexItems.SCROLL_LARGE); stack.setTag(tag); diff --git a/Common/src/main/java/at/petrak/hexcasting/common/command/PatternResLocArgument.java b/Common/src/main/java/at/petrak/hexcasting/common/command/PatternResLocArgument.java index 6eeb4a42..baaeca6c 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/command/PatternResLocArgument.java +++ b/Common/src/main/java/at/petrak/hexcasting/common/command/PatternResLocArgument.java @@ -36,10 +36,10 @@ public class PatternResLocArgument extends ResourceLocationArgument { var targetId = ctx.getArgument(pName, ResourceLocation.class); var lookup = PatternRegistry.getPerWorldPatterns(ctx.getSource().getLevel()); HexPattern foundPat = null; - for (var key : lookup.keySet()) { - var rhs = lookup.get(key); + for (var sig : lookup.keySet()) { + var rhs = lookup.get(sig); if (rhs.getFirst().equals(targetId)) { - foundPat = HexPattern.fromAngles(key, rhs.getSecond()); + foundPat = HexPattern.fromAngles(sig, rhs.getSecond()); break; } } From 8216dd984edd0aa8e0c937566dfd48be88f75331 Mon Sep 17 00:00:00 2001 From: "petrak@" Date: Tue, 29 Nov 2022 14:25:53 -0500 Subject: [PATCH 18/95] fix #323 --- .../petrak/hexcasting/common/casting/operators/eval/OpEval.kt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/eval/OpEval.kt b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/eval/OpEval.kt index 52e87f23..191a8d3d 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/eval/OpEval.kt +++ b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/eval/OpEval.kt @@ -10,6 +10,7 @@ import at.petrak.hexcasting.api.spell.casting.eval.SpellContinuation import at.petrak.hexcasting.api.spell.evaluatable import at.petrak.hexcasting.api.spell.iota.Iota import at.petrak.hexcasting.api.spell.iota.PatternIota +import at.petrak.hexcasting.api.spell.mishaps.MishapNotEnoughArgs object OpEval : Action { override fun operate( @@ -18,7 +19,7 @@ object OpEval : Action { ravenmind: Iota?, ctx: CastingContext ): OperationResult { - val datum = stack.removeLast() + val datum = stack.getOrElse(0) { throw MishapNotEnoughArgs(1, 0) } val instrs = evaluatable(datum, 0) instrs.ifRight { From 9704ffe4cafb95bdd05730712527dcc5e1a06cc7 Mon Sep 17 00:00:00 2001 From: "petrak@" Date: Tue, 29 Nov 2022 14:28:34 -0500 Subject: [PATCH 19/95] close #307. real intelligent mistake there petra --- Fabric/src/main/resources/fabric.mod.json | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Fabric/src/main/resources/fabric.mod.json b/Fabric/src/main/resources/fabric.mod.json index 12bea0f8..a32840e5 100644 --- a/Fabric/src/main/resources/fabric.mod.json +++ b/Fabric/src/main/resources/fabric.mod.json @@ -51,9 +51,10 @@ "fabricloader": ">=0.14", "fabric": ">=0.64", "fabric-language-kotlin": ">=1.7.4+kotlin.1.6.21", - "patchouli": ">=1.19.2-77", + "cardinal-components": "~5.0.0", "paucal": "0.5.x", - "cloth-config": "8.2.x" + "cloth-config": "8.2.x", + "patchouli": ">=1.19.2-77" }, "suggests": { "gravitychanger": "0.7.21+fabric", From 949e4bb292fcc0d61c0c20872271ad9ca05a7e8d Mon Sep 17 00:00:00 2001 From: "petrak@" Date: Tue, 29 Nov 2022 15:24:44 -0500 Subject: [PATCH 20/95] fix #325 --- .../hexcasting/api/mod/HexBlockTags.java | 16 ----- .../petrak/hexcasting/api/mod/HexConfig.java | 8 ++- .../hexcasting/api/mod/HexItemTags.java | 24 -------- .../at/petrak/hexcasting/api/mod/HexTags.java | 46 ++++++++++++++ .../api/spell/casting/CastingHarness.kt | 4 +- .../hexcasting/api/spell/mishaps/Mishap.kt | 4 +- .../hexcasting/client/gui/GuiSpellcasting.kt | 4 +- .../casting/operators/spells/OpBlink.kt | 12 +++- .../casting/operators/spells/OpMakeBattery.kt | 6 +- .../operators/spells/great/OpTeleport.kt | 18 ++++-- .../hexcasting/common/lib/HexEntityTags.java | 16 ----- .../common/network/MsgNewSpellPatternSyn.java | 4 +- .../hexcasting/datagen/HexAdvancements.java | 4 +- .../datagen/HexBlockTagProvider.java | 6 +- .../datagen/HexItemTagProvider.java | 13 ++-- .../datagen/recipe/HexplatRecipes.kt | 60 +++++++++---------- .../assets/hexcasting/lang/en_us.json | 1 + .../hexcasting/fabric/FabricHexConfig.java | 10 ++++ .../fabric/interop/emi/EmiPhialRecipe.java | 7 ++- .../fabric/interop/emi/HexEMIPlugin.java | 8 +-- .../fabric/xplat/FabricXplatImpl.java | 10 ++-- .../hexcasting/forge/ForgeHexConfig.java | 32 ++++++---- .../interop/jei/PhialRecipeCategory.java | 4 +- .../forge/xplat/ForgeXplatImpl.java | 8 +-- 24 files changed, 181 insertions(+), 144 deletions(-) delete mode 100644 Common/src/main/java/at/petrak/hexcasting/api/mod/HexBlockTags.java delete mode 100644 Common/src/main/java/at/petrak/hexcasting/api/mod/HexItemTags.java create mode 100644 Common/src/main/java/at/petrak/hexcasting/api/mod/HexTags.java delete mode 100644 Common/src/main/java/at/petrak/hexcasting/common/lib/HexEntityTags.java diff --git a/Common/src/main/java/at/petrak/hexcasting/api/mod/HexBlockTags.java b/Common/src/main/java/at/petrak/hexcasting/api/mod/HexBlockTags.java deleted file mode 100644 index 05a70ad4..00000000 --- a/Common/src/main/java/at/petrak/hexcasting/api/mod/HexBlockTags.java +++ /dev/null @@ -1,16 +0,0 @@ -package at.petrak.hexcasting.api.mod; - -import net.minecraft.core.Registry; -import net.minecraft.tags.TagKey; -import net.minecraft.world.level.block.Block; - -import static at.petrak.hexcasting.api.HexAPI.modLoc; - -public class HexBlockTags { - public static final TagKey EDIFIED_LOGS = create("edified_logs"); - public static final TagKey EDIFIED_PLANKS = create("edified_planks"); - - public static TagKey create(String name) { - return TagKey.create(Registry.BLOCK_REGISTRY, modLoc(name)); - } -} diff --git a/Common/src/main/java/at/petrak/hexcasting/api/mod/HexConfig.java b/Common/src/main/java/at/petrak/hexcasting/api/mod/HexConfig.java index 2c3739fd..aec2c2ca 100644 --- a/Common/src/main/java/at/petrak/hexcasting/api/mod/HexConfig.java +++ b/Common/src/main/java/at/petrak/hexcasting/api/mod/HexConfig.java @@ -3,9 +3,11 @@ package at.petrak.hexcasting.api.mod; import at.petrak.hexcasting.api.HexAPI; import at.petrak.hexcasting.api.misc.MediaConstants; import at.petrak.hexcasting.api.misc.ScrollQuantity; +import net.minecraft.resources.ResourceKey; import net.minecraft.resources.ResourceLocation; import net.minecraft.world.item.Tier; import net.minecraft.world.item.Tiers; +import net.minecraft.world.level.Level; import java.util.List; @@ -55,6 +57,9 @@ public class HexConfig { boolean doVillagersTakeOffenseAtMindMurder(); + // fun fact, although dimension keys are a RegistryHolder, they aren't a registry, so i can't do tags + boolean canTeleportInThisDimension(ResourceKey dimension); + ScrollQuantity scrollsForLootTable(ResourceLocation lootTable); int DEFAULT_MAX_RECURSE_DEPTH = 512; @@ -67,7 +72,8 @@ public class HexConfig { List DEFAULT_SOME_SCROLL_TABLES = List.of("minecraft:chests/bastion_treasure", "minecraft:chests/shipwreck_map"); List DEFAULT_MANY_SCROLL_TABLES = List.of("minecraft:chests/stronghold_library"); - // We can't have default values for the break harvest level or if + + List DEFAULT_DIM_TP_DENYLIST = List.of("twilightforest:twilight_forest"); default Tier opBreakHarvestLevel() { return switch (this.opBreakHarvestLevelBecauseForgeThoughtItWasAGoodIdeaToImplementHarvestTiersUsingAnHonestToGodTopoSort()) { diff --git a/Common/src/main/java/at/petrak/hexcasting/api/mod/HexItemTags.java b/Common/src/main/java/at/petrak/hexcasting/api/mod/HexItemTags.java deleted file mode 100644 index 67de0a9a..00000000 --- a/Common/src/main/java/at/petrak/hexcasting/api/mod/HexItemTags.java +++ /dev/null @@ -1,24 +0,0 @@ -package at.petrak.hexcasting.api.mod; - -import net.minecraft.core.Registry; -import net.minecraft.resources.ResourceLocation; -import net.minecraft.tags.TagKey; -import net.minecraft.world.item.Item; - -import static at.petrak.hexcasting.api.HexAPI.modLoc; - -public class HexItemTags { - public static final TagKey EDIFIED_LOGS = create("edified_logs"); - public static final TagKey EDIFIED_PLANKS = create("edified_planks"); - public static final TagKey STAVES = create("staves"); - public static final TagKey PHIAL_BASE = create("phial_base"); - public static final TagKey GRANTS_ROOT_ADVANCEMENT = create("grants_root_advancement"); - - public static TagKey create(String name) { - return create(modLoc(name)); - } - - public static TagKey create(ResourceLocation id) { - return TagKey.create(Registry.ITEM_REGISTRY, id); - } -} 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 new file mode 100644 index 00000000..41df2c90 --- /dev/null +++ b/Common/src/main/java/at/petrak/hexcasting/api/mod/HexTags.java @@ -0,0 +1,46 @@ +package at.petrak.hexcasting.api.mod; + +import net.minecraft.core.Registry; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.tags.TagKey; +import net.minecraft.world.entity.EntityType; +import net.minecraft.world.item.Item; +import net.minecraft.world.level.block.Block; + +import static at.petrak.hexcasting.api.HexAPI.modLoc; + +public class HexTags { + public static final class Items { + public static final TagKey EDIFIED_LOGS = create("edified_logs"); + public static final TagKey EDIFIED_PLANKS = create("edified_planks"); + public static final TagKey STAVES = create("staves"); + public static final TagKey PHIAL_BASE = create("phial_base"); + public static final TagKey GRANTS_ROOT_ADVANCEMENT = create("grants_root_advancement"); + + public static TagKey create(String name) { + return create(modLoc(name)); + } + + public static TagKey create(ResourceLocation id) { + return TagKey.create(Registry.ITEM_REGISTRY, id); + } + } + + public static final class Blocks { + public static final TagKey EDIFIED_LOGS = create("edified_logs"); + public static final TagKey EDIFIED_PLANKS = create("edified_planks"); + + public static TagKey create(String name) { + return TagKey.create(Registry.BLOCK_REGISTRY, modLoc(name)); + } + } + + public static final class Entities { + public static final TagKey> STICKY_TELEPORTERS = create("sticky_teleporters"); + public static final TagKey> CANNOT_TELEPORT = create("cannot_teleport"); + + public static TagKey> create(String name) { + return TagKey.create(Registry.ENTITY_TYPE_REGISTRY, modLoc(name)); + } + } +} diff --git a/Common/src/main/java/at/petrak/hexcasting/api/spell/casting/CastingHarness.kt b/Common/src/main/java/at/petrak/hexcasting/api/spell/casting/CastingHarness.kt index b702d116..e3b290ab 100644 --- a/Common/src/main/java/at/petrak/hexcasting/api/spell/casting/CastingHarness.kt +++ b/Common/src/main/java/at/petrak/hexcasting/api/spell/casting/CastingHarness.kt @@ -7,8 +7,8 @@ import at.petrak.hexcasting.api.misc.DiscoveryHandlers import at.petrak.hexcasting.api.misc.FrozenColorizer import at.petrak.hexcasting.api.misc.HexDamageSources import at.petrak.hexcasting.api.mod.HexConfig -import at.petrak.hexcasting.api.mod.HexItemTags import at.petrak.hexcasting.api.mod.HexStatistics +import at.petrak.hexcasting.api.mod.HexTags import at.petrak.hexcasting.api.spell.Action import at.petrak.hexcasting.api.spell.ParticleSpray import at.petrak.hexcasting.api.spell.SpellList @@ -531,7 +531,7 @@ class CastingHarness private constructor( false } - if (casterStack.`is`(HexItemTags.STAVES) || hexHolderDrawsFromInventory) { + if (casterStack.`is`(HexTags.Items.STAVES) || hexHolderDrawsFromInventory) { val mediaSources = DiscoveryHandlers.collectMediaHolders(this) .sortedWith(Comparator(::compareMediaItem).reversed()) for (source in mediaSources) { diff --git a/Common/src/main/java/at/petrak/hexcasting/api/spell/mishaps/Mishap.kt b/Common/src/main/java/at/petrak/hexcasting/api/spell/mishaps/Mishap.kt index 5ae88624..44ee54f9 100644 --- a/Common/src/main/java/at/petrak/hexcasting/api/spell/mishaps/Mishap.kt +++ b/Common/src/main/java/at/petrak/hexcasting/api/spell/mishaps/Mishap.kt @@ -1,7 +1,7 @@ package at.petrak.hexcasting.api.spell.mishaps import at.petrak.hexcasting.api.misc.FrozenColorizer -import at.petrak.hexcasting.api.mod.HexItemTags +import at.petrak.hexcasting.api.mod.HexTags import at.petrak.hexcasting.api.spell.Action import at.petrak.hexcasting.api.spell.ParticleSpray import at.petrak.hexcasting.api.spell.casting.CastingContext @@ -61,7 +61,7 @@ abstract class Mishap : Throwable() { // Knock the player's items out of their hands val items = mutableListOf() for (hand in InteractionHand.values()) { - if (hand != ctx.castingHand || ctx.caster.getItemInHand(hand).`is`(HexItemTags.STAVES)) { + if (hand != ctx.castingHand || ctx.caster.getItemInHand(hand).`is`(HexTags.Items.STAVES)) { items.add(ctx.caster.getItemInHand(hand).copy()) ctx.caster.setItemInHand(hand, ItemStack.EMPTY) } diff --git a/Common/src/main/java/at/petrak/hexcasting/client/gui/GuiSpellcasting.kt b/Common/src/main/java/at/petrak/hexcasting/client/gui/GuiSpellcasting.kt index 13aa080e..fc50f9e8 100644 --- a/Common/src/main/java/at/petrak/hexcasting/client/gui/GuiSpellcasting.kt +++ b/Common/src/main/java/at/petrak/hexcasting/client/gui/GuiSpellcasting.kt @@ -2,7 +2,7 @@ package at.petrak.hexcasting.client.gui import at.petrak.hexcasting.api.misc.DiscoveryHandlers import at.petrak.hexcasting.api.mod.HexConfig -import at.petrak.hexcasting.api.mod.HexItemTags +import at.petrak.hexcasting.api.mod.HexTags import at.petrak.hexcasting.api.spell.casting.ControllerInfo import at.petrak.hexcasting.api.spell.casting.ResolvedPattern import at.petrak.hexcasting.api.spell.casting.ResolvedPatternType @@ -112,7 +112,7 @@ class GuiSpellcasting constructor( val player = minecraft.player if (player != null) { val heldItem = player.getItemInHand(handOpenedWith) - if (heldItem.isEmpty || !heldItem.`is`(HexItemTags.STAVES)) + if (heldItem.isEmpty || !heldItem.`is`(HexTags.Items.STAVES)) onClose() } } diff --git a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/spells/OpBlink.kt b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/spells/OpBlink.kt index 3ef6fd0b..12366502 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/spells/OpBlink.kt +++ b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/spells/OpBlink.kt @@ -1,13 +1,14 @@ package at.petrak.hexcasting.common.casting.operators.spells 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.spell.* import at.petrak.hexcasting.api.spell.casting.CastingContext import at.petrak.hexcasting.api.spell.iota.Iota import at.petrak.hexcasting.api.spell.mishaps.MishapImmuneEntity import at.petrak.hexcasting.api.spell.mishaps.MishapLocationTooFarAway import at.petrak.hexcasting.common.casting.operators.spells.great.OpTeleport -import at.petrak.hexcasting.common.lib.HexEntityTags import net.minecraft.world.entity.Entity import kotlin.math.roundToInt @@ -21,17 +22,21 @@ object OpBlink : SpellAction { val delta = args.getDouble(1, argc) ctx.assertEntityInRange(target) - if (!target.canChangeDimensions() || target.type.`is`(HexEntityTags.CANNOT_TELEPORT)) + if (!target.canChangeDimensions() || target.type.`is`(HexTags.Entities.CANNOT_TELEPORT)) throw MishapImmuneEntity(target) val dvec = target.lookAngle.scale(delta) val endPos = target.position().add(dvec) + if (!HexConfig.server().canTeleportInThisDimension(ctx.world.dimension())) + throw MishapLocationTooFarAway(endPos, "bad_dimension") + ctx.assertVecInRange(target.position()) ctx.assertVecInRange(endPos) if (!ctx.isVecInWorld(endPos.subtract(0.0, 1.0, 0.0))) throw MishapLocationTooFarAway(endPos, "too_close_to_out") + val targetMiddlePos = target.position().add(0.0, target.eyeHeight / 2.0, 0.0) return Triple( @@ -46,6 +51,9 @@ object OpBlink : SpellAction { private data class Spell(val target: Entity, val delta: Double) : RenderedSpell { override fun cast(ctx: CastingContext) { + if (!HexConfig.server().canTeleportInThisDimension(ctx.world.dimension())) + return + val delta = target.lookAngle.scale(delta) OpTeleport.teleportRespectSticky(target, delta, ctx.world) } 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 0d2e4f6d..12f5ccc8 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,7 @@ package at.petrak.hexcasting.common.casting.operators.spells import at.petrak.hexcasting.api.misc.MediaConstants -import at.petrak.hexcasting.api.mod.HexItemTags +import at.petrak.hexcasting.api.mod.HexTags import at.petrak.hexcasting.api.spell.ParticleSpray import at.petrak.hexcasting.api.spell.RenderedSpell import at.petrak.hexcasting.api.spell.SpellAction @@ -29,9 +29,9 @@ object OpMakeBattery : SpellAction { ): Triple> { val entity = args.getItemEntity(0, argc) - val (handStack, hand) = ctx.getHeldItemToOperateOn { it.`is`(HexItemTags.PHIAL_BASE) } + val (handStack, hand) = ctx.getHeldItemToOperateOn { it.`is`(HexTags.Items.PHIAL_BASE) } - if (!handStack.`is`(HexItemTags.PHIAL_BASE)) { + if (!handStack.`is`(HexTags.Items.PHIAL_BASE)) { throw MishapBadOffhandItem.of( handStack, hand, 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 6389cdd6..1e27e3ea 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,12 +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.spell.* import at.petrak.hexcasting.api.spell.casting.CastingContext import at.petrak.hexcasting.api.spell.iota.Iota import at.petrak.hexcasting.api.spell.mishaps.MishapImmuneEntity import at.petrak.hexcasting.api.spell.mishaps.MishapLocationTooFarAway -import at.petrak.hexcasting.common.lib.HexEntityTags import at.petrak.hexcasting.common.network.MsgBlinkAck import at.petrak.hexcasting.xplat.IXplatAbstractions import net.minecraft.core.BlockPos @@ -27,18 +28,23 @@ object OpTeleport : SpellAction { args: List, ctx: CastingContext ): Triple> { + val teleportee = args.getEntity(0, argc) val delta = args.getVec3(1, argc) ctx.assertEntityInRange(teleportee) - if (!teleportee.canChangeDimensions() || teleportee.type.`is`(HexEntityTags.CANNOT_TELEPORT)) + if (!teleportee.canChangeDimensions() || teleportee.type.`is`(HexTags.Entities.CANNOT_TELEPORT)) throw MishapImmuneEntity(teleportee) val targetPos = teleportee.position().add(delta) + if (!HexConfig.server().canTeleportInThisDimension(ctx.world.dimension())) + throw MishapLocationTooFarAway(targetPos, "bad_dimension") + ctx.assertVecInWorld(targetPos) if (!ctx.isVecInWorld(targetPos.subtract(0.0, 1.0, 0.0))) throw MishapLocationTooFarAway(targetPos, "too_close_to_out") + val targetMiddlePos = teleportee.position().add(0.0, teleportee.eyeHeight / 2.0, 0.0) @@ -92,14 +98,18 @@ object OpTeleport : SpellAction { } fun teleportRespectSticky(teleportee: Entity, delta: Vec3, world: ServerLevel) { + if (!HexConfig.server().canTeleportInThisDimension(world.dimension())) { + return + } + val base = teleportee.rootVehicle val target = base.position().add(delta) val playersToUpdate = mutableListOf() val indirect = base.indirectPassengers - val sticky = indirect.any { it.type.`is`(HexEntityTags.STICKY_TELEPORTERS) } - val cannotSticky = indirect.none { it.type.`is`(HexEntityTags.CANNOT_TELEPORT) } + val sticky = indirect.any { it.type.`is`(HexTags.Entities.STICKY_TELEPORTERS) } + val cannotSticky = indirect.none { it.type.`is`(HexTags.Entities.CANNOT_TELEPORT) } if (sticky && cannotSticky) return diff --git a/Common/src/main/java/at/petrak/hexcasting/common/lib/HexEntityTags.java b/Common/src/main/java/at/petrak/hexcasting/common/lib/HexEntityTags.java deleted file mode 100644 index f7980b9e..00000000 --- a/Common/src/main/java/at/petrak/hexcasting/common/lib/HexEntityTags.java +++ /dev/null @@ -1,16 +0,0 @@ -package at.petrak.hexcasting.common.lib; - -import net.minecraft.core.Registry; -import net.minecraft.tags.TagKey; -import net.minecraft.world.entity.EntityType; - -import static at.petrak.hexcasting.api.HexAPI.modLoc; - -public class HexEntityTags { - public static final TagKey> STICKY_TELEPORTERS = create("sticky_teleporters"); - public static final TagKey> CANNOT_TELEPORT = create("cannot_teleport"); - - public static TagKey> create(String name) { - return TagKey.create(Registry.ENTITY_TYPE_REGISTRY, modLoc(name)); - } -} diff --git a/Common/src/main/java/at/petrak/hexcasting/common/network/MsgNewSpellPatternSyn.java b/Common/src/main/java/at/petrak/hexcasting/common/network/MsgNewSpellPatternSyn.java index 5e580312..08736209 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/network/MsgNewSpellPatternSyn.java +++ b/Common/src/main/java/at/petrak/hexcasting/common/network/MsgNewSpellPatternSyn.java @@ -1,7 +1,7 @@ package at.petrak.hexcasting.common.network; -import at.petrak.hexcasting.api.mod.HexItemTags; import at.petrak.hexcasting.api.mod.HexStatistics; +import at.petrak.hexcasting.api.mod.HexTags; import at.petrak.hexcasting.api.spell.casting.ControllerInfo; import at.petrak.hexcasting.api.spell.casting.ResolvedPattern; import at.petrak.hexcasting.api.spell.casting.ResolvedPatternType; @@ -62,7 +62,7 @@ public record MsgNewSpellPatternSyn(InteractionHand handUsed, HexPattern pattern server.execute(() -> { // TODO: should we maybe not put tons of logic in a packet class var held = sender.getItemInHand(this.handUsed); - if (held.is(HexItemTags.STAVES)) { + if (held.is(HexTags.Items.STAVES)) { boolean autoFail = false; if (!resolvedPatterns.isEmpty()) { diff --git a/Common/src/main/java/at/petrak/hexcasting/datagen/HexAdvancements.java b/Common/src/main/java/at/petrak/hexcasting/datagen/HexAdvancements.java index 9f220aa5..4cfd011f 100644 --- a/Common/src/main/java/at/petrak/hexcasting/datagen/HexAdvancements.java +++ b/Common/src/main/java/at/petrak/hexcasting/datagen/HexAdvancements.java @@ -5,7 +5,7 @@ import at.petrak.hexcasting.api.advancements.FailToCastGreatSpellTrigger; import at.petrak.hexcasting.api.advancements.OvercastTrigger; import at.petrak.hexcasting.api.advancements.SpendMediaTrigger; import at.petrak.hexcasting.api.misc.MediaConstants; -import at.petrak.hexcasting.api.mod.HexItemTags; +import at.petrak.hexcasting.api.mod.HexTags; import at.petrak.hexcasting.common.items.ItemLoreFragment; import at.petrak.hexcasting.common.lib.HexBlocks; import at.petrak.hexcasting.common.lib.HexItems; @@ -39,7 +39,7 @@ public class HexAdvancements extends PaucalAdvancementProvider { FrameType.TASK, true, true, true)) // the only thing making this vaguely tolerable is the knowledge the json files are worse somehow .addCriterion("has_charged_amethyst", InventoryChangeTrigger.TriggerInstance.hasItems( - ItemPredicate.Builder.item().of(HexItemTags.GRANTS_ROOT_ADVANCEMENT).build())) + ItemPredicate.Builder.item().of(HexTags.Items.GRANTS_ROOT_ADVANCEMENT).build())) .save(consumer, prefix("root")); // how the hell does one even read this // weird names so we have alphabetical parity diff --git a/Common/src/main/java/at/petrak/hexcasting/datagen/HexBlockTagProvider.java b/Common/src/main/java/at/petrak/hexcasting/datagen/HexBlockTagProvider.java index 3c3dc87b..263b90f1 100644 --- a/Common/src/main/java/at/petrak/hexcasting/datagen/HexBlockTagProvider.java +++ b/Common/src/main/java/at/petrak/hexcasting/datagen/HexBlockTagProvider.java @@ -1,6 +1,6 @@ package at.petrak.hexcasting.datagen; -import at.petrak.hexcasting.api.mod.HexBlockTags; +import at.petrak.hexcasting.api.mod.HexTags; import at.petrak.hexcasting.common.lib.HexBlocks; import at.petrak.hexcasting.xplat.IXplatTags; import at.petrak.paucal.api.datagen.PaucalBlockTagProvider; @@ -43,7 +43,7 @@ public class HexBlockTagProvider extends PaucalBlockTagProvider { .add(HexBlocks.CONJURED_LIGHT, HexBlocks.CONJURED_BLOCK, HexBlocks.AMETHYST_TILES, HexBlocks.SCONCE); - tag(HexBlockTags.EDIFIED_LOGS) + tag(HexTags.Blocks.EDIFIED_LOGS) .add(HexBlocks.EDIFIED_LOG, HexBlocks.STRIPPED_EDIFIED_LOG, HexBlocks.EDIFIED_WOOD, HexBlocks.STRIPPED_EDIFIED_WOOD); tag(BlockTags.LOGS) @@ -58,7 +58,7 @@ public class HexBlockTagProvider extends PaucalBlockTagProvider { tag(BlockTags.PLANKS) .add(HexBlocks.EDIFIED_PLANKS, HexBlocks.EDIFIED_PANEL, HexBlocks.EDIFIED_TILE); - tag(HexBlockTags.EDIFIED_PLANKS) + tag(HexTags.Blocks.EDIFIED_PLANKS) .add(HexBlocks.EDIFIED_PLANKS, HexBlocks.EDIFIED_PANEL, HexBlocks.EDIFIED_TILE); tag(BlockTags.SLABS) .add(HexBlocks.EDIFIED_SLAB); diff --git a/Common/src/main/java/at/petrak/hexcasting/datagen/HexItemTagProvider.java b/Common/src/main/java/at/petrak/hexcasting/datagen/HexItemTagProvider.java index ccabb887..4a724b61 100644 --- a/Common/src/main/java/at/petrak/hexcasting/datagen/HexItemTagProvider.java +++ b/Common/src/main/java/at/petrak/hexcasting/datagen/HexItemTagProvider.java @@ -1,7 +1,6 @@ package at.petrak.hexcasting.datagen; -import at.petrak.hexcasting.api.mod.HexBlockTags; -import at.petrak.hexcasting.api.mod.HexItemTags; +import at.petrak.hexcasting.api.mod.HexTags; import at.petrak.hexcasting.common.lib.HexItems; import at.petrak.hexcasting.xplat.IXplatTags; import at.petrak.paucal.api.datagen.PaucalItemTagProvider; @@ -25,17 +24,17 @@ public class HexItemTagProvider extends PaucalItemTagProvider { tag(xtags.gems()).add(HexItems.CHARGED_AMETHYST); tag(xtags.amethystDust()).add(HexItems.AMETHYST_DUST); - tag(HexItemTags.STAVES).add(HexItems.STAFF_EDIFIED, + tag(HexTags.Items.STAVES).add(HexItems.STAFF_EDIFIED, HexItems.STAFF_OAK, HexItems.STAFF_SPRUCE, HexItems.STAFF_BIRCH, HexItems.STAFF_JUNGLE, HexItems.STAFF_ACACIA, HexItems.STAFF_DARK_OAK, HexItems.STAFF_CRIMSON, HexItems.STAFF_WARPED); - tag(HexItemTags.PHIAL_BASE).add(Items.GLASS_BOTTLE); - tag(HexItemTags.GRANTS_ROOT_ADVANCEMENT).add(HexItems.AMETHYST_DUST, Items.AMETHYST_SHARD, + tag(HexTags.Items.PHIAL_BASE).add(Items.GLASS_BOTTLE); + tag(HexTags.Items.GRANTS_ROOT_ADVANCEMENT).add(HexItems.AMETHYST_DUST, Items.AMETHYST_SHARD, HexItems.CHARGED_AMETHYST); - this.copy(HexBlockTags.EDIFIED_LOGS, HexItemTags.EDIFIED_LOGS); - this.copy(HexBlockTags.EDIFIED_PLANKS, HexItemTags.EDIFIED_PLANKS); + this.copy(HexTags.Blocks.EDIFIED_LOGS, HexTags.Items.EDIFIED_LOGS); + this.copy(HexTags.Blocks.EDIFIED_PLANKS, HexTags.Items.EDIFIED_PLANKS); this.copy(BlockTags.LOGS_THAT_BURN, ItemTags.LOGS_THAT_BURN); this.copy(BlockTags.LOGS, ItemTags.LOGS); this.copy(BlockTags.PLANKS, ItemTags.PLANKS); diff --git a/Common/src/main/java/at/petrak/hexcasting/datagen/recipe/HexplatRecipes.kt b/Common/src/main/java/at/petrak/hexcasting/datagen/recipe/HexplatRecipes.kt index aa1cbc80..90452e02 100644 --- a/Common/src/main/java/at/petrak/hexcasting/datagen/recipe/HexplatRecipes.kt +++ b/Common/src/main/java/at/petrak/hexcasting/datagen/recipe/HexplatRecipes.kt @@ -2,7 +2,7 @@ package at.petrak.hexcasting.datagen.recipe import at.petrak.hexcasting.api.HexAPI import at.petrak.hexcasting.api.advancements.OvercastTrigger -import at.petrak.hexcasting.api.mod.HexItemTags +import at.petrak.hexcasting.api.mod.HexTags import at.petrak.hexcasting.common.items.ItemStaff import at.petrak.hexcasting.common.items.colorizer.ItemPrideColorizer import at.petrak.hexcasting.common.lib.HexBlocks @@ -59,7 +59,7 @@ class HexplatRecipes( ingredients.glowstoneDust(), ingredients.leather(), Ingredient.of(HexItems.CHARGED_AMETHYST)) - .unlockedBy("has_item", hasItem(HexItemTags.STAVES)) + .unlockedBy("has_item", hasItem(HexTags.Items.STAVES)) .save(recipes) ShapedRecipeBuilder.shaped(HexItems.SPELLBOOK) @@ -78,13 +78,13 @@ class HexplatRecipes( HexItems.CYPHER, 1, ingredients.copperIngot(), Ingredient.of(HexItems.AMETHYST_DUST)) - .unlockedBy("has_item", hasItem(HexItemTags.STAVES)).save(recipes) + .unlockedBy("has_item", hasItem(HexTags.Items.STAVES)).save(recipes) ringCornerless( HexItems.TRINKET, 1, ingredients.ironIngot(), Ingredient.of(Items.AMETHYST_SHARD)) - .unlockedBy("has_item", hasItem(HexItemTags.STAVES)).save(recipes) + .unlockedBy("has_item", hasItem(HexTags.Items.STAVES)).save(recipes) ShapedRecipeBuilder.shaped(HexItems.ARTIFACT) .define('F', ingredients.goldIngot()) @@ -94,10 +94,10 @@ class HexplatRecipes( .pattern(" F ") .pattern("FAF") .pattern(" D ") - .unlockedBy("has_item", hasItem(HexItemTags.STAVES)).save(recipes) + .unlockedBy("has_item", hasItem(HexTags.Items.STAVES)).save(recipes) ringCornerless(HexItems.SCRYING_LENS, 1, Items.GLASS, HexItems.AMETHYST_DUST) - .unlockedBy("has_item", hasItem(HexItemTags.STAVES)).save(recipes) + .unlockedBy("has_item", hasItem(HexTags.Items.STAVES)).save(recipes) ShapedRecipeBuilder.shaped(HexItems.ABACUS) .define('S', Items.STICK) @@ -106,7 +106,7 @@ class HexplatRecipes( .pattern("WAW") .pattern("SAS") .pattern("WAW") - .unlockedBy("has_item", hasItem(HexItemTags.STAVES)).save(recipes) + .unlockedBy("has_item", hasItem(HexTags.Items.STAVES)).save(recipes) // Why am I like this ShapedRecipeBuilder.shaped(HexItems.SUBMARINE_SANDWICH) @@ -246,8 +246,8 @@ class HexplatRecipes( .unlockedBy("has_item", hasItem(HexItems.CHARGED_AMETHYST)).save(recipes) ShapelessRecipeBuilder.shapeless(HexBlocks.EDIFIED_PLANKS, 4) - .requires(HexItemTags.EDIFIED_LOGS) - .unlockedBy("has_item", hasItem(HexItemTags.EDIFIED_LOGS)).save(recipes) + .requires(HexTags.Items.EDIFIED_LOGS) + .unlockedBy("has_item", hasItem(HexTags.Items.EDIFIED_LOGS)).save(recipes) ShapedRecipeBuilder.shaped(HexBlocks.EDIFIED_WOOD, 3) .define('W', HexBlocks.EDIFIED_LOG) @@ -262,49 +262,49 @@ class HexplatRecipes( .unlockedBy("has_item", hasItem(HexBlocks.STRIPPED_EDIFIED_LOG)).save(recipes) ring(HexBlocks.EDIFIED_PANEL, 8, - HexItemTags.EDIFIED_PLANKS, null) - .unlockedBy("has_item", hasItem(HexItemTags.EDIFIED_PLANKS)).save(recipes) + HexTags.Items.EDIFIED_PLANKS, null) + .unlockedBy("has_item", hasItem(HexTags.Items.EDIFIED_PLANKS)).save(recipes) ShapedRecipeBuilder.shaped(HexBlocks.EDIFIED_TILE, 6) - .define('W', HexItemTags.EDIFIED_PLANKS) + .define('W', HexTags.Items.EDIFIED_PLANKS) .pattern("WW ") .pattern("W W") .pattern(" WW") - .unlockedBy("has_item", hasItem(HexItemTags.EDIFIED_PLANKS)).save(recipes) + .unlockedBy("has_item", hasItem(HexTags.Items.EDIFIED_PLANKS)).save(recipes) ShapedRecipeBuilder.shaped(HexBlocks.EDIFIED_DOOR, 3) - .define('W', HexItemTags.EDIFIED_PLANKS) + .define('W', HexTags.Items.EDIFIED_PLANKS) .pattern("WW") .pattern("WW") .pattern("WW") - .unlockedBy("has_item", hasItem(HexItemTags.EDIFIED_PLANKS)).save(recipes) + .unlockedBy("has_item", hasItem(HexTags.Items.EDIFIED_PLANKS)).save(recipes) ShapedRecipeBuilder.shaped(HexBlocks.EDIFIED_TRAPDOOR, 2) - .define('W', HexItemTags.EDIFIED_PLANKS) + .define('W', HexTags.Items.EDIFIED_PLANKS) .pattern("WWW") .pattern("WWW") - .unlockedBy("has_item", hasItem(HexItemTags.EDIFIED_PLANKS)).save(recipes) + .unlockedBy("has_item", hasItem(HexTags.Items.EDIFIED_PLANKS)).save(recipes) ShapedRecipeBuilder.shaped(HexBlocks.EDIFIED_STAIRS, 4) - .define('W', HexItemTags.EDIFIED_PLANKS) + .define('W', HexTags.Items.EDIFIED_PLANKS) .pattern("W ") .pattern("WW ") .pattern("WWW") - .unlockedBy("has_item", hasItem(HexItemTags.EDIFIED_PLANKS)).save(recipes) + .unlockedBy("has_item", hasItem(HexTags.Items.EDIFIED_PLANKS)).save(recipes) ShapedRecipeBuilder.shaped(HexBlocks.EDIFIED_SLAB, 6) - .define('W', HexItemTags.EDIFIED_PLANKS) + .define('W', HexTags.Items.EDIFIED_PLANKS) .pattern("WWW") - .unlockedBy("has_item", hasItem(HexItemTags.EDIFIED_PLANKS)).save(recipes) + .unlockedBy("has_item", hasItem(HexTags.Items.EDIFIED_PLANKS)).save(recipes) ShapedRecipeBuilder.shaped(HexBlocks.EDIFIED_PRESSURE_PLATE, 1) - .define('W', HexItemTags.EDIFIED_PLANKS) + .define('W', HexTags.Items.EDIFIED_PLANKS) .pattern("WW") - .unlockedBy("has_item", hasItem(HexItemTags.EDIFIED_PLANKS)).save(recipes) + .unlockedBy("has_item", hasItem(HexTags.Items.EDIFIED_PLANKS)).save(recipes) ShapelessRecipeBuilder.shapeless(HexBlocks.EDIFIED_BUTTON) - .requires(HexItemTags.EDIFIED_PLANKS) - .unlockedBy("has_item", hasItem(HexItemTags.EDIFIED_PLANKS)).save(recipes) + .requires(HexTags.Items.EDIFIED_PLANKS) + .unlockedBy("has_item", hasItem(HexTags.Items.EDIFIED_PLANKS)).save(recipes) val enlightenment = OvercastTrigger.Instance( EntityPredicate.Composite.ANY, @@ -333,17 +333,17 @@ class HexplatRecipes( .unlockedBy("enlightenment", enlightenment).save(recipes) ShapedRecipeBuilder.shaped(HexBlocks.AKASHIC_BOOKSHELF) - .define('L', HexItemTags.EDIFIED_LOGS) - .define('P', HexItemTags.EDIFIED_PLANKS) + .define('L', HexTags.Items.EDIFIED_LOGS) + .define('P', HexTags.Items.EDIFIED_PLANKS) .define('C', Items.BOOK) - /*this is the*/ .pattern("LPL") // and what i have for you today is + /*this is the*/.pattern("LPL") // and what i have for you today is .pattern("CCC") .pattern("LPL") .unlockedBy("enlightenment", enlightenment).save(recipes) ShapedRecipeBuilder.shaped(HexBlocks.AKASHIC_LIGATURE) - .define('L', HexItemTags.EDIFIED_LOGS) - .define('P', HexItemTags.EDIFIED_PLANKS) + .define('L', HexTags.Items.EDIFIED_LOGS) + .define('P', HexTags.Items.EDIFIED_PLANKS) .define('C', HexItems.CHARGED_AMETHYST) .pattern("LPL") .pattern("CCC") diff --git a/Common/src/main/resources/assets/hexcasting/lang/en_us.json b/Common/src/main/resources/assets/hexcasting/lang/en_us.json index 24106279..22e3c130 100644 --- a/Common/src/main/resources/assets/hexcasting/lang/en_us.json +++ b/Common/src/main/resources/assets/hexcasting/lang/en_us.json @@ -538,6 +538,7 @@ "hexcasting.mishap.location_too_far": "%s is out of range for %s", "hexcasting.mishap.location_out_of_world": "%s is not within the world", "hexcasting.mishap.location_too_close_to_out": "%s is too close to the boundary of the world", + "hexcasting.mishap.location_bad_dimension": "It is impossible to teleport in this dimension", "hexcasting.mishap.wrong_dimension": "%s cannot see %s from %s", "hexcasting.mishap.entity_too_far": "%s is out of range for %s", "hexcasting.mishap.immune_entity": "%s cannot alter %s", diff --git a/Fabric/src/main/java/at/petrak/hexcasting/fabric/FabricHexConfig.java b/Fabric/src/main/java/at/petrak/hexcasting/fabric/FabricHexConfig.java index 82c895f7..92fe6ead 100644 --- a/Fabric/src/main/java/at/petrak/hexcasting/fabric/FabricHexConfig.java +++ b/Fabric/src/main/java/at/petrak/hexcasting/fabric/FabricHexConfig.java @@ -10,8 +10,10 @@ import me.shedaniel.autoconfig.annotation.Config; import me.shedaniel.autoconfig.annotation.ConfigEntry; import me.shedaniel.autoconfig.serializer.JanksonConfigSerializer; import me.shedaniel.autoconfig.serializer.PartitioningSerializer; +import net.minecraft.resources.ResourceKey; import net.minecraft.resources.ResourceLocation; import net.minecraft.util.Mth; +import net.minecraft.world.level.Level; import java.util.List; @@ -140,6 +142,9 @@ public class FabricHexConfig extends PartitioningSerializer.GlobalData { @ConfigEntry.Gui.Tooltip private boolean villagersOffendedByMindMurder = DEFAULT_VILLAGERS_DISLIKE_MIND_MURDER; + @ConfigEntry.Gui.Tooltip + private List tpDimDenylist = DEFAULT_DIM_TP_DENYLIST; + @ConfigEntry.Gui.Tooltip private List fewScrollTables = DEFAULT_FEW_SCROLL_TABLES; @ConfigEntry.Gui.Tooltip @@ -183,6 +188,11 @@ public class FabricHexConfig extends PartitioningSerializer.GlobalData { return villagersOffendedByMindMurder; } + @Override + public boolean canTeleportInThisDimension(ResourceKey dimension) { + return noneMatch(manyScrollTables, dimension.location()); + } + @Override public ScrollQuantity scrollsForLootTable(ResourceLocation lootTable) { if (anyMatch(fewScrollTables, lootTable)) { diff --git a/Fabric/src/main/java/at/petrak/hexcasting/fabric/interop/emi/EmiPhialRecipe.java b/Fabric/src/main/java/at/petrak/hexcasting/fabric/interop/emi/EmiPhialRecipe.java index 80e3c634..9e897f28 100644 --- a/Fabric/src/main/java/at/petrak/hexcasting/fabric/interop/emi/EmiPhialRecipe.java +++ b/Fabric/src/main/java/at/petrak/hexcasting/fabric/interop/emi/EmiPhialRecipe.java @@ -1,6 +1,6 @@ package at.petrak.hexcasting.fabric.interop.emi; -import at.petrak.hexcasting.api.mod.HexItemTags; +import at.petrak.hexcasting.api.mod.HexTags; import at.petrak.hexcasting.interop.utils.PhialRecipeStackBuilder; import dev.emi.emi.EmiUtil; import dev.emi.emi.api.recipe.EmiRecipe; @@ -28,7 +28,7 @@ public class EmiPhialRecipe implements EmiRecipe { public EmiPhialRecipe() { var stacks = PhialRecipeStackBuilder.createStacks(); this.inputs = EmiIngredient.of(stacks.getFirst().stream().map(EmiStack::of).collect(Collectors.toList())); - this.bottle = EmiIngredient.of(HexItemTags.PHIAL_BASE); + this.bottle = EmiIngredient.of(HexTags.Items.PHIAL_BASE); this.outputs = EmiIngredient.of(stacks.getSecond().stream().map(EmiStack::of).collect(Collectors.toList())); } @@ -69,7 +69,8 @@ public class EmiPhialRecipe implements EmiRecipe { @Override public void addWidgets(WidgetHolder widgets) { - widgets.addTexture(OVERLAY, 0, 0, getDisplayWidth(), getDisplayHeight(), 0, 0, getDisplayWidth(), getDisplayHeight(), 128, 128); + widgets.addTexture(OVERLAY, 0, 0, getDisplayWidth(), getDisplayHeight(), 0, 0, getDisplayWidth(), + getDisplayHeight(), 128, 128); widgets.addGeneratedSlot((r) -> { var stacks = inputs.getEmiStacks(); return stacks.get(r.nextInt(stacks.size())); diff --git a/Fabric/src/main/java/at/petrak/hexcasting/fabric/interop/emi/HexEMIPlugin.java b/Fabric/src/main/java/at/petrak/hexcasting/fabric/interop/emi/HexEMIPlugin.java index a24d5c26..8da6b496 100644 --- a/Fabric/src/main/java/at/petrak/hexcasting/fabric/interop/emi/HexEMIPlugin.java +++ b/Fabric/src/main/java/at/petrak/hexcasting/fabric/interop/emi/HexEMIPlugin.java @@ -1,6 +1,6 @@ package at.petrak.hexcasting.fabric.interop.emi; -import at.petrak.hexcasting.api.mod.HexItemTags; +import at.petrak.hexcasting.api.mod.HexTags; import at.petrak.hexcasting.common.recipe.BrainsweepRecipe; import at.petrak.hexcasting.common.recipe.HexRecipeStuffRegistry; import at.petrak.hexcasting.common.recipe.ingredient.VillagerIngredient; @@ -65,9 +65,9 @@ public class HexEMIPlugin implements EmiPlugin { registry.addCategory(EDIFY); registry.addCategory(VILLAGER_LEVELING); registry.addCategory(VILLAGER_PROFESSION); - registry.addWorkstation(BRAINSWEEP, EmiIngredient.of(HexItemTags.STAVES)); - registry.addWorkstation(PHIAL, EmiIngredient.of(HexItemTags.STAVES)); - registry.addWorkstation(EDIFY, EmiIngredient.of(HexItemTags.STAVES)); + registry.addWorkstation(BRAINSWEEP, EmiIngredient.of(HexTags.Items.STAVES)); + registry.addWorkstation(PHIAL, EmiIngredient.of(HexTags.Items.STAVES)); + registry.addWorkstation(EDIFY, EmiIngredient.of(HexTags.Items.STAVES)); for (BrainsweepRecipe recipe : registry.getRecipeManager() .getAllRecipesFor(HexRecipeStuffRegistry.BRAINSWEEP_TYPE)) { diff --git a/Fabric/src/main/java/at/petrak/hexcasting/fabric/xplat/FabricXplatImpl.java b/Fabric/src/main/java/at/petrak/hexcasting/fabric/xplat/FabricXplatImpl.java index 1515f1fd..7f3399d9 100644 --- a/Fabric/src/main/java/at/petrak/hexcasting/fabric/xplat/FabricXplatImpl.java +++ b/Fabric/src/main/java/at/petrak/hexcasting/fabric/xplat/FabricXplatImpl.java @@ -6,7 +6,7 @@ import at.petrak.hexcasting.api.addldata.ADIotaHolder; import at.petrak.hexcasting.api.addldata.ADMediaHolder; import at.petrak.hexcasting.api.misc.FrozenColorizer; import at.petrak.hexcasting.api.mod.HexConfig; -import at.petrak.hexcasting.api.mod.HexItemTags; +import at.petrak.hexcasting.api.mod.HexTags; import at.petrak.hexcasting.api.player.FlightAbility; import at.petrak.hexcasting.api.player.Sentinel; import at.petrak.hexcasting.api.spell.casting.CastingHarness; @@ -261,7 +261,7 @@ public class FabricXplatImpl implements IXplatAbstractions { @Override public BlockEntityType createBlockEntityType(BiFunction func, - Block... blocks) { + Block... blocks) { return FabricBlockEntityTypeBuilder.create(func::apply, blocks).build(); } @@ -377,12 +377,12 @@ public class FabricXplatImpl implements IXplatAbstractions { private static final IXplatTags TAGS = new IXplatTags() { @Override public TagKey amethystDust() { - return HexItemTags.create(new ResourceLocation("c", "amethyst_dusts")); + return HexTags.Items.create(new ResourceLocation("c", "amethyst_dusts")); } @Override public TagKey gems() { - return HexItemTags.create(new ResourceLocation("c", "gems")); + return HexTags.Items.create(new ResourceLocation("c", "gems")); } }; @@ -396,7 +396,7 @@ public class FabricXplatImpl implements IXplatAbstractions { return AlternativeLootItemCondition.alternative( MatchTool.toolMatches(ItemPredicate.Builder.item().of(Items.SHEARS)), MatchTool.toolMatches(ItemPredicate.Builder.item().of( - HexItemTags.create(new ResourceLocation("c", "shears")))) + HexTags.Items.create(new ResourceLocation("c", "shears")))) ); } diff --git a/Forge/src/main/java/at/petrak/hexcasting/forge/ForgeHexConfig.java b/Forge/src/main/java/at/petrak/hexcasting/forge/ForgeHexConfig.java index d58fb684..a0dcd13c 100644 --- a/Forge/src/main/java/at/petrak/hexcasting/forge/ForgeHexConfig.java +++ b/Forge/src/main/java/at/petrak/hexcasting/forge/ForgeHexConfig.java @@ -2,7 +2,9 @@ package at.petrak.hexcasting.forge; import at.petrak.hexcasting.api.misc.ScrollQuantity; import at.petrak.hexcasting.api.mod.HexConfig; +import net.minecraft.resources.ResourceKey; import net.minecraft.resources.ResourceLocation; +import net.minecraft.world.level.Level; import net.minecraftforge.common.ForgeConfigSpec; import java.util.List; @@ -104,10 +106,13 @@ public class ForgeHexConfig implements HexConfig.CommonConfigAccess { private static ForgeConfigSpec.BooleanValue villagersOffendedByMindMurder; + private static ForgeConfigSpec.ConfigValue> tpDimDenyList; + private static ForgeConfigSpec.ConfigValue> fewScrollTables; private static ForgeConfigSpec.ConfigValue> someScrollTables; private static ForgeConfigSpec.ConfigValue> manyScrollTables; + public Server(ForgeConfigSpec.Builder builder) { builder.push("Spells"); maxRecurseDepth = builder.comment("How many times a spell can recursively cast other spells") @@ -125,33 +130,31 @@ public class ForgeHexConfig implements HexConfig.CommonConfigAccess { circleActionDenyList = builder.comment( "Resource locations of disallowed actions within circles. Trying to cast one of these in a circle" + " will result in a mishap.") - .defineList("circleActionDenyList", List.of(), - obj -> obj instanceof String s && ResourceLocation.isValidResourceLocation(s)); + .defineList("circleActionDenyList", List.of(), Server::isValidReslocArg); builder.pop(); actionDenyList = builder.comment( "Resource locations of disallowed actions. Trying to cast one of these will result in a mishap.") - .defineList("actionDenyList", List.of(), - obj -> obj instanceof String s && ResourceLocation.isValidResourceLocation(s)); + .defineList("actionDenyList", List.of(), Server::isValidReslocArg); villagersOffendedByMindMurder = builder.comment( "Should villagers take offense when you flay the mind of their fellow villagers?") .define("villagersOffendedByMindMurder", true); + tpDimDenyList = builder.comment("Resource locations of dimensions you can't Blink or Greater Teleport in.") + .defineList("tpDimDenyList", DEFAULT_DIM_TP_DENYLIST, Server::isValidReslocArg); + builder.push("Scrolls in Loot"); fewScrollTables = builder.comment( "Which loot tables should a small number of Ancient Scrolls be injected into?") - .defineList("fewScrollTables", DEFAULT_FEW_SCROLL_TABLES, - obj -> obj instanceof String s && ResourceLocation.isValidResourceLocation(s)); + .defineList("fewScrollTables", DEFAULT_FEW_SCROLL_TABLES, Server::isValidReslocArg); someScrollTables = builder.comment( "Which loot tables should a decent number of Ancient Scrolls be injected into?") - .defineList("someScrollTables", DEFAULT_SOME_SCROLL_TABLES, - obj -> obj instanceof String s && ResourceLocation.isValidResourceLocation(s)); + .defineList("someScrollTables", DEFAULT_SOME_SCROLL_TABLES, Server::isValidReslocArg); manyScrollTables = builder.comment( "Which loot tables should a huge number of Ancient Scrolls be injected into?") - .defineList("manyScrollTables", DEFAULT_MANY_SCROLL_TABLES, - obj -> obj instanceof String s && ResourceLocation.isValidResourceLocation(s)); + .defineList("manyScrollTables", DEFAULT_MANY_SCROLL_TABLES, Server::isValidReslocArg); } @Override @@ -184,6 +187,11 @@ public class ForgeHexConfig implements HexConfig.CommonConfigAccess { return villagersOffendedByMindMurder.get(); } + @Override + public boolean canTeleportInThisDimension(ResourceKey dimension) { + return noneMatch(tpDimDenyList.get(), dimension.location()); + } + // TODO: on Forge, this value isn't loaded when creating a new world yet because config is per-world. // For now I'm hardcoding this, but for correctness we should probably switch the table // injects to be loaded from datapack instead of config. @@ -209,5 +217,9 @@ public class ForgeHexConfig implements HexConfig.CommonConfigAccess { } return ScrollQuantity.NONE; } + + private static boolean isValidReslocArg(Object o) { + return o instanceof String s && ResourceLocation.isValidResourceLocation(s); + } } } diff --git a/Forge/src/main/java/at/petrak/hexcasting/forge/interop/jei/PhialRecipeCategory.java b/Forge/src/main/java/at/petrak/hexcasting/forge/interop/jei/PhialRecipeCategory.java index d1a5b369..49c673b0 100644 --- a/Forge/src/main/java/at/petrak/hexcasting/forge/interop/jei/PhialRecipeCategory.java +++ b/Forge/src/main/java/at/petrak/hexcasting/forge/interop/jei/PhialRecipeCategory.java @@ -1,6 +1,6 @@ package at.petrak.hexcasting.forge.interop.jei; -import at.petrak.hexcasting.api.mod.HexItemTags; +import at.petrak.hexcasting.api.mod.HexTags; import at.petrak.hexcasting.common.casting.operators.spells.OpMakeBattery; import at.petrak.hexcasting.interop.utils.PhialRecipeStackBuilder; import mezz.jei.api.gui.builder.IRecipeLayoutBuilder; @@ -59,7 +59,7 @@ public class PhialRecipeCategory implements IRecipeCategory { var inputSlot = builder.addSlot(RecipeIngredientRole.INPUT, 12, 12) .addItemStacks(stacks.getFirst()); builder.addSlot(RecipeIngredientRole.INPUT, 47, 12) - .addIngredients(Ingredient.of(HexItemTags.PHIAL_BASE)); + .addIngredients(Ingredient.of(HexTags.Items.PHIAL_BASE)); var outputSlot = builder.addSlot(RecipeIngredientRole.OUTPUT, 85, 12) .addItemStacks(stacks.getSecond()); diff --git a/Forge/src/main/java/at/petrak/hexcasting/forge/xplat/ForgeXplatImpl.java b/Forge/src/main/java/at/petrak/hexcasting/forge/xplat/ForgeXplatImpl.java index 5f370cdd..62ddf2ae 100644 --- a/Forge/src/main/java/at/petrak/hexcasting/forge/xplat/ForgeXplatImpl.java +++ b/Forge/src/main/java/at/petrak/hexcasting/forge/xplat/ForgeXplatImpl.java @@ -6,7 +6,7 @@ import at.petrak.hexcasting.api.addldata.ADHexHolder; import at.petrak.hexcasting.api.addldata.ADIotaHolder; import at.petrak.hexcasting.api.addldata.ADMediaHolder; import at.petrak.hexcasting.api.misc.FrozenColorizer; -import at.petrak.hexcasting.api.mod.HexItemTags; +import at.petrak.hexcasting.api.mod.HexTags; import at.petrak.hexcasting.api.player.FlightAbility; import at.petrak.hexcasting.api.player.Sentinel; import at.petrak.hexcasting.api.spell.casting.CastingContext; @@ -321,7 +321,7 @@ public class ForgeXplatImpl implements IXplatAbstractions { @Override public BlockEntityType createBlockEntityType(BiFunction func, - Block... blocks) { + Block... blocks) { return BlockEntityType.Builder.of(func::apply, blocks).build(null); } @@ -387,12 +387,12 @@ public class ForgeXplatImpl implements IXplatAbstractions { private static final IXplatTags TAGS = new IXplatTags() { @Override public TagKey amethystDust() { - return HexItemTags.create(new ResourceLocation("forge", "dusts/amethyst")); + return HexTags.Items.create(new ResourceLocation("forge", "dusts/amethyst")); } @Override public TagKey gems() { - return HexItemTags.create(new ResourceLocation("forge", "gems")); + return HexTags.Items.create(new ResourceLocation("forge", "gems")); } }; From 7da34e917440bde8822223d5d5ad9bb150dd0a57 Mon Sep 17 00:00:00 2001 From: "petrak@" Date: Wed, 30 Nov 2022 12:24:49 -0500 Subject: [PATCH 21/95] [Release] 0.10.2 release! Just bugfixes this time around. --- gradle.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle.properties b/gradle.properties index 2aa34577..eb376b08 100644 --- a/gradle.properties +++ b/gradle.properties @@ -10,7 +10,7 @@ jetbrainsAnnotationsVersion=23.0.0 minecraftVersion=1.19.2 kotlinVersion=1.7.20 -modVersion=0.10.1 +modVersion=0.10.2 paucalVersion=0.5.0 patchouliVersion=77 From 68db1258488124f88c00f45f2d2584f6b301adc0 Mon Sep 17 00:00:00 2001 From: June <8020624+Cypher121@users.noreply.github.com> Date: Thu, 1 Dec 2022 18:37:09 +0100 Subject: [PATCH 22/95] Fix Hermes reading from bottom of the stack Closes #339 --- .../petrak/hexcasting/common/casting/operators/eval/OpEval.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/eval/OpEval.kt b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/eval/OpEval.kt index 191a8d3d..a42c589c 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/eval/OpEval.kt +++ b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/eval/OpEval.kt @@ -19,7 +19,7 @@ object OpEval : Action { ravenmind: Iota?, ctx: CastingContext ): OperationResult { - val datum = stack.getOrElse(0) { throw MishapNotEnoughArgs(1, 0) } + val datum = stack.removeLastOrNull() ?: throw MishapNotEnoughArgs(1, 0) val instrs = evaluatable(datum, 0) instrs.ifRight { From 503d5db16c54bdb5c36a9d7d3b5fe193eaf6cec6 Mon Sep 17 00:00:00 2001 From: June <8020624+Cypher121@users.noreply.github.com> Date: Sat, 3 Dec 2022 06:22:05 +0100 Subject: [PATCH 23/95] Fix #343 --- .../petrak/hexcasting/api/spell/casting/CastingHarness.kt | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/Common/src/main/java/at/petrak/hexcasting/api/spell/casting/CastingHarness.kt b/Common/src/main/java/at/petrak/hexcasting/api/spell/casting/CastingHarness.kt index e3b290ab..8c4fffa0 100644 --- a/Common/src/main/java/at/petrak/hexcasting/api/spell/casting/CastingHarness.kt +++ b/Common/src/main/java/at/petrak/hexcasting/api/spell/casting/CastingHarness.kt @@ -113,7 +113,11 @@ class CastingHarness private constructor( next.evaluate(continuation.next, world, this) } catch (mishap: Mishap) { val pattern = getPatternForFrame(next) - val operator = getOperatorForFrame(next, world) + val operator = try { + getOperatorForFrame(next, world) + } catch (e: Throwable) { + null + } CastResult( continuation, null, From a7d83782b61350a4de84d63bae7bb9b17a28f71a Mon Sep 17 00:00:00 2001 From: June <8020624+Cypher121@users.noreply.github.com> Date: Sat, 3 Dec 2022 15:29:16 +0100 Subject: [PATCH 24/95] More try-catch for getUpdate --- .../hexcasting/api/spell/casting/CastingHarness.kt | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/Common/src/main/java/at/petrak/hexcasting/api/spell/casting/CastingHarness.kt b/Common/src/main/java/at/petrak/hexcasting/api/spell/casting/CastingHarness.kt index 8c4fffa0..780b6548 100644 --- a/Common/src/main/java/at/petrak/hexcasting/api/spell/casting/CastingHarness.kt +++ b/Common/src/main/java/at/petrak/hexcasting/api/spell/casting/CastingHarness.kt @@ -196,6 +196,11 @@ class CastingHarness private constructor( ) } } catch (mishap: Mishap) { + val operator = try { + getOperatorForPattern(iota, world) + } catch (e: Throwable) { + null + } return CastResult( continuation, null, @@ -205,7 +210,7 @@ class CastingHarness private constructor( mishap, Mishap.Context( (iota as? PatternIota)?.pattern ?: HexPattern(HexDir.WEST), - getOperatorForPattern(iota, world) + operator ) ) ), @@ -214,6 +219,11 @@ class CastingHarness private constructor( } catch (exception: Exception) { // This means something very bad has happened exception.printStackTrace() + val operator = try { + getOperatorForPattern(iota, world) + } catch (e: Throwable) { + null + } return CastResult( continuation, null, @@ -223,7 +233,7 @@ class CastingHarness private constructor( MishapError(exception), Mishap.Context( (iota as? PatternIota)?.pattern ?: HexPattern(HexDir.WEST), - getOperatorForPattern(iota, world) + operator ) ) ), From f070b271ffd0f9d7784f7cb04cdba766465540be Mon Sep 17 00:00:00 2001 From: "petrak@" Date: Sat, 3 Dec 2022 11:31:19 -0500 Subject: [PATCH 25/95] fixerman's gambit (close #345) --- .../casting/operators/stack/OpFisherman.kt | 21 ++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/stack/OpFisherman.kt b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/stack/OpFisherman.kt index 23070115..22909d89 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/stack/OpFisherman.kt +++ b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/stack/OpFisherman.kt @@ -4,9 +4,12 @@ import at.petrak.hexcasting.api.spell.Action import at.petrak.hexcasting.api.spell.OperationResult import at.petrak.hexcasting.api.spell.casting.CastingContext import at.petrak.hexcasting.api.spell.casting.eval.SpellContinuation -import at.petrak.hexcasting.api.spell.getPositiveIntUnderInclusive +import at.petrak.hexcasting.api.spell.iota.DoubleIota import at.petrak.hexcasting.api.spell.iota.Iota +import at.petrak.hexcasting.api.spell.mishaps.MishapInvalidIota import at.petrak.hexcasting.api.spell.mishaps.MishapNotEnoughArgs +import kotlin.math.abs +import kotlin.math.roundToInt object OpFisherman : Action { override fun operate( @@ -18,9 +21,21 @@ object OpFisherman : Action { if (stack.size < 2) throw MishapNotEnoughArgs(2, stack.size) - val depth = stack.getPositiveIntUnderInclusive(stack.lastIndex, stack.size - 1) + val depth = let { + val x = stack.last() + val maxIdx = stack.size - 1 + if (x is DoubleIota) { + val double = x.double + val rounded = double.roundToInt() + if (abs(double - rounded) <= DoubleIota.TOLERANCE && rounded in 1..maxIdx) { + return@let rounded + } + } + throw MishapInvalidIota.of(x, 0, "double.between", 1, maxIdx) + } + stack.removeLast() - val fish = stack.removeAt(stack.size - 1 - depth) + val fish = stack.removeAt(stack.size - depth) stack.add(fish) return OperationResult(continuation, stack, ravenmind, listOf()) From 9616b89979b7af15a666b28e8190f3173903fe31 Mon Sep 17 00:00:00 2001 From: "petrak@" Date: Sat, 3 Dec 2022 11:52:45 -0500 Subject: [PATCH 26/95] redocument flock's refl, close #338 --- .../assets/hexcasting/lang/en_us.json | 1 + .../en_us/entries/patterns/stackmanip.json | 25 ++++++++++++------- 2 files changed, 17 insertions(+), 9 deletions(-) diff --git a/Common/src/main/resources/assets/hexcasting/lang/en_us.json b/Common/src/main/resources/assets/hexcasting/lang/en_us.json index 22e3c130..603a5278 100644 --- a/Common/src/main/resources/assets/hexcasting/lang/en_us.json +++ b/Common/src/main/resources/assets/hexcasting/lang/en_us.json @@ -948,6 +948,7 @@ "hexcasting.page.stackmanip.over": "Copy the second-to-last iota of the stack to the top. [0, 1] becomes [0, 1, 0].", "hexcasting.page.stackmanip.tuck": "Copy the top iota of the stack, then put it under the second iota. [0, 1] becomes [1, 0, 1].", "hexcasting.page.stackmanip.2dup": "Copy the top two iotas of the stack. [0, 1] becomes [0, 1, 0, 1].", + "hexcasting.page.stackmanip.stack_len": "Pushes the size of the stack as a number to the top of the stack. (For example, a stack of [0, 1] will become [0, 1, 2].)", "hexcasting.page.stackmanip.duplicate_n": "Removes the number at the top of the stack, then copies the top iota of the stack that number of times. (A count of 2 results in two of the iota on the stack, not three.)", "hexcasting.page.stackmanip.fisherman": "Grabs the element in the stack indexed by the number and brings it to the top.", "hexcasting.page.stackmanip.fisherman/copy": "Like $(action)Fisherman's Gambit/$, but instead of moving the iota, copies it.", diff --git a/Common/src/main/resources/data/hexcasting/patchouli_books/thehexbook/en_us/entries/patterns/stackmanip.json b/Common/src/main/resources/data/hexcasting/patchouli_books/thehexbook/en_us/entries/patterns/stackmanip.json index 04b72502..dcae03f1 100644 --- a/Common/src/main/resources/data/hexcasting/patchouli_books/thehexbook/en_us/entries/patterns/stackmanip.json +++ b/Common/src/main/resources/data/hexcasting/patchouli_books/thehexbook/en_us/entries/patterns/stackmanip.json @@ -78,6 +78,22 @@ "output": "many", "text": "hexcasting.page.stackmanip.duplicate_n" }, + { + "type": "hexcasting:pattern", + "op_id": "hexcasting:2dup", + "anchor": "hexcasting:2dup", + "input": "any, any", + "output": "any, any, any, any", + "text": "hexcasting.page.stackmanip.2dup" + }, + { + "type": "hexcasting:pattern", + "op_id": "hexcasting:stack_len", + "anchor": "hexcasting:stack_len", + "input": "", + "output": "number", + "text": "hexcasting.page.stackmanip.stack_len" + }, { "type": "hexcasting:pattern", "op_id": "hexcasting:fisherman", @@ -137,15 +153,6 @@ "text": "hexcasting.page.stackmanip.swizzle.2", "link_text": "hexcasting.page.stackmanip.swizzle.link", "url": "https://github.com/gamma-delta/HexMod/wiki/Table-of-Lehmer-Codes-for-Swindler's-Gambit" - }, - { - "_comment": "i hate that I have to put this here at the end. two-page design bad", - "type": "hexcasting:pattern", - "op_id": "hexcasting:2dup", - "anchor": "hexcasting:2dup", - "input": "any, any", - "output": "any, any, any, any", - "text": "hexcasting.page.stackmanip.2dup" } ] } From deec17376f5f5d4760c70845ff8767fd646ea3a6 Mon Sep 17 00:00:00 2001 From: "petrak@" Date: Sat, 3 Dec 2022 12:05:38 -0500 Subject: [PATCH 27/95] at the behest of my friend Terabithia, who helped me write the lore, change the character's name to Cardamom --- .../assets/hexcasting/lang/en_us.json | 50 +++++++++---------- 1 file changed, 25 insertions(+), 25 deletions(-) diff --git a/Common/src/main/resources/assets/hexcasting/lang/en_us.json b/Common/src/main/resources/assets/hexcasting/lang/en_us.json index 603a5278..8690ad72 100644 --- a/Common/src/main/resources/assets/hexcasting/lang/en_us.json +++ b/Common/src/main/resources/assets/hexcasting/lang/en_us.json @@ -226,16 +226,16 @@ "advancement.hexcasting:opened_eyes.desc": "Have nature take a piece of your mind in payment for a hex. What might happen if you let it have more?", "advancement.hexcasting:lore": "Hexcasting Lore", "advancement.hexcasting:lore.desc": "Read a Lore Fragment", - "advancement.hexcasting:lore/terabithia1": "Terabithia Steles", - "advancement.hexcasting:lore/terabithia1.desc": "Letter from Terabithia Steles to Her Father, #1", - "advancement.hexcasting:lore/terabithia2": "Terabithia Steles", - "advancement.hexcasting:lore/terabithia2.desc": "Letter from Terabithia Steles to Her Father, #2", - "advancement.hexcasting:lore/terabithia3": "Terabithia Steles", - "advancement.hexcasting:lore/terabithia3.desc": "Letter from Terabithia Steles to Her Father, #3, 1/2", - "advancement.hexcasting:lore/terabithia4": "Terabithia Steles", - "advancement.hexcasting:lore/terabithia4.desc": "Letter from Terabithia Steles to Her Father, #3, 2/2", - "advancement.hexcasting:lore/terabithia5": "Terabithia Steles", - "advancement.hexcasting:lore/terabithia5.desc": "Letter from Terabithia Steles to Her Father, #4", + "advancement.hexcasting:lore/terabithia1": "Cardamom Steles #1", + "advancement.hexcasting:lore/terabithia1.desc": "Letter from Cardamom Steles to Her Father, #1", + "advancement.hexcasting:lore/terabithia2": "Cardamom Steles #2", + "advancement.hexcasting:lore/terabithia2.desc": "Letter from Cardamom Steles to Her Father, #2", + "advancement.hexcasting:lore/terabithia3": "Cardamom Steles #3", + "advancement.hexcasting:lore/terabithia3.desc": "Letter from Cardamom Steles to Her Father, #3, 1/2", + "advancement.hexcasting:lore/terabithia4": "Cardamom Steles #3 pt2", + "advancement.hexcasting:lore/terabithia4.desc": "Letter from Cardamom Steles to Her Father, #3, 2/2", + "advancement.hexcasting:lore/terabithia5": "Cardamom Steles #4", + "advancement.hexcasting:lore/terabithia5.desc": "Letter from Cardamom Steles to Her Father, #4", "advancement.hexcasting:lore/experiment1": "Wooleye Instance Notes", "advancement.hexcasting:lore/experiment2": "Wooleye Interview Logs", "advancement.hexcasting:lore/inventory": "Restoration Log 72", @@ -1143,27 +1143,27 @@ "hexcasting.entry.lore": "Lore", "hexcasting.entry.lore.desc": "I have uncovered some letters and text not of direct relevance to my art. But, I think I may be able to divine some of the history of the world from these. Let me see...", - "hexcasting.entry.lore.terabithia1": "Terabithia Steles, #1", - "hexcasting.page.lore.terabithia1.1": "$(italic)Full title: Letter from Terabithia Steles to Her Father, #1/$$(br2)Dear Papa,$(br)Every day it seems I have more reason to thank you for saving up to send me to the Grand Library. The amount I am learning is incredible! I feel I don't have the skill with words needed to express myself fully... it is wonderful to be here.", + "hexcasting.entry.lore.terabithia1": "Cardamom Steles, #1", + "hexcasting.page.lore.terabithia1.1": "$(italic)Full title: Letter from Cardamom Steles to Her Father, #1/$$(br2)Dear Papa,$(br)Every day it seems I have more reason to thank you for saving up to send me to the Grand Library. The amount I am learning is incredible! I feel I don't have the skill with words needed to express myself fully... it is wonderful to be here.", "hexcasting.page.lore.terabithia1.2": "I sit in the main dome as I write this. It's maintained by the Hexcasting Corps; they have some sort of peculiar mechanism at the top that captures the stray thought energy as it leaks out from the desks and desks of hard-working students, as I understand it. One of my friends in the dormitory, Amanita, is studying the subject, and oh how she loves to explain it to me at length, although I confess I do not understand it very well.", "hexcasting.page.lore.terabithia1.3": "The way I understand it, our processes of thought--the intangible mechanisms by which I move my pen and by which you read this letter--are not completely efficient. A small amount of that energy is released into the environment, like how a wagon's axle is hot to the touch after it has been turning for a while. This spare energy is called \"media.\" One person's spare media is trifiling, but the hundreds of thinking people in the main dome have a sort of multiplicative effect, and combined with some sort of ingenious mechanism, it can be solidified into a sort of purple crystal.", "hexcasting.page.lore.terabithia1.4": "But that's enough about her studies. I returned from my first expedition with the Geology Corps today! My apologies for not sending a letter before I left; the date crept up on me. We ventured into a crack in the earth to the east of the Grand and spent the night camping under the rock and soil. We kept to well-lit and well-traveled areas of the cave, of course, and in all honesty it was likely safer in there than the night surface, but oh how I was scared!", "hexcasting.page.lore.terabithia1.5": "Fortunately the night passed without mishap, and we proceeded deeper into the cave for our examination of the local veins of ore. We were looking for trace veins of a purple crystal called \"amethyst,\" which supposedly occurs in small amounts deep in the rock. We did not find anything, sadly, and returned to the sunlit surface empty-handed.", "hexcasting.page.lore.terabithia1.6": "Come to think of it, the description of this \"amethyst\" I now realize closely matches those crystals of media Amanita speaks of. Imagine if these nuggets of thought occurred naturally under the ground! I can't imagine why that might happen, though... ", "hexcasting.page.lore.terabithia1.7": "As a student, I am entitled to send one letter by Akashic post every three months, free of charge. Unfortunately, you know how thin my moneybags are ... so I am afraid this offer is the only method I may communicate with you. I will of course appreciate immensely if you manage to scrounge together the money to send a letter back, but it seems our communications may be limited. I hate to be cut off from you so, but the skills I gain here will be more than repayment. Imagine, I will be the first member of our family to be anything other than a farmer!", - "hexcasting.page.lore.terabithia1.8": "So, I suppose I will write again in three months' time.$(br2)Yours,$(br)-- Terabithia Steles", + "hexcasting.page.lore.terabithia1.8": "So, I suppose I will write again in three months' time.$(br2)Yours,$(br)-- Cardamom Steles", - "hexcasting.entry.lore.terabithia2": "Terabithia Steles, #2", - "hexcasting.page.lore.terabithia2.1": "$(italic)Full title: Letter from Terabithia Steles to Her Father, #2/$$(br2)Dear Papa,$(br)... Goodness, what an ordeal it is to try to summarize the last three months into a short letter. Such a cruel task set before me by this miracle I receive entirely for free! Woe is me.", + "hexcasting.entry.lore.terabithia2": "Cardamom Steles, #2", + "hexcasting.page.lore.terabithia2.1": "$(italic)Full title: Letter from Cardamom Steles to Her Father, #2/$$(br2)Dear Papa,$(br)... Goodness, what an ordeal it is to try to summarize the last three months into a short letter. Such a cruel task set before me by this miracle I receive entirely for free! Woe is me.", "hexcasting.page.lore.terabithia2.2": "My studies with the Geology Corps have been progressing smoothly. We have gone on more expeditions, deeper into the earth, to where the smooth gray stone makes way to a hard, flaky slate. It creates such an awful, choking dust under your feet... it's incredible what hostility there is below all of our feet all the time, even disregarding the creatures of the dark. (I have had one or two encounters with them, but I know how you shudder to think of me having to fight for my life, so I will not write of them.)", "hexcasting.page.lore.terabithia2.3": "We did manage to find some of this amethyst, however. There was a small vein with a few trace crystals on one of our expeditions. We were under strict instructions to keep none of them and turn them in to our Corps prefect immediately. I find the whole affair rather ridiculous; they treat it like some matter of enormous importance and secrecy, and yet have a group of a dozen students, all barely six months at the Grand Library, trying to excavate barely ten drams of the stuff with twelve prospector's picks in a square foot...", "hexcasting.page.lore.terabithia2.4": "I cannot imagine for what purpose, either. A librarian pointed me to an encyclopedia of gems, and amethyst seems to have next to no purpose; it's used for certain specialty types of glass and lenses, of all things.$(br2)If I were to speculate, I would guess that these amethyst crystals and the media they so resemble are one and the same, as I wrote of last time.", "hexcasting.page.lore.terabithia2.5": "If this is true, the secrecy, not to mention the prefect's aversion to questioning, may be because this is an original piece of research the Grand Library is not eager to let into the hands of enemy factions.$(br2)However, this theory does not sit quite right with me. The amethyst I handled in the cave and the crystals of media Amanita has shown to me do seem quite similar, but not identical. I would like to see them side-by-side to be sure, but media has a peculiar buzzing or rumbling feel beneath the fingers that amethyst does not.", "hexcasting.page.lore.terabithia2.6": "It is quite possible I was unable to sense it on the amethyst in the cave due to the stress of being undergound-- my hands were shaking the one time I managed to touch some, and the feeling is very light --but it does not seem the same to me. The light reflects slightly differently.$(br2)I suppose if I ever manage to get my hands on a crystal of amethyst outside of a cave, I will ask Amanita to see if she can cast a spell with it. Every time we meet she seems to have some new fantastic trick.", - "hexcasting.page.lore.terabithia2.7": "Just last week she suspended me in the air supported by nothing at all! It is an immensely strange feeling to have your body tingling and lighter than air with your clothing still the same weight... I am just glad she tugged me over my bed before the effect ran out.$(br2)Yours,$(br)-- Terabithia Steles", + "hexcasting.page.lore.terabithia2.7": "Just last week she suspended me in the air supported by nothing at all! It is an immensely strange feeling to have your body tingling and lighter than air with your clothing still the same weight... I am just glad she tugged me over my bed before the effect ran out.$(br2)Yours,$(br)-- Cardamom Steles", - "hexcasting.entry.lore.terabithia3": "Terabithia Steles, #3, 1/2", - "hexcasting.page.lore.terabithia3.1": "$(italic)Full title: Letter from Terabithia Steles to her father, #3, part 1/2/$$(br2)Dear Papa,$(br)Two very peculiar things have happened since I last wrote.$(br2)Firstly, the professor in charge of the entry-level Hexcasting Corps students has disappeared. Nobody knows where he has gone. His office and living quarters were found locked, but still in their usual state of disarray.", + "hexcasting.entry.lore.terabithia3": "Cardamom Steles, #3, 1/2", + "hexcasting.page.lore.terabithia3.1": "$(italic)Full title: Letter from Cardamom Steles to her father, #3, part 1/2/$$(br2)Dear Papa,$(br)Two very peculiar things have happened since I last wrote.$(br2)Firstly, the professor in charge of the entry-level Hexcasting Corps students has disappeared. Nobody knows where he has gone. His office and living quarters were found locked, but still in their usual state of disarray.", "hexcasting.page.lore.terabithia3.2": "Even more peculiarly, any attempts by the students of the Grand to rouse the administrative portions of the gnarled bureaucracy have been very firmly rejected. Even other professors seem reluctant to talk about him.$(br2)As you might imagine, Amanita is sorely distressed. Whatever replacement professors the Grand managed to dredge up have none of the old professor's tact or skill with beginners.", "hexcasting.page.lore.terabithia3.3": "But amazingly, that is not the stranger of the two things I have to tell you. The most horrendous thing I hope to ever experience happened on another trip out with the Geology Corps. This time, we were due for an expedition near a village.", "hexcasting.page.lore.terabithia3.4": "Usually when we do such a thing, there is a long process of communication with the mayor or elder of the village to ensure we have permission and establish boundaries on where we are allowed to go and what we are allowed to do. But on this expedition, there was very little of that; we were notified where we were going by a prefect of the Hexcasting Corps scarcely two days before we left.", @@ -1174,10 +1174,10 @@ "hexcasting.page.lore.terabithia3.9": "I hesitate to say \"important,\" but that's the best I can think of. It had a certain ... gravitas, like the dark, sunken X in its surface held some sacred meaning. Whatever the reason we were under strict instructions not to touch them. Occasionally a misplaced pickaxe would shatter one, and the student responsible would get quite the earful. Although the labor was hard and took most of my attention, I couldn't help but notice how ... lucid I felt. It was a strange mix of feelings: I felt incredibly clear-headed, but I also felt if I stopped to examine the feeling I might never stop.", "hexcasting.page.lore.terabithia3.10": "It was like each breath in erected a friendly signpost in my head promising the way forward, pointing directly down a steep cliff. I shook my head and immersed myself in the work of mining, which seemed to stave off the signposts.$(br2)I did manage, however, to hide a shard of the crystal in my knapsack.$(br2)We spent nearly the whole day mining, excavating most of the crystal by the time the prefects' chronometer said the sun would set soon.", "hexcasting.page.lore.terabithia3.11": "As we left, I couldn't help but notice that on the surfaces of those dark, scored places we left unmined, there seemed to be the faintest buds of new crystal, like they were somehow growing out of them. Everything I had learned about the geology of crystals said they took thousands of years to grow, but here there was new growth in less than a day. I suppose the prefects' warnings against breaking those spots were warranted, at least.", - "hexcasting.page.lore.terabithia3.12": "Our journey back to the surface was uneventful, and we got back to our tents just as the sun was setting-- My apologies, I am nearly out of paper for this letter. There's only so much you can write on one Akashic letter ... This tale is worth purchasing another letter for. I'll send them both at once, so they should arrive together.$(br2)Yours,$(br)-- Terabithia Steles", + "hexcasting.page.lore.terabithia3.12": "Our journey back to the surface was uneventful, and we got back to our tents just as the sun was setting-- My apologies, I am nearly out of paper for this letter. There's only so much you can write on one Akashic letter ... This tale is worth purchasing another letter for. I'll send them both at once, so they should arrive together.$(br2)Yours,$(br)-- Cardamom Steles", - "hexcasting.entry.lore.terabithia4": "Terabithia Steles, #3, 2/2", - "hexcasting.page.lore.terabithia4.1": "$(italic)Full title: Letter from Terabithia Steles to her father, #3, part 2/2/$$(br2)Dear Papa,$(br)As I was saying, I was running out of paper to write my story, so the rest of it is in this letter. We made it back to camp just as the sun was setting. And that night was the most horrible event of the whole strange outing.", + "hexcasting.entry.lore.terabithia4": "Cardamom Steles, #3, 2/2", + "hexcasting.page.lore.terabithia4.1": "$(italic)Full title: Letter from Cardamom Steles to her father, #3, part 2/2/$$(br2)Dear Papa,$(br)As I was saying, I was running out of paper to write my story, so the rest of it is in this letter. We made it back to camp just as the sun was setting. And that night was the most horrible event of the whole strange outing.", "hexcasting.page.lore.terabithia4.2": "I had gotten up in the middle of the night to relieve myself. The moon was covered with clouds, and I confess I got lost in the winds of the forest and could not find the way back to the camp. Fearing the monsters of the night, I decided I would find my way to the village and see if I could find a bed there. At the least, I would be protected there.", "hexcasting.page.lore.terabithia4.3": "The village was easy enough to find, though there was very little sound. Even this late at night I would expect the inn to be, if not bustling, at least not silent. But peeking through the inn door I saw absolutely nobody.$(br2)I knocked on the door of one of the houses to no response. The next two houses, too, seemed completely empty.", "hexcasting.page.lore.terabithia4.4": "My pulse started to rise, and I resolved to enter the next house. I figured whoever might be inside would be understanding of their rest being disturbed. At the least, hearing another voice would have been reassuring, even if they didn't let me stay the night under their roof.$(br2)The house was very small, barely more than a cartographer's table and a bed. I could see there was someone in the bed, and I tried to reassure myself that everyone in the village was just deeply asleep as I turned to leave.", @@ -1186,10 +1186,10 @@ "hexcasting.page.lore.terabithia4.7": "I ran. In the light of the newly-revealed moon I caught glimpses of other townspeople through windows, and they were all warped and simplified as the first $(italic)thing/$ I had seen. I sprinted into the darkness of the forest, away from those terrible, terrible animal eyes in those distorted faces.$(br2)The camp was easier to find now that I could see in the moonlight. No-one seemed to have noticed my prolonged absence, thankfully. I crawled back into my bedroll and did my very best to forget the whole night.", "hexcasting.page.lore.terabithia4.8": "As you can tell from this letter, I did not do a very good job. That warped visage still haunts my dreams. I shudder to think that it once might have been human.$(br2)After we got back to the Grand I showed the shard of crystal I had smuggled out to Amanita. She confirmed my suspicions: it is definitely a crystal of media. What an enormous geode full of it is doing underground, though, is beyond her.", "hexcasting.page.lore.terabithia4.9": "She also mentioned something interesting: apparently media can be used in a similar way to true amethyst in those niche glasses I mentioned a few letters ago. The physical manner in which they both crystallise happens to be nearly identical, and it has nothing to do with media's magical properties, or so she says.$(br2)I chose not to tell her of the village full of monsters.", - "hexcasting.page.lore.terabithia4.10": "I know how tight money is for you, and how expensive it is to send a letter all the way back to the Grand, but I beg of you, please send a word of advice back. I am greatly distraught, and reading your words would do me much good.$(br2)Yours,$(br)-- Terabithia Steles", + "hexcasting.page.lore.terabithia4.10": "I know how tight money is for you, and how expensive it is to send a letter all the way back to the Grand, but I beg of you, please send a word of advice back. I am greatly distraught, and reading your words would do me much good.$(br2)Yours,$(br)-- Cardamom Steles", - "hexcasting.entry.lore.terabithia5": "Terabithia Steles, #4", - "hexcasting.page.lore.terabithia5.1": "$(italic)Full title: Letter from Terabithia Steles to her father, #4/$$(br2)Amanita has disappeared.$(br2)I don't know where she has gone, Papa. The last I saw her was over dinner, and she had just spoken to someone about the disappearances, and then--", + "hexcasting.entry.lore.terabithia5": "Cardamom Steles, #4", + "hexcasting.page.lore.terabithia5.1": "$(italic)Full title: Letter from Cardamom Steles to her father, #4/$$(br2)Amanita has disappeared.$(br2)I don't know where she has gone, Papa. The last I saw her was over dinner, and she had just spoken to someone about the disappearances, and then--", "hexcasting.page.lore.terabithia5.2": "then-- then she was gone too. And no one speaks of her, and I am so so scared, Papa, do they all know? Everyone must have a friend who's just $(italic)vanished/$, into thin air, into non-being.$(br2)Where did they $(italic)go/$?", "hexcasting.page.lore.terabithia5.3": "They keep shutting things down, too-- we haven't been on a trip for the Geology Corps in weeks, all the apparati that collect media in the main dome are gone, the Apothecary Corps haven't been open for months... it's like termites are eating the Grand from the inside, leaving a hollow shell.$(br2)I think they've started scanning the letters, we write too...", "hexcasting.page.lore.terabithia5.4": "This letter has taken so much courage to write, and I don't have the courage to tell people myself, but if no one here can hold the knowledge I hope and pray you can send the word out... it's a vain hope for this to spread from somewhere as backwater as Brackenfalls, but please, please, do your best. Remember them, Papa... Amanita Libera, Jasmine Ward, Theodore Cha... please, remember them... and please forgive my cowardice, that I foist the responsibility onto you.", @@ -1222,7 +1222,7 @@ "hexcasting.page.lore.experiment2.1": "$(italic)These documents were heavily redacted. I have copied the readable text from them here./$$(br2)Subject #1 \"A.E.\"$(br)Stopped struggling immediately after procedure. Facial expression and limbs slack, but can stand unassisted. When left unattended, absently pantomimes actions commonly done in previous profession (groundskeeping).", "hexcasting.page.lore.experiment2.2": "Heartrate was very high immediately after procedure, but this is inconclusive due to state of fear immediately before. Resulting bud produced 35 uθ/min.$(br)...$(br)Subject #4 \"P.I.\"$(br)Psychological tests run on P.I. Subject has object permanence, spatial awareness, basic numerical reasoning. Difficulty learning new tasks. $(br2) ...", "hexcasting.page.lore.experiment2.3": "Subject #7 \"T.C.\"$(br)Consented to procedure. Similar results several hours after the procedure to other subjects: able to stand, perform simple tasks. $(br2) ...$(br2)Subject #11 \"R.S.\"$(br)Sedated before procedure; dosage such that subject would wake up as procedure occurred...$(br2) ...", - "hexcasting.page.lore.experiment2.4": "Subject #23 \"A.L.\"$(br)Ability to speak retained to a greater degree than most subjects; dwindled to broken sentences, then a single word \"tera\" over the course of several hours.$(br2)For further testing: how does the procedure affect previous Hexcasters vs. non-Hexcasters?$(br2) ...", + "hexcasting.page.lore.experiment2.4": "Subject #23 \"A.L.\"$(br)Ability to speak retained to a greater degree than most subjects; dwindled to broken sentences, then a single word \"card\" over the course of several hours.$(br2)For further testing: how does the procedure affect previous Hexcasters vs. non-Hexcasters?$(br2) ...", "hexcasting.entry.interop": "Cross-Mod Compatibility", "hexcasting.entry.interop.desc": "It appears I have installed some mods Hexcasting interoperates with! I've detailed them here.", From c8510ed83d50ac7e05d91ba3f1924e21ec10d837 Mon Sep 17 00:00:00 2001 From: "petrak@" Date: Sat, 3 Dec 2022 23:15:52 -0500 Subject: [PATCH 28/95] [Release] 0.10.3 release! Really quick stupid bugfix release making Hermes' Gambit work again... whoopsy. Also some other bugfixes. --- gradle.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle.properties b/gradle.properties index eb376b08..f7e6a0d6 100644 --- a/gradle.properties +++ b/gradle.properties @@ -10,7 +10,7 @@ jetbrainsAnnotationsVersion=23.0.0 minecraftVersion=1.19.2 kotlinVersion=1.7.20 -modVersion=0.10.2 +modVersion=0.10.3 paucalVersion=0.5.0 patchouliVersion=77 From c3ebba18f06254aab5d14e915304db327a972d83 Mon Sep 17 00:00:00 2001 From: "petrak@" Date: Wed, 28 Dec 2022 14:11:28 -0500 Subject: [PATCH 29/95] finish logic for entity ingrs --- .../at/petrak/hexcasting/client/RenderLib.kt | 4 +- .../common/recipe/BrainsweepRecipe.java | 150 ++++----- .../brainsweep/BrainsweepIngredient.java | 52 --- .../brainsweep/BrainsweepeeIngredient.java | 67 ++++ .../EntityBrainsweepIngredient.java | 71 ---- .../brainsweep/EntityTagIngredient.java | 89 +++++ .../brainsweep/EntityTypeIngredient.java | 67 ++++ .../VillagerBrainsweepIngredient.java | 200 ------------ .../brainsweep/VillagerIngredient.java | 202 ++++++++++++ .../datagen/recipe/HexplatRecipes.kt | 15 +- .../builders/BrainsweepRecipeBuilder.java | 142 ++++---- .../patchouli/BrainsweepProcessor.java | 124 +++---- .../interop/emi/BrainsweepeeEmiStack.java | 304 +++++++++--------- .../fabric/interop/emi/VillagerVariant.java | 6 +- 14 files changed, 797 insertions(+), 696 deletions(-) delete mode 100644 Common/src/main/java/at/petrak/hexcasting/common/recipe/ingredient/brainsweep/BrainsweepIngredient.java create mode 100644 Common/src/main/java/at/petrak/hexcasting/common/recipe/ingredient/brainsweep/BrainsweepeeIngredient.java delete mode 100644 Common/src/main/java/at/petrak/hexcasting/common/recipe/ingredient/brainsweep/EntityBrainsweepIngredient.java create mode 100644 Common/src/main/java/at/petrak/hexcasting/common/recipe/ingredient/brainsweep/EntityTagIngredient.java create mode 100644 Common/src/main/java/at/petrak/hexcasting/common/recipe/ingredient/brainsweep/EntityTypeIngredient.java delete mode 100644 Common/src/main/java/at/petrak/hexcasting/common/recipe/ingredient/brainsweep/VillagerBrainsweepIngredient.java create mode 100644 Common/src/main/java/at/petrak/hexcasting/common/recipe/ingredient/brainsweep/VillagerIngredient.java diff --git a/Common/src/main/java/at/petrak/hexcasting/client/RenderLib.kt b/Common/src/main/java/at/petrak/hexcasting/client/RenderLib.kt index 29d914d9..00b7e546 100644 --- a/Common/src/main/java/at/petrak/hexcasting/client/RenderLib.kt +++ b/Common/src/main/java/at/petrak/hexcasting/client/RenderLib.kt @@ -8,7 +8,7 @@ import at.petrak.hexcasting.api.utils.TAU import at.petrak.hexcasting.api.utils.getValue import at.petrak.hexcasting.api.utils.setValue import at.petrak.hexcasting.api.utils.weakMapped -import at.petrak.hexcasting.common.recipe.ingredient.brainsweep.BrainsweepIngredient +import at.petrak.hexcasting.common.recipe.ingredient.brainsweep.BrainsweepeeIngredient import com.mojang.blaze3d.systems.RenderSystem import com.mojang.blaze3d.vertex.DefaultVertexFormat import com.mojang.blaze3d.vertex.PoseStack @@ -422,7 +422,7 @@ fun transferMsToGl(ms: PoseStack, toRun: Runnable) { private var villager: Villager? by weakMapped(Villager::level) -fun prepareVillagerForRendering(ingredient: BrainsweepIngredient, level: Level): Villager { +fun prepareVillagerForRendering(ingredient: BrainsweepeeIngredient, level: Level): Villager { throw NotImplementedError() /* val minLevel: Int = ingredient.minLevel() diff --git a/Common/src/main/java/at/petrak/hexcasting/common/recipe/BrainsweepRecipe.java b/Common/src/main/java/at/petrak/hexcasting/common/recipe/BrainsweepRecipe.java index 10c055f2..d35f045a 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/recipe/BrainsweepRecipe.java +++ b/Common/src/main/java/at/petrak/hexcasting/common/recipe/BrainsweepRecipe.java @@ -2,7 +2,7 @@ package at.petrak.hexcasting.common.recipe; import at.petrak.hexcasting.common.recipe.ingredient.StateIngredient; import at.petrak.hexcasting.common.recipe.ingredient.StateIngredientHelper; -import at.petrak.hexcasting.common.recipe.ingredient.brainsweep.BrainsweepIngredient; +import at.petrak.hexcasting.common.recipe.ingredient.brainsweep.BrainsweepeeIngredient; import com.google.gson.JsonObject; import net.minecraft.network.FriendlyByteBuf; import net.minecraft.resources.ResourceLocation; @@ -22,91 +22,91 @@ import org.jetbrains.annotations.NotNull; // God I am a horrible person public record BrainsweepRecipe( - ResourceLocation id, - StateIngredient blockIn, - BrainsweepIngredient entityIn, - int mediaCost, - BlockState result + ResourceLocation id, + StateIngredient blockIn, + BrainsweepeeIngredient entityIn, + int mediaCost, + BlockState result ) implements Recipe { - public boolean matches(BlockState blockIn, Entity victim, ServerLevel level) { - return this.blockIn.test(blockIn) && this.entityIn.test(victim, level); - } + public boolean matches(BlockState blockIn, Entity victim, ServerLevel level) { + return this.blockIn.test(blockIn) && this.entityIn.test(victim, level); + } - @Override - public ResourceLocation getId() { - return id; - } + @Override + public ResourceLocation getId() { + return id; + } - @Override - public RecipeType getType() { - return HexRecipeStuffRegistry.BRAINSWEEP_TYPE; - } + @Override + public RecipeType getType() { + return HexRecipeStuffRegistry.BRAINSWEEP_TYPE; + } - @Override - public RecipeSerializer getSerializer() { - return HexRecipeStuffRegistry.BRAINSWEEP; - } + @Override + public RecipeSerializer getSerializer() { + return HexRecipeStuffRegistry.BRAINSWEEP; + } - // in order to get this to be a "Recipe" we need to do a lot of bending-over-backwards - // to get the implementation to be satisfied even though we never use it - @Override - public boolean matches(Container pContainer, Level pLevel) { - return false; - } + // in order to get this to be a "Recipe" we need to do a lot of bending-over-backwards + // to get the implementation to be satisfied even though we never use it + @Override + public boolean matches(Container pContainer, Level pLevel) { + return false; + } - @Override - public ItemStack assemble(Container pContainer) { - return ItemStack.EMPTY; - } + @Override + public ItemStack assemble(Container pContainer) { + return ItemStack.EMPTY; + } - @Override - public boolean canCraftInDimensions(int pWidth, int pHeight) { - return false; - } + @Override + public boolean canCraftInDimensions(int pWidth, int pHeight) { + return false; + } - @Override - public ItemStack getResultItem() { - return ItemStack.EMPTY.copy(); - } + @Override + public ItemStack getResultItem() { + return ItemStack.EMPTY.copy(); + } - // Because kotlin doesn't like doing raw, unchecked types - // Can't blame it, but that's what we need to do - @SuppressWarnings({"rawtypes", "unchecked"}) - public static BlockState copyProperties(BlockState original, BlockState copyTo) { - for (Property prop : original.getProperties()) { - if (copyTo.hasProperty(prop)) { - copyTo = copyTo.setValue(prop, original.getValue(prop)); - } - } + // Because kotlin doesn't like doing raw, unchecked types + // Can't blame it, but that's what we need to do + @SuppressWarnings({"rawtypes", "unchecked"}) + public static BlockState copyProperties(BlockState original, BlockState copyTo) { + for (Property prop : original.getProperties()) { + if (copyTo.hasProperty(prop)) { + copyTo = copyTo.setValue(prop, original.getValue(prop)); + } + } - return copyTo; - } + return copyTo; + } - public static class Serializer extends RecipeSerializerBase { - @Override - public @NotNull BrainsweepRecipe fromJson(ResourceLocation recipeID, JsonObject json) { - var blockIn = StateIngredientHelper.deserialize(GsonHelper.getAsJsonObject(json, "blockIn")); - var villagerIn = BrainsweepIngredient.deserialize(GsonHelper.getAsJsonObject(json, "entityIn")); - var cost = GsonHelper.getAsInt(json, "cost"); - var result = StateIngredientHelper.readBlockState(GsonHelper.getAsJsonObject(json, "result")); - return new BrainsweepRecipe(recipeID, blockIn, villagerIn, cost, result); - } + public static class Serializer extends RecipeSerializerBase { + @Override + public @NotNull BrainsweepRecipe fromJson(ResourceLocation recipeID, JsonObject json) { + var blockIn = StateIngredientHelper.deserialize(GsonHelper.getAsJsonObject(json, "blockIn")); + var villagerIn = BrainsweepeeIngredient.deserialize(GsonHelper.getAsJsonObject(json, "entityIn")); + var cost = GsonHelper.getAsInt(json, "cost"); + var result = StateIngredientHelper.readBlockState(GsonHelper.getAsJsonObject(json, "result")); + return new BrainsweepRecipe(recipeID, blockIn, villagerIn, cost, result); + } - @Override - public void toNetwork(FriendlyByteBuf buf, BrainsweepRecipe recipe) { - recipe.blockIn.write(buf); - recipe.entityIn.write(buf); - buf.writeVarInt(recipe.mediaCost); - buf.writeVarInt(Block.getId(recipe.result)); - } + @Override + public void toNetwork(FriendlyByteBuf buf, BrainsweepRecipe recipe) { + recipe.blockIn.write(buf); + recipe.entityIn.write(buf); + buf.writeVarInt(recipe.mediaCost); + buf.writeVarInt(Block.getId(recipe.result)); + } - @Override - public @NotNull BrainsweepRecipe fromNetwork(ResourceLocation recipeID, FriendlyByteBuf buf) { - var blockIn = StateIngredientHelper.read(buf); - var villagerIn = BrainsweepIngredient.read(buf); - var cost = buf.readVarInt(); - var result = Block.stateById(buf.readVarInt()); - return new BrainsweepRecipe(recipeID, blockIn, villagerIn, cost, result); - } - } + @Override + public @NotNull BrainsweepRecipe fromNetwork(ResourceLocation recipeID, FriendlyByteBuf buf) { + var blockIn = StateIngredientHelper.read(buf); + var villagerIn = BrainsweepeeIngredient.read(buf); + var cost = buf.readVarInt(); + var result = Block.stateById(buf.readVarInt()); + return new BrainsweepRecipe(recipeID, blockIn, villagerIn, cost, result); + } + } } diff --git a/Common/src/main/java/at/petrak/hexcasting/common/recipe/ingredient/brainsweep/BrainsweepIngredient.java b/Common/src/main/java/at/petrak/hexcasting/common/recipe/ingredient/brainsweep/BrainsweepIngredient.java deleted file mode 100644 index 096e132b..00000000 --- a/Common/src/main/java/at/petrak/hexcasting/common/recipe/ingredient/brainsweep/BrainsweepIngredient.java +++ /dev/null @@ -1,52 +0,0 @@ -package at.petrak.hexcasting.common.recipe.ingredient.brainsweep; - -import com.google.gson.JsonObject; -import net.minecraft.client.multiplayer.ClientLevel; -import net.minecraft.network.FriendlyByteBuf; -import net.minecraft.network.chat.Component; -import net.minecraft.server.level.ServerLevel; -import net.minecraft.util.GsonHelper; -import net.minecraft.util.StringRepresentable; -import net.minecraft.world.entity.Entity; - -import java.util.List; - -public abstract class BrainsweepIngredient { - public abstract boolean test(Entity entity, ServerLevel level); - - public abstract List getTooltip(boolean advanced); - - public abstract JsonObject serialize(); - - public abstract void write(FriendlyByteBuf buf); - - public abstract Entity exampleEntity(ClientLevel level); - - public static BrainsweepIngredient read(FriendlyByteBuf buf) { - var type = buf.readVarInt(); - return switch (Type.values()[type]) { - case VILLAGER -> VillagerBrainsweepIngredient.read(buf); - case ENTITY -> EntityBrainsweepIngredient.read(buf); - }; - } - - public static BrainsweepIngredient deserialize(JsonObject json) { - var typestr = GsonHelper.getAsString(json, "type"); - var type = Type.valueOf(typestr); - return switch (type) { - case VILLAGER -> VillagerBrainsweepIngredient.deserialize(json); - case ENTITY -> EntityBrainsweepIngredient.deserialize(json); - }; - } - - public enum Type implements StringRepresentable { - VILLAGER, - ENTITY; - - @Override - public String getSerializedName() { - return this.toString(); - } - } - -} diff --git a/Common/src/main/java/at/petrak/hexcasting/common/recipe/ingredient/brainsweep/BrainsweepeeIngredient.java b/Common/src/main/java/at/petrak/hexcasting/common/recipe/ingredient/brainsweep/BrainsweepeeIngredient.java new file mode 100644 index 00000000..4a06ba8e --- /dev/null +++ b/Common/src/main/java/at/petrak/hexcasting/common/recipe/ingredient/brainsweep/BrainsweepeeIngredient.java @@ -0,0 +1,67 @@ +package at.petrak.hexcasting.common.recipe.ingredient.brainsweep; + +import com.google.gson.JsonObject; +import net.minecraft.client.multiplayer.ClientLevel; +import net.minecraft.network.FriendlyByteBuf; +import net.minecraft.network.chat.Component; +import net.minecraft.server.level.ServerLevel; +import net.minecraft.util.GsonHelper; +import net.minecraft.util.StringRepresentable; +import net.minecraft.world.entity.Entity; +import org.jetbrains.annotations.Nullable; + +import java.util.List; +import java.util.Locale; + +// Partially based on: +// https://github.com/SlimeKnights/Mantle/blob/1.18.2/src/main/java/slimeknights/mantle/recipe/ingredient/EntityIngredient.java +// Licensed under MIT +public abstract class BrainsweepeeIngredient { + public abstract boolean test(Entity entity, ServerLevel level); + + public abstract List getTooltip(boolean advanced); + + public abstract JsonObject serialize(); + + public abstract void write(FriendlyByteBuf buf); + + /** + * For the benefit of showing to the client, return an example of the entity. + *

+ * Can return null in case someone did something stupid with a recipe + */ + @Nullable + public abstract Entity exampleEntity(ClientLevel level); + + public static BrainsweepeeIngredient read(FriendlyByteBuf buf) { + var type = buf.readVarInt(); + return switch (Type.values()[type]) { + case VILLAGER -> VillagerIngredient.read(buf); + case ENTITY_TYPE -> EntityTypeIngredient.read(buf); + case ENTITY_TAG -> EntityTagIngredient.read(buf); + }; + } + + public static BrainsweepeeIngredient deserialize(JsonObject json) { + var typestr = GsonHelper.getAsString(json, "type"); + var type = Type.valueOf(typestr.toUpperCase(Locale.ROOT)); + return switch (type) { + case VILLAGER -> VillagerIngredient.deserialize(json); + case ENTITY_TYPE -> EntityTypeIngredient.deserialize(json); + case ENTITY_TAG -> EntityTagIngredient.deserialize(json); + }; + } + + // TODO: make this a registry? + public enum Type implements StringRepresentable { + VILLAGER, + ENTITY_TYPE, + ENTITY_TAG; + + @Override + public String getSerializedName() { + return this.name().toLowerCase(Locale.ROOT); + } + } + +} diff --git a/Common/src/main/java/at/petrak/hexcasting/common/recipe/ingredient/brainsweep/EntityBrainsweepIngredient.java b/Common/src/main/java/at/petrak/hexcasting/common/recipe/ingredient/brainsweep/EntityBrainsweepIngredient.java deleted file mode 100644 index e317734e..00000000 --- a/Common/src/main/java/at/petrak/hexcasting/common/recipe/ingredient/brainsweep/EntityBrainsweepIngredient.java +++ /dev/null @@ -1,71 +0,0 @@ -package at.petrak.hexcasting.common.recipe.ingredient.brainsweep; - -import com.google.gson.Gson; -import com.google.gson.GsonBuilder; -import com.google.gson.JsonElement; -import com.google.gson.JsonObject; -import net.minecraft.advancements.critereon.EntityPredicate; -import net.minecraft.network.FriendlyByteBuf; -import net.minecraft.network.chat.Component; -import net.minecraft.server.level.ServerLevel; -import net.minecraft.world.entity.Entity; - -import java.util.List; - -// Code based on: -// https://github.com/SlimeKnights/Mantle/blob/1.18.2/src/main/java/slimeknights/mantle/recipe/ingredient/EntityIngredient.java -// Licensed under MIT -public class EntityBrainsweepIngredient extends BrainsweepIngredient { - public static final Gson GSON = new GsonBuilder().create(); - - public final EntityPredicate requirements; - // Just tell the player what it is you want - public final Component tooltip; - - public EntityBrainsweepIngredient(EntityPredicate requirements, Component tooltip) { - this.requirements = requirements; - this.tooltip = tooltip; - } - - @Override - public boolean test(Entity entity, ServerLevel level) { - return this.requirements.matches(level, null, entity); - } - - @Override - public List getTooltip(boolean advanced) { - return List.of(this.tooltip); - } - - @Override - public JsonObject serialize() { - var obj = new JsonObject(); - obj.addProperty("type", "entity"); - - obj.add("requirements", this.requirements.serializeToJson()); - obj.addProperty("tooltip", Component.Serializer.toJson(this.tooltip)); - return obj; - } - - @Override - public void write(FriendlyByteBuf buf) { - buf.writeVarInt(Type.ENTITY.ordinal()); - - buf.writeUtf(this.requirements.serializeToJson().toString()); - buf.writeUtf(Component.Serializer.toJson(this.tooltip)); - } - - public static EntityBrainsweepIngredient deserialize(JsonObject obj) { - var reqs = EntityPredicate.fromJson(obj.get("requirements")); - var tooltip = Component.Serializer.fromJson(obj.get("tooltip")); - return new EntityBrainsweepIngredient(reqs, tooltip); - } - - public static EntityBrainsweepIngredient read(FriendlyByteBuf buf) { - var reqsObj = GSON.fromJson(buf.readUtf(), JsonElement.class); - - var reqs = EntityPredicate.fromJson(reqsObj); - var tooltip = Component.Serializer.fromJson(buf.readUtf()); - return new EntityBrainsweepIngredient(reqs, tooltip); - } -} diff --git a/Common/src/main/java/at/petrak/hexcasting/common/recipe/ingredient/brainsweep/EntityTagIngredient.java b/Common/src/main/java/at/petrak/hexcasting/common/recipe/ingredient/brainsweep/EntityTagIngredient.java new file mode 100644 index 00000000..e37b1432 --- /dev/null +++ b/Common/src/main/java/at/petrak/hexcasting/common/recipe/ingredient/brainsweep/EntityTagIngredient.java @@ -0,0 +1,89 @@ +package at.petrak.hexcasting.common.recipe.ingredient.brainsweep; + +import com.google.gson.JsonObject; +import net.minecraft.ChatFormatting; +import net.minecraft.client.multiplayer.ClientLevel; +import net.minecraft.client.resources.language.I18n; +import net.minecraft.core.Registry; +import net.minecraft.network.FriendlyByteBuf; +import net.minecraft.network.chat.Component; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.server.level.ServerLevel; +import net.minecraft.tags.TagKey; +import net.minecraft.util.GsonHelper; +import net.minecraft.world.entity.Entity; +import net.minecraft.world.entity.EntityType; + +import java.util.ArrayList; +import java.util.List; + +public class EntityTagIngredient extends BrainsweepeeIngredient { + public final TagKey> entityTypeTag; + + public EntityTagIngredient(TagKey> tag) { + this.entityTypeTag = tag; + } + + @Override + public boolean test(Entity entity, ServerLevel level) { + return entity.getType().is(this.entityTypeTag); + } + + @Override + public List getTooltip(boolean advanced) { + String key = "tag." + + this.entityTypeTag.location().getNamespace() + + "." + + this.entityTypeTag.location().getPath().replace('/', '.'); + boolean moddersDidAGoodJob = I18n.exists(key); + + var out = new ArrayList(); + out.add(moddersDidAGoodJob + ? Component.translatable(key) + : Component.literal("#" + entityTypeTag)); + if (advanced && moddersDidAGoodJob) { + out.add(Component.literal("#" + entityTypeTag).withStyle(ChatFormatting.DARK_GRAY)); + } + return out; + } + + @Override + public Entity exampleEntity(ClientLevel level) { + var someEntityTys = Registry.ENTITY_TYPE.getTagOrEmpty(this.entityTypeTag).iterator(); + if (someEntityTys.hasNext()) { + var someTy = someEntityTys.next(); + return someTy.value().create(level); + } else { + return null; + } + } + + @Override + public JsonObject serialize() { + var obj = new JsonObject(); + obj.addProperty("type", Type.ENTITY_TAG.getSerializedName()); + + obj.addProperty("tag", this.entityTypeTag.location().toString()); + + return obj; + } + + @Override + public void write(FriendlyByteBuf buf) { + buf.writeVarInt(Type.ENTITY_TAG.ordinal()); + + buf.writeResourceLocation(this.entityTypeTag.location()); + } + + public static EntityTagIngredient deserialize(JsonObject obj) { + var typeLoc = ResourceLocation.tryParse(GsonHelper.getAsString(obj, "entityType")); + var type = TagKey.create(Registry.ENTITY_TYPE_REGISTRY, typeLoc); + return new EntityTagIngredient(type); + } + + public static EntityTagIngredient read(FriendlyByteBuf buf) { + var typeLoc = buf.readResourceLocation(); + var type = TagKey.create(Registry.ENTITY_TYPE_REGISTRY, typeLoc); + return new EntityTagIngredient(type); + } +} diff --git a/Common/src/main/java/at/petrak/hexcasting/common/recipe/ingredient/brainsweep/EntityTypeIngredient.java b/Common/src/main/java/at/petrak/hexcasting/common/recipe/ingredient/brainsweep/EntityTypeIngredient.java new file mode 100644 index 00000000..2b0bf664 --- /dev/null +++ b/Common/src/main/java/at/petrak/hexcasting/common/recipe/ingredient/brainsweep/EntityTypeIngredient.java @@ -0,0 +1,67 @@ +package at.petrak.hexcasting.common.recipe.ingredient.brainsweep; + +import com.google.gson.JsonObject; +import net.minecraft.client.multiplayer.ClientLevel; +import net.minecraft.core.Registry; +import net.minecraft.network.FriendlyByteBuf; +import net.minecraft.network.chat.Component; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.server.level.ServerLevel; +import net.minecraft.util.GsonHelper; +import net.minecraft.world.entity.Entity; +import net.minecraft.world.entity.EntityType; + +import java.util.List; + +public class EntityTypeIngredient extends BrainsweepeeIngredient { + public final EntityType entityType; + + public EntityTypeIngredient(EntityType entityType) { + this.entityType = entityType; + } + + @Override + public boolean test(Entity entity, ServerLevel level) { + // entity types are singletons + return entity.getType() == this.entityType; + } + + @Override + public List getTooltip(boolean advanced) { + return List.of(this.entityType.getDescription()); + } + + @Override + public Entity exampleEntity(ClientLevel level) { + return this.entityType.create(level); + } + + @Override + public JsonObject serialize() { + var obj = new JsonObject(); + obj.addProperty("type", Type.ENTITY_TYPE.getSerializedName()); + obj.addProperty("entityType", Registry.ENTITY_TYPE.getKey(this.entityType).toString()); + + return obj; + } + + @Override + public void write(FriendlyByteBuf buf) { + buf.writeVarInt(Type.ENTITY_TYPE.ordinal()); + + buf.writeVarInt(Registry.ENTITY_TYPE.getId(this.entityType)); + } + + public static EntityTypeIngredient deserialize(JsonObject obj) { + var typeLoc = ResourceLocation.tryParse(GsonHelper.getAsString(obj, "entityType")); + if (!Registry.ENTITY_TYPE.containsKey(typeLoc)) { + throw new IllegalArgumentException("unknown entity type " + typeLoc); + } + return new EntityTypeIngredient(Registry.ENTITY_TYPE.get(typeLoc)); + } + + public static EntityTypeIngredient read(FriendlyByteBuf buf) { + var tyId = buf.readVarInt(); + return new EntityTypeIngredient(Registry.ENTITY_TYPE.byId(tyId)); + } +} diff --git a/Common/src/main/java/at/petrak/hexcasting/common/recipe/ingredient/brainsweep/VillagerBrainsweepIngredient.java b/Common/src/main/java/at/petrak/hexcasting/common/recipe/ingredient/brainsweep/VillagerBrainsweepIngredient.java deleted file mode 100644 index 8c5d734a..00000000 --- a/Common/src/main/java/at/petrak/hexcasting/common/recipe/ingredient/brainsweep/VillagerBrainsweepIngredient.java +++ /dev/null @@ -1,200 +0,0 @@ -package at.petrak.hexcasting.common.recipe.ingredient.brainsweep; - -import at.petrak.hexcasting.xplat.IXplatAbstractions; -import com.google.gson.JsonObject; -import net.minecraft.ChatFormatting; -import net.minecraft.client.multiplayer.ClientLevel; -import net.minecraft.core.Registry; -import net.minecraft.network.FriendlyByteBuf; -import net.minecraft.network.chat.Component; -import net.minecraft.network.chat.MutableComponent; -import net.minecraft.resources.ResourceLocation; -import net.minecraft.server.level.ServerLevel; -import net.minecraft.util.GsonHelper; -import net.minecraft.world.entity.Entity; -import net.minecraft.world.entity.EntityType; -import net.minecraft.world.entity.npc.Villager; -import net.minecraft.world.entity.npc.VillagerProfession; -import net.minecraft.world.entity.npc.VillagerType; -import org.jetbrains.annotations.Nullable; - -import java.util.ArrayList; -import java.util.List; -import java.util.Objects; - -/** - * Special case for villagers so we can have biome/profession/level reqs - */ -public class VillagerBrainsweepIngredient extends BrainsweepIngredient { - public final @Nullable ResourceLocation profession; - public final @Nullable ResourceLocation biome; - public final int minLevel; - - public VillagerBrainsweepIngredient( - @Nullable ResourceLocation profession, - @Nullable ResourceLocation biome, // aka their "type" - int minLevel - ) { - this.profession = profession; - this.biome = biome; - this.minLevel = minLevel; - } - - @Override - public boolean test(Entity entity, ServerLevel level) { - if (!(entity instanceof Villager villager)) return false; - - var data = villager.getVillagerData(); - ResourceLocation profID = IXplatAbstractions.INSTANCE.getID(data.getProfession()); - - return (this.profession == null || this.profession.equals(profID)) - && (this.biome == null || this.biome.equals(Registry.VILLAGER_TYPE.getKey(data.getType()))) - && this.minLevel <= data.getLevel(); - } - - @Override - public Entity exampleEntity(ClientLevel level) { - var type = this.biome == null - ? VillagerType.PLAINS - : Registry.VILLAGER_TYPE.get(this.biome); - var out = new Villager(EntityType.VILLAGER, level, type); - - var profession = this.profession == null - ? VillagerProfession.TOOLSMITH - : Registry.VILLAGER_PROFESSION.get(this.profession); - out.getVillagerData().setProfession(profession); - out.getVillagerData().setLevel(Math.max(this.minLevel, 1)); - return out; - } - - @Override - public List getTooltip(boolean advanced) { - List tooltip = new ArrayList<>(); - tooltip.add(name()); - - if (advanced) { - if (minLevel >= 5) { - tooltip.add(Component.translatable("hexcasting.tooltip.brainsweep.level", 5) - .withStyle(ChatFormatting.DARK_GRAY)); - } else if (minLevel > 1) { - tooltip.add(Component.translatable("hexcasting.tooltip.brainsweep.min_level", minLevel) - .withStyle(ChatFormatting.DARK_GRAY)); - } - - if (biome != null) { - tooltip.add(Component.literal(biome.toString()).withStyle(ChatFormatting.DARK_GRAY)); - } - - ResourceLocation displayId = Objects.requireNonNullElseGet(profession, - () -> Registry.ENTITY_TYPE.getKey(EntityType.VILLAGER)); - tooltip.add(Component.literal(displayId.toString()).withStyle(ChatFormatting.DARK_GRAY)); - } - - tooltip.add(getModNameComponent()); - - return tooltip; - } - - public Component name() { - MutableComponent component = Component.literal(""); - - boolean addedAny = false; - - if (minLevel >= 5) { - component.append(Component.translatable("merchant.level.5")); - addedAny = true; - } else if (minLevel > 1) { - component.append(Component.translatable("merchant.level." + minLevel)); - addedAny = true; - } else if (profession != null) { - component.append(Component.translatable("merchant.level.1")); - addedAny = true; - } - - if (biome != null) { - if (addedAny) { - component.append(" "); - } - component.append(Component.translatable("biome.minecraft." + biome.getPath())); - addedAny = true; - } - - if (profession != null) { - // We've for sure added something - component.append(" "); - component.append(Component.translatable("entity.minecraft.villager." + profession.getPath())); - } else { - if (addedAny) { - component.append(" "); - } - component.append(EntityType.VILLAGER.getDescription()); - } - - return component; - } - - public Component getModNameComponent() { - String namespace = profession == null ? "minecraft" : profession.getNamespace(); - String mod = IXplatAbstractions.INSTANCE.getModName(namespace); - return Component.literal(mod).withStyle(ChatFormatting.BLUE, ChatFormatting.ITALIC); - } - - @Override - public JsonObject serialize() { - var obj = new JsonObject(); - if (this.profession != null) { - obj.addProperty("profession", this.profession.toString()); - } - if (this.biome != null) { - obj.addProperty("biome", this.biome.toString()); - } - obj.addProperty("minLevel", this.minLevel); - return obj; - } - - @Override - public void write(FriendlyByteBuf buf) { - if (this.profession != null) { - buf.writeVarInt(1); - buf.writeResourceLocation(this.profession); - } else { - buf.writeVarInt(0); - } - if (this.biome != null) { - buf.writeVarInt(1); - buf.writeResourceLocation(this.biome); - } else { - buf.writeVarInt(0); - } - buf.writeInt(this.minLevel); - } - - public static VillagerBrainsweepIngredient deserialize(JsonObject json) { - ResourceLocation profession = null; - if (json.has("profession") && !json.get("profession").isJsonNull()) { - profession = new ResourceLocation(GsonHelper.getAsString(json, "profession")); - } - ResourceLocation biome = null; - if (json.has("biome") && !json.get("biome").isJsonNull()) { - biome = new ResourceLocation(GsonHelper.getAsString(json, "biome")); - } - int minLevel = GsonHelper.getAsInt(json, "minLevel"); - int cost = GsonHelper.getAsInt(json, "cost"); - return new VillagerBrainsweepIngredient(profession, biome, minLevel); - } - - public static VillagerBrainsweepIngredient read(FriendlyByteBuf buf) { - ResourceLocation profession = null; - var hasProfession = buf.readVarInt(); - if (hasProfession != 0) { - profession = buf.readResourceLocation(); - } - ResourceLocation biome = null; - var hasBiome = buf.readVarInt(); - if (hasBiome != 0) { - biome = buf.readResourceLocation(); - } - int minLevel = buf.readInt(); - return new VillagerBrainsweepIngredient(profession, biome, minLevel); - } -} diff --git a/Common/src/main/java/at/petrak/hexcasting/common/recipe/ingredient/brainsweep/VillagerIngredient.java b/Common/src/main/java/at/petrak/hexcasting/common/recipe/ingredient/brainsweep/VillagerIngredient.java new file mode 100644 index 00000000..ba62cfe1 --- /dev/null +++ b/Common/src/main/java/at/petrak/hexcasting/common/recipe/ingredient/brainsweep/VillagerIngredient.java @@ -0,0 +1,202 @@ +package at.petrak.hexcasting.common.recipe.ingredient.brainsweep; + +import at.petrak.hexcasting.xplat.IXplatAbstractions; +import com.google.gson.JsonObject; +import net.minecraft.ChatFormatting; +import net.minecraft.client.multiplayer.ClientLevel; +import net.minecraft.core.Registry; +import net.minecraft.network.FriendlyByteBuf; +import net.minecraft.network.chat.Component; +import net.minecraft.network.chat.MutableComponent; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.server.level.ServerLevel; +import net.minecraft.util.GsonHelper; +import net.minecraft.world.entity.Entity; +import net.minecraft.world.entity.EntityType; +import net.minecraft.world.entity.npc.Villager; +import net.minecraft.world.entity.npc.VillagerProfession; +import net.minecraft.world.entity.npc.VillagerType; +import org.jetbrains.annotations.Nullable; + +import java.util.ArrayList; +import java.util.List; +import java.util.Objects; + +/** + * Special case for villagers so we can have biome/profession/level reqs + */ +public class VillagerIngredient extends BrainsweepeeIngredient { + public final @Nullable ResourceLocation profession; + public final @Nullable ResourceLocation biome; + public final int minLevel; + + public VillagerIngredient( + @Nullable ResourceLocation profession, + @Nullable ResourceLocation biome, // aka their "type" + int minLevel + ) { + this.profession = profession; + this.biome = biome; + this.minLevel = minLevel; + } + + @Override + public boolean test(Entity entity, ServerLevel level) { + if (!(entity instanceof Villager villager)) return false; + + var data = villager.getVillagerData(); + ResourceLocation profID = IXplatAbstractions.INSTANCE.getID(data.getProfession()); + + return (this.profession == null || this.profession.equals(profID)) + && (this.biome == null || this.biome.equals(Registry.VILLAGER_TYPE.getKey(data.getType()))) + && this.minLevel <= data.getLevel(); + } + + @Override + public Entity exampleEntity(ClientLevel level) { + var type = this.biome == null + ? VillagerType.PLAINS + : Registry.VILLAGER_TYPE.get(this.biome); + var out = new Villager(EntityType.VILLAGER, level, type); + + var profession = this.profession == null + ? VillagerProfession.TOOLSMITH + : Registry.VILLAGER_PROFESSION.get(this.profession); + out.getVillagerData().setProfession(profession); + out.getVillagerData().setLevel(Math.max(this.minLevel, 1)); + return out; + } + + @Override + public List getTooltip(boolean advanced) { + List tooltip = new ArrayList<>(); + tooltip.add(name()); + + if (advanced) { + if (minLevel >= 5) { + tooltip.add(Component.translatable("hexcasting.tooltip.brainsweep.level", 5) + .withStyle(ChatFormatting.DARK_GRAY)); + } else if (minLevel > 1) { + tooltip.add(Component.translatable("hexcasting.tooltip.brainsweep.min_level", minLevel) + .withStyle(ChatFormatting.DARK_GRAY)); + } + + if (biome != null) { + tooltip.add(Component.literal(biome.toString()).withStyle(ChatFormatting.DARK_GRAY)); + } + + ResourceLocation displayId = Objects.requireNonNullElseGet(profession, + () -> Registry.ENTITY_TYPE.getKey(EntityType.VILLAGER)); + tooltip.add(Component.literal(displayId.toString()).withStyle(ChatFormatting.DARK_GRAY)); + } + + tooltip.add(getModNameComponent()); + + return tooltip; + } + + public Component name() { + MutableComponent component = Component.literal(""); + + boolean addedAny = false; + + if (minLevel >= 5) { + component.append(Component.translatable("merchant.level.5")); + addedAny = true; + } else if (minLevel > 1) { + component.append(Component.translatable("merchant.level." + minLevel)); + addedAny = true; + } else if (profession != null) { + component.append(Component.translatable("merchant.level.1")); + addedAny = true; + } + + if (biome != null) { + if (addedAny) { + component.append(" "); + } + component.append(Component.translatable("biome.minecraft." + biome.getPath())); + addedAny = true; + } + + if (profession != null) { + // We've for sure added something + component.append(" "); + component.append(Component.translatable("entity.minecraft.villager." + profession.getPath())); + } else { + if (addedAny) { + component.append(" "); + } + component.append(EntityType.VILLAGER.getDescription()); + } + + return component; + } + + public Component getModNameComponent() { + String namespace = profession == null ? "minecraft" : profession.getNamespace(); + String mod = IXplatAbstractions.INSTANCE.getModName(namespace); + return Component.literal(mod).withStyle(ChatFormatting.BLUE, ChatFormatting.ITALIC); + } + + @Override + public JsonObject serialize() { + var obj = new JsonObject(); + obj.addProperty("type", Type.VILLAGER.getSerializedName()); + + if (this.profession != null) { + obj.addProperty("profession", this.profession.toString()); + } + if (this.biome != null) { + obj.addProperty("biome", this.biome.toString()); + } + obj.addProperty("minLevel", this.minLevel); + return obj; + } + + @Override + public void write(FriendlyByteBuf buf) { + if (this.profession != null) { + buf.writeVarInt(1); + buf.writeResourceLocation(this.profession); + } else { + buf.writeVarInt(0); + } + if (this.biome != null) { + buf.writeVarInt(1); + buf.writeResourceLocation(this.biome); + } else { + buf.writeVarInt(0); + } + buf.writeInt(this.minLevel); + } + + public static VillagerIngredient deserialize(JsonObject json) { + ResourceLocation profession = null; + if (json.has("profession") && !json.get("profession").isJsonNull()) { + profession = new ResourceLocation(GsonHelper.getAsString(json, "profession")); + } + ResourceLocation biome = null; + if (json.has("biome") && !json.get("biome").isJsonNull()) { + biome = new ResourceLocation(GsonHelper.getAsString(json, "biome")); + } + int minLevel = GsonHelper.getAsInt(json, "minLevel"); + int cost = GsonHelper.getAsInt(json, "cost"); + return new VillagerIngredient(profession, biome, minLevel); + } + + public static VillagerIngredient read(FriendlyByteBuf buf) { + ResourceLocation profession = null; + var hasProfession = buf.readVarInt(); + if (hasProfession != 0) { + profession = buf.readResourceLocation(); + } + ResourceLocation biome = null; + var hasBiome = buf.readVarInt(); + if (hasBiome != 0) { + biome = buf.readResourceLocation(); + } + int minLevel = buf.readInt(); + return new VillagerIngredient(profession, biome, minLevel); + } +} diff --git a/Common/src/main/java/at/petrak/hexcasting/datagen/recipe/HexplatRecipes.kt b/Common/src/main/java/at/petrak/hexcasting/datagen/recipe/HexplatRecipes.kt index 7b6799bf..17c69dc5 100644 --- a/Common/src/main/java/at/petrak/hexcasting/datagen/recipe/HexplatRecipes.kt +++ b/Common/src/main/java/at/petrak/hexcasting/datagen/recipe/HexplatRecipes.kt @@ -3,7 +3,6 @@ package at.petrak.hexcasting.datagen.recipe import at.petrak.hexcasting.api.HexAPI import at.petrak.hexcasting.api.advancements.OvercastTrigger import at.petrak.hexcasting.api.misc.MediaConstants -import at.petrak.hexcasting.api.mod.HexItemTags import at.petrak.hexcasting.common.items.ItemStaff import at.petrak.hexcasting.common.items.colorizer.ItemPrideColorizer import at.petrak.hexcasting.common.lib.HexBlocks @@ -11,7 +10,7 @@ import at.petrak.hexcasting.common.lib.HexItems import at.petrak.hexcasting.common.recipe.SealFocusRecipe import at.petrak.hexcasting.common.recipe.SealSpellbookRecipe import at.petrak.hexcasting.common.recipe.ingredient.StateIngredientHelper -import at.petrak.hexcasting.common.recipe.ingredient.brainsweep.VillagerBrainsweepIngredient +import at.petrak.hexcasting.common.recipe.ingredient.brainsweep.VillagerIngredient import at.petrak.hexcasting.datagen.IXplatConditionsBuilder import at.petrak.hexcasting.datagen.IXplatIngredients import at.petrak.hexcasting.datagen.recipe.builders.BrainsweepRecipeBuilder @@ -352,37 +351,37 @@ class HexplatRecipes( .unlockedBy("enlightenment", enlightenment).save(recipes) BrainsweepRecipeBuilder(StateIngredientHelper.of(Blocks.AMETHYST_BLOCK), - VillagerBrainsweepIngredient(null, null, 3), + VillagerIngredient(null, null, 3), Blocks.BUDDING_AMETHYST.defaultBlockState(), MediaConstants.CRYSTAL_UNIT * 10) .unlockedBy("enlightenment", enlightenment) .save(recipes, modLoc("brainsweep/budding_amethyst")) BrainsweepRecipeBuilder(StateIngredientHelper.of(HexBlocks.EMPTY_IMPETUS), - VillagerBrainsweepIngredient(ResourceLocation("toolsmith"), null, 2), + VillagerIngredient(ResourceLocation("toolsmith"), null, 2), HexBlocks.IMPETUS_RIGHTCLICK.defaultBlockState(), MediaConstants.CRYSTAL_UNIT * 10) .unlockedBy("enlightenment", enlightenment) .save(recipes, modLoc("brainsweep/impetus_rightclick")) BrainsweepRecipeBuilder(StateIngredientHelper.of(HexBlocks.EMPTY_IMPETUS), - VillagerBrainsweepIngredient(ResourceLocation("fletcher"), null, 2), + VillagerIngredient(ResourceLocation("fletcher"), null, 2), HexBlocks.IMPETUS_LOOK.defaultBlockState(), MediaConstants.CRYSTAL_UNIT * 10) .unlockedBy("enlightenment", enlightenment) .save(recipes, modLoc("brainsweep/impetus_look")) BrainsweepRecipeBuilder(StateIngredientHelper.of(HexBlocks.EMPTY_IMPETUS), - VillagerBrainsweepIngredient(ResourceLocation("cleric"), null, 2), + VillagerIngredient(ResourceLocation("cleric"), null, 2), HexBlocks.IMPETUS_STOREDPLAYER.defaultBlockState(), MediaConstants.CRYSTAL_UNIT * 10) .unlockedBy("enlightenment", enlightenment) .save(recipes, modLoc("brainsweep/impetus_storedplayer")) BrainsweepRecipeBuilder(StateIngredientHelper.of(HexBlocks.EMPTY_DIRECTRIX), - VillagerBrainsweepIngredient(ResourceLocation("mason"), null, 1), + VillagerIngredient(ResourceLocation("mason"), null, 1), HexBlocks.DIRECTRIX_REDSTONE.defaultBlockState(), MediaConstants.CRYSTAL_UNIT * 10) .unlockedBy("enlightenment", enlightenment) .save(recipes, modLoc("brainsweep/directrix_redstone")) BrainsweepRecipeBuilder(StateIngredientHelper.of(HexBlocks.AKASHIC_LIGATURE), - VillagerBrainsweepIngredient(ResourceLocation("librarian"), null, 5), + VillagerIngredient(ResourceLocation("librarian"), null, 5), HexBlocks.AKASHIC_RECORD.defaultBlockState(), MediaConstants.CRYSTAL_UNIT * 10) .unlockedBy("enlightenment", enlightenment) .save(recipes, modLoc("brainsweep/akashic_record")) diff --git a/Common/src/main/java/at/petrak/hexcasting/datagen/recipe/builders/BrainsweepRecipeBuilder.java b/Common/src/main/java/at/petrak/hexcasting/datagen/recipe/builders/BrainsweepRecipeBuilder.java index d2b99fed..c3f5c76f 100644 --- a/Common/src/main/java/at/petrak/hexcasting/datagen/recipe/builders/BrainsweepRecipeBuilder.java +++ b/Common/src/main/java/at/petrak/hexcasting/datagen/recipe/builders/BrainsweepRecipeBuilder.java @@ -3,7 +3,7 @@ package at.petrak.hexcasting.datagen.recipe.builders; import at.petrak.hexcasting.common.recipe.HexRecipeStuffRegistry; import at.petrak.hexcasting.common.recipe.ingredient.StateIngredient; import at.petrak.hexcasting.common.recipe.ingredient.StateIngredientHelper; -import at.petrak.hexcasting.common.recipe.ingredient.brainsweep.BrainsweepIngredient; +import at.petrak.hexcasting.common.recipe.ingredient.brainsweep.BrainsweepeeIngredient; import com.google.gson.JsonObject; import net.minecraft.advancements.Advancement; import net.minecraft.advancements.AdvancementRewards; @@ -21,86 +21,86 @@ import org.jetbrains.annotations.Nullable; import java.util.function.Consumer; public class BrainsweepRecipeBuilder implements RecipeBuilder { - private final StateIngredient blockIn; - private final BrainsweepIngredient villagerIn; - private final int mediaCost; - private final BlockState result; + private final StateIngredient blockIn; + private final BrainsweepeeIngredient villagerIn; + private final int mediaCost; + private final BlockState result; - private final Advancement.Builder advancement; + private final Advancement.Builder advancement; - public BrainsweepRecipeBuilder(StateIngredient blockIn, BrainsweepIngredient villagerIn, BlockState result, - int mediaCost) { - this.blockIn = blockIn; - this.villagerIn = villagerIn; - this.result = result; - this.mediaCost = mediaCost; - this.advancement = Advancement.Builder.advancement(); - } + public BrainsweepRecipeBuilder(StateIngredient blockIn, BrainsweepeeIngredient villagerIn, BlockState result, + int mediaCost) { + this.blockIn = blockIn; + this.villagerIn = villagerIn; + this.result = result; + this.mediaCost = mediaCost; + this.advancement = Advancement.Builder.advancement(); + } - @Override - public RecipeBuilder unlockedBy(String pCriterionName, CriterionTriggerInstance pCriterionTrigger) { - this.advancement.addCriterion(pCriterionName, pCriterionTrigger); - return this; - } + @Override + public RecipeBuilder unlockedBy(String pCriterionName, CriterionTriggerInstance pCriterionTrigger) { + this.advancement.addCriterion(pCriterionName, pCriterionTrigger); + return this; + } - @Override - public RecipeBuilder group(@Nullable String pGroupName) { - return this; - } + @Override + public RecipeBuilder group(@Nullable String pGroupName) { + return this; + } - @Override - public Item getResult() { - return this.result.getBlock().asItem(); - } + @Override + public Item getResult() { + return this.result.getBlock().asItem(); + } - @Override - public void save(Consumer pFinishedRecipeConsumer, ResourceLocation pRecipeId) { - if (this.advancement.getCriteria().isEmpty()) { - throw new IllegalStateException("No way of obtaining recipe " + pRecipeId); - } + @Override + public void save(Consumer pFinishedRecipeConsumer, ResourceLocation pRecipeId) { + if (this.advancement.getCriteria().isEmpty()) { + throw new IllegalStateException("No way of obtaining recipe " + pRecipeId); + } - this.advancement.parent(new ResourceLocation("recipes/root")) - .addCriterion("has_the_recipe", RecipeUnlockedTrigger.unlocked(pRecipeId)) - .rewards(AdvancementRewards.Builder.recipe(pRecipeId)) - .requirements(RequirementsStrategy.OR); - pFinishedRecipeConsumer.accept(new Result( - pRecipeId, - this.blockIn, this.villagerIn, this.mediaCost, this.result, - this.advancement, - new ResourceLocation(pRecipeId.getNamespace(), "recipes/brainsweep/" + pRecipeId.getPath()))); - } + this.advancement.parent(new ResourceLocation("recipes/root")) + .addCriterion("has_the_recipe", RecipeUnlockedTrigger.unlocked(pRecipeId)) + .rewards(AdvancementRewards.Builder.recipe(pRecipeId)) + .requirements(RequirementsStrategy.OR); + pFinishedRecipeConsumer.accept(new Result( + pRecipeId, + this.blockIn, this.villagerIn, this.mediaCost, this.result, + this.advancement, + new ResourceLocation(pRecipeId.getNamespace(), "recipes/brainsweep/" + pRecipeId.getPath()))); + } - public record Result(ResourceLocation id, StateIngredient blockIn, BrainsweepIngredient villagerIn, - int mediaCost, BlockState result, Advancement.Builder advancement, - ResourceLocation advancementId) implements FinishedRecipe { - @Override - public void serializeRecipeData(JsonObject json) { - json.add("blockIn", this.blockIn.serialize()); - json.add("entityIn", this.villagerIn.serialize()); - json.addProperty("cost", this.mediaCost); - json.add("result", StateIngredientHelper.serializeBlockState(this.result)); - } + public record Result(ResourceLocation id, StateIngredient blockIn, BrainsweepeeIngredient villagerIn, + int mediaCost, BlockState result, Advancement.Builder advancement, + ResourceLocation advancementId) implements FinishedRecipe { + @Override + public void serializeRecipeData(JsonObject json) { + json.add("blockIn", this.blockIn.serialize()); + json.add("entityIn", this.villagerIn.serialize()); + json.addProperty("cost", this.mediaCost); + json.add("result", StateIngredientHelper.serializeBlockState(this.result)); + } - @Override - public ResourceLocation getId() { - return this.id; - } + @Override + public ResourceLocation getId() { + return this.id; + } - @Override - public RecipeSerializer getType() { - return HexRecipeStuffRegistry.BRAINSWEEP; - } + @Override + public RecipeSerializer getType() { + return HexRecipeStuffRegistry.BRAINSWEEP; + } - @Nullable - @Override - public JsonObject serializeAdvancement() { - return this.advancement.serializeToJson(); - } + @Nullable + @Override + public JsonObject serializeAdvancement() { + return this.advancement.serializeToJson(); + } - @Nullable - @Override - public ResourceLocation getAdvancementId() { - return this.advancementId; - } - } + @Nullable + @Override + public ResourceLocation getAdvancementId() { + return this.advancementId; + } + } } diff --git a/Common/src/main/java/at/petrak/hexcasting/interop/patchouli/BrainsweepProcessor.java b/Common/src/main/java/at/petrak/hexcasting/interop/patchouli/BrainsweepProcessor.java index 0ac3b51f..33cfad4e 100644 --- a/Common/src/main/java/at/petrak/hexcasting/interop/patchouli/BrainsweepProcessor.java +++ b/Common/src/main/java/at/petrak/hexcasting/interop/patchouli/BrainsweepProcessor.java @@ -2,8 +2,8 @@ package at.petrak.hexcasting.interop.patchouli; import at.petrak.hexcasting.common.recipe.BrainsweepRecipe; import at.petrak.hexcasting.common.recipe.HexRecipeStuffRegistry; -import at.petrak.hexcasting.common.recipe.ingredient.brainsweep.EntityBrainsweepIngredient; -import at.petrak.hexcasting.common.recipe.ingredient.brainsweep.VillagerBrainsweepIngredient; +import at.petrak.hexcasting.common.recipe.ingredient.brainsweep.EntityTypeIngredient; +import at.petrak.hexcasting.common.recipe.ingredient.brainsweep.VillagerIngredient; import net.minecraft.client.Minecraft; import net.minecraft.resources.ResourceLocation; import net.minecraft.world.item.ItemStack; @@ -14,69 +14,69 @@ import vazkii.patchouli.api.IVariableProvider; import java.util.Objects; public class BrainsweepProcessor implements IComponentProcessor { - private BrainsweepRecipe recipe; + private BrainsweepRecipe recipe; - @Override - public void setup(IVariableProvider vars) { - var id = new ResourceLocation(vars.get("recipe").asString()); + @Override + public void setup(IVariableProvider vars) { + var id = new ResourceLocation(vars.get("recipe").asString()); - var recman = Minecraft.getInstance().level.getRecipeManager(); - var brainsweepings = recman.getAllRecipesFor(HexRecipeStuffRegistry.BRAINSWEEP_TYPE); - for (var poisonApples : brainsweepings) { - if (poisonApples.getId().equals(id)) { - this.recipe = poisonApples; - break; - } - } - } + var recman = Minecraft.getInstance().level.getRecipeManager(); + var brainsweepings = recman.getAllRecipesFor(HexRecipeStuffRegistry.BRAINSWEEP_TYPE); + for (var poisonApples : brainsweepings) { + if (poisonApples.getId().equals(id)) { + this.recipe = poisonApples; + break; + } + } + } - @Override - public IVariable process(String key) { - if (this.recipe == null) { - return null; - } + @Override + public IVariable process(String key) { + if (this.recipe == null) { + return null; + } - switch (key) { - case "header" -> { - return IVariable.from(this.recipe.result().getBlock().getName()); - } - case "input" -> { - var inputStacks = this.recipe.blockIn().getDisplayedStacks(); - return IVariable.from(inputStacks.toArray(new ItemStack[0])); - } - case "result" -> { - return IVariable.from(new ItemStack(this.recipe.result().getBlock())); - } + switch (key) { + case "header" -> { + return IVariable.from(this.recipe.result().getBlock().getName()); + } + case "input" -> { + var inputStacks = this.recipe.blockIn().getDisplayedStacks(); + return IVariable.from(inputStacks.toArray(new ItemStack[0])); + } + case "result" -> { + return IVariable.from(new ItemStack(this.recipe.result().getBlock())); + } - case "entity" -> { - if (this.recipe.entityIn() instanceof VillagerBrainsweepIngredient villager) { - var profession = Objects.requireNonNullElse(villager.profession, - new ResourceLocation("toolsmith")); - var biome = Objects.requireNonNullElse(villager.biome, - new ResourceLocation("plains")); - var level = villager.minLevel; - var iHatePatchouli = String.format( - "minecraft:villager{VillagerData:{profession:'%s',type:'%s',level:%d}}", - profession, biome, level); - return IVariable.wrap(iHatePatchouli); - } else if (this.recipe.entityIn() instanceof EntityBrainsweepIngredient entity) { - // TODO - return IVariable.wrap("minecraft:chicken"); - } else { - throw new IllegalStateException(); - } - } - case "entityTooltip" -> { - Minecraft mc = Minecraft.getInstance(); - return IVariable.wrapList(this.recipe.entityIn() - .getTooltip(mc.options.advancedItemTooltips) - .stream() - .map(IVariable::from) - .toList()); - } - default -> { - return null; - } - } - } + case "entity" -> { + if (this.recipe.entityIn() instanceof VillagerIngredient villager) { + var profession = Objects.requireNonNullElse(villager.profession, + new ResourceLocation("toolsmith")); + var biome = Objects.requireNonNullElse(villager.biome, + new ResourceLocation("plains")); + var level = villager.minLevel; + var iHatePatchouli = String.format( + "minecraft:villager{VillagerData:{profession:'%s',type:'%s',level:%d}}", + profession, biome, level); + return IVariable.wrap(iHatePatchouli); + } else if (this.recipe.entityIn() instanceof EntityTypeIngredient entity) { + // TODO + return IVariable.wrap("minecraft:chicken"); + } else { + throw new IllegalStateException(); + } + } + case "entityTooltip" -> { + Minecraft mc = Minecraft.getInstance(); + return IVariable.wrapList(this.recipe.entityIn() + .getTooltip(mc.options.advancedItemTooltips) + .stream() + .map(IVariable::from) + .toList()); + } + default -> { + return null; + } + } + } } diff --git a/Fabric/src/main/java/at/petrak/hexcasting/fabric/interop/emi/BrainsweepeeEmiStack.java b/Fabric/src/main/java/at/petrak/hexcasting/fabric/interop/emi/BrainsweepeeEmiStack.java index 9a30ba45..1580204a 100644 --- a/Fabric/src/main/java/at/petrak/hexcasting/fabric/interop/emi/BrainsweepeeEmiStack.java +++ b/Fabric/src/main/java/at/petrak/hexcasting/fabric/interop/emi/BrainsweepeeEmiStack.java @@ -4,7 +4,7 @@ import at.petrak.hexcasting.client.ClientTickCounter; import at.petrak.hexcasting.client.RenderLib; import at.petrak.hexcasting.client.shader.FakeBufferSource; import at.petrak.hexcasting.client.shader.HexRenderTypes; -import at.petrak.hexcasting.common.recipe.ingredient.brainsweep.BrainsweepIngredient; +import at.petrak.hexcasting.common.recipe.ingredient.brainsweep.BrainsweepeeIngredient; import com.mojang.blaze3d.systems.RenderSystem; import com.mojang.blaze3d.vertex.PoseStack; import dev.emi.emi.api.render.EmiRender; @@ -34,191 +34,191 @@ import static at.petrak.hexcasting.api.HexAPI.modLoc; import static at.petrak.hexcasting.client.RenderLib.renderEntity; public class BrainsweepeeEmiStack extends EmiStack { - private final VillagerEntry entry; - public final BrainsweepIngredient ingredient; - public final boolean mindless; + private final VillagerEntry entry; + public final BrainsweepeeIngredient ingredient; + public final boolean mindless; - private final ResourceLocation id; + private final ResourceLocation id; - public BrainsweepeeEmiStack(BrainsweepIngredient villager) { - this(villager, false); - } + public BrainsweepeeEmiStack(BrainsweepeeIngredient villager) { + this(villager, false); + } - public BrainsweepeeEmiStack(BrainsweepIngredient villager, boolean mindless) { - this(villager, mindless, 1); - } + public BrainsweepeeEmiStack(BrainsweepeeIngredient villager, boolean mindless) { + this(villager, mindless, 1); + } - public BrainsweepeeEmiStack(BrainsweepIngredient villager, boolean mindless, long amount) { - entry = new VillagerEntry(new VillagerVariant(villager, mindless)); - this.ingredient = villager; - this.mindless = mindless; - this.amount = amount; - // This is so scuffed - this.id = modLoc((Objects.toString(villager.profession()) + villager.minLevel() + mindless) - .replace(':', '-')); - } + public BrainsweepeeEmiStack(BrainsweepeeIngredient villager, boolean mindless, long amount) { + entry = new VillagerEntry(new VillagerVariant(villager, mindless)); + this.ingredient = villager; + this.mindless = mindless; + this.amount = amount; + // This is so scuffed + this.id = modLoc((Objects.toString(villager.profession()) + villager.minLevel() + mindless) + .replace(':', '-')); + } - public static Set matchingStatesForProfession(VillagerProfession profession) { - return Registry.POINT_OF_INTEREST_TYPE.holders() - .filter(profession.heldJobSite()) - .flatMap(it -> it.value().matchingStates().stream()) - .collect(Collectors.toSet()); - } + public static Set matchingStatesForProfession(VillagerProfession profession) { + return Registry.POINT_OF_INTEREST_TYPE.holders() + .filter(profession.heldJobSite()) + .flatMap(it -> it.value().matchingStates().stream()) + .collect(Collectors.toSet()); + } - public static EmiIngredient atLevelOrHigher(BrainsweepIngredient ingredient, boolean remainder) { - if (ingredient.profession() == null) { - return EmiIngredient.of(Registry.VILLAGER_PROFESSION.stream() - .filter(it -> matchingStatesForProfession(it).isEmpty()) - .map(it -> atLevelOrHigher(new BrainsweepIngredient(Registry.VILLAGER_PROFESSION.getKey(it), - ingredient.biome(), ingredient.minLevel()), true)) - .toList()); - } + public static EmiIngredient atLevelOrHigher(BrainsweepeeIngredient ingredient, boolean remainder) { + if (ingredient.profession() == null) { + return EmiIngredient.of(Registry.VILLAGER_PROFESSION.stream() + .filter(it -> matchingStatesForProfession(it).isEmpty()) + .map(it -> atLevelOrHigher(new BrainsweepeeIngredient(Registry.VILLAGER_PROFESSION.getKey(it), + ingredient.biome(), ingredient.minLevel()), true)) + .toList()); + } - BrainsweepeeEmiStack stack = new BrainsweepeeEmiStack(ingredient).orHigher(true); - if (remainder) { - stack.setRemainder(new BrainsweepeeEmiStack(ingredient, true)); - } - return stack; - } + BrainsweepeeEmiStack stack = new BrainsweepeeEmiStack(ingredient).orHigher(true); + if (remainder) { + stack.setRemainder(new BrainsweepeeEmiStack(ingredient, true)); + } + return stack; + } - private boolean orHigher = false; + private boolean orHigher = false; - public BrainsweepeeEmiStack orHigher(boolean orHigher) { - this.orHigher = orHigher; - return this; - } + public BrainsweepeeEmiStack orHigher(boolean orHigher) { + this.orHigher = orHigher; + return this; + } - @Override - public EmiStack copy() { - BrainsweepeeEmiStack e = new BrainsweepeeEmiStack(ingredient, mindless, amount); - e.orHigher(orHigher).setRemainder(getRemainder().copy()); - e.comparison = comparison; - return e; - } + @Override + public EmiStack copy() { + BrainsweepeeEmiStack e = new BrainsweepeeEmiStack(ingredient, mindless, amount); + e.orHigher(orHigher).setRemainder(getRemainder().copy()); + e.comparison = comparison; + return e; + } - @Override - public boolean isEmpty() { - return amount == 0; - } + @Override + public boolean isEmpty() { + return amount == 0; + } - @Override - public CompoundTag getNbt() { - return null; - } + @Override + public CompoundTag getNbt() { + return null; + } - @Override - public Object getKey() { - return id; - } + @Override + public Object getKey() { + return id; + } - @Override - public Entry getEntry() { - return entry; - } + @Override + public Entry getEntry() { + return entry; + } - @Override - public ResourceLocation getId() { - return id; - } + @Override + public ResourceLocation getId() { + return id; + } - @Override - public List getTooltipText() { - Minecraft mc = Minecraft.getInstance(); - boolean advanced = mc.options.advancedItemTooltips; + @Override + public List getTooltipText() { + Minecraft mc = Minecraft.getInstance(); + boolean advanced = mc.options.advancedItemTooltips; - if (mindless) { - List tooltip = new ArrayList<>(); - tooltip.add(Component.translatable("hexcasting.tooltip.brainsweep.product")); + if (mindless) { + List tooltip = new ArrayList<>(); + tooltip.add(Component.translatable("hexcasting.tooltip.brainsweep.product")); - if (advanced) { - if (ingredient.biome() != null) { - tooltip.add(Component.literal(ingredient.biome().toString()).withStyle(ChatFormatting.DARK_GRAY)); - } + if (advanced) { + if (ingredient.biome() != null) { + tooltip.add(Component.literal(ingredient.biome().toString()).withStyle(ChatFormatting.DARK_GRAY)); + } - ResourceLocation displayId = Objects.requireNonNullElseGet(ingredient.profession(), - () -> Registry.ENTITY_TYPE.getKey(EntityType.VILLAGER)); - tooltip.add(Component.literal(displayId.toString()).withStyle(ChatFormatting.DARK_GRAY)); - } + ResourceLocation displayId = Objects.requireNonNullElseGet(ingredient.profession(), + () -> Registry.ENTITY_TYPE.getKey(EntityType.VILLAGER)); + tooltip.add(Component.literal(displayId.toString()).withStyle(ChatFormatting.DARK_GRAY)); + } - tooltip.add(ingredient.getModNameComponent()); - return tooltip; - } + tooltip.add(ingredient.getModNameComponent()); + return tooltip; + } - return ingredient.getTooltip(advanced, orHigher); - } + return ingredient.getTooltip(advanced, orHigher); + } - @Override - public List getTooltip() { - List list = getTooltipText().stream() - .map(Component::getVisualOrderText) - .map(ClientTooltipComponent::create) - .collect(Collectors.toList()); - if (!getRemainder().isEmpty()) { - list.add(EmiTooltipComponents.getRemainderTooltipComponent(this)); - } - return list; - } + @Override + public List getTooltip() { + List list = getTooltipText().stream() + .map(Component::getVisualOrderText) + .map(ClientTooltipComponent::create) + .collect(Collectors.toList()); + if (!getRemainder().isEmpty()) { + list.add(EmiTooltipComponents.getRemainderTooltipComponent(this)); + } + return list; + } - @Override - public Component getName() { - return ingredient.name(); - } + @Override + public Component getName() { + return ingredient.name(); + } - @Override - public void render(PoseStack poseStack, int x, int y, float delta, int flags) { - if ((flags & RENDER_ICON) != 0) { - Minecraft mc = Minecraft.getInstance(); - ClientLevel level = mc.level; - if (level != null) { - Villager villager = RenderLib.prepareVillagerForRendering(ingredient, level); + @Override + public void render(PoseStack poseStack, int x, int y, float delta, int flags) { + if ((flags & RENDER_ICON) != 0) { + Minecraft mc = Minecraft.getInstance(); + ClientLevel level = mc.level; + if (level != null) { + Villager villager = RenderLib.prepareVillagerForRendering(ingredient, level); - RenderSystem.enableBlend(); - RenderSystem.setShaderColor(1.0F, 1.0F, 1.0F, 1.0F); - renderEntity(poseStack, villager, level, x + 8, y + 16, ClientTickCounter.getTotal(), 8, 0, - mindless ? (it) -> new FakeBufferSource(it, HexRenderTypes::getGrayscaleLayer) : it -> it); - } - } + RenderSystem.enableBlend(); + RenderSystem.setShaderColor(1.0F, 1.0F, 1.0F, 1.0F); + renderEntity(poseStack, villager, level, x + 8, y + 16, ClientTickCounter.getTotal(), 8, 0, + mindless ? (it) -> new FakeBufferSource(it, HexRenderTypes::getGrayscaleLayer) : it -> it); + } + } - if ((flags & RENDER_REMAINDER) != 0) { - EmiRender.renderRemainderIcon(this, poseStack, x, y); - } - } + if ((flags & RENDER_REMAINDER) != 0) { + EmiRender.renderRemainderIcon(this, poseStack, x, y); + } + } - public static class VillagerEntry extends EmiStack.Entry { + public static class VillagerEntry extends EmiStack.Entry { - public VillagerEntry(VillagerVariant variant) { - super(variant); - } + public VillagerEntry(VillagerVariant variant) { + super(variant); + } - @Override - public Class getType() { - return VillagerVariant.class; - } + @Override + public Class getType() { + return VillagerVariant.class; + } - @Override - public boolean equals(Object obj) { - if (!(obj instanceof VillagerEntry e)) { - return false; - } + @Override + public boolean equals(Object obj) { + if (!(obj instanceof VillagerEntry e)) { + return false; + } - VillagerVariant self = getValue(); - VillagerVariant other = e.getValue(); + VillagerVariant self = getValue(); + VillagerVariant other = e.getValue(); - ResourceLocation selfBiome = self.ingredient().biome(); - ResourceLocation otherBiome = other.ingredient().biome(); - if (selfBiome != null && otherBiome != null && !selfBiome.equals(otherBiome)) { - return false; - } + ResourceLocation selfBiome = self.ingredient().biome(); + ResourceLocation otherBiome = other.ingredient().biome(); + if (selfBiome != null && otherBiome != null && !selfBiome.equals(otherBiome)) { + return false; + } - ResourceLocation selfProfession = self.ingredient().profession(); - ResourceLocation otherProfession = other.ingredient().profession(); - if (selfProfession != null && otherProfession != null && !selfProfession.equals(otherProfession)) { - return false; - } + ResourceLocation selfProfession = self.ingredient().profession(); + ResourceLocation otherProfession = other.ingredient().profession(); + if (selfProfession != null && otherProfession != null && !selfProfession.equals(otherProfession)) { + return false; + } - return self.ingredient().minLevel() == other.ingredient().minLevel() && self.mindless() == other.mindless(); - } - } + return self.ingredient().minLevel() == other.ingredient().minLevel() && self.mindless() == other.mindless(); + } + } } diff --git a/Fabric/src/main/java/at/petrak/hexcasting/fabric/interop/emi/VillagerVariant.java b/Fabric/src/main/java/at/petrak/hexcasting/fabric/interop/emi/VillagerVariant.java index e956888d..5b06a5cd 100644 --- a/Fabric/src/main/java/at/petrak/hexcasting/fabric/interop/emi/VillagerVariant.java +++ b/Fabric/src/main/java/at/petrak/hexcasting/fabric/interop/emi/VillagerVariant.java @@ -1,7 +1,7 @@ package at.petrak.hexcasting.fabric.interop.emi; -import at.petrak.hexcasting.common.recipe.ingredient.brainsweep.BrainsweepIngredient; +import at.petrak.hexcasting.common.recipe.ingredient.brainsweep.BrainsweepeeIngredient; -public record VillagerVariant(BrainsweepIngredient ingredient, boolean mindless) { - // NO-OP +public record VillagerVariant(BrainsweepeeIngredient ingredient, boolean mindless) { + // NO-OP } From bdbb8b0e83758777924f468a3cfe7a8485c05cf7 Mon Sep 17 00:00:00 2001 From: "petrak@" Date: Fri, 30 Dec 2022 13:00:47 -0500 Subject: [PATCH 30/95] MVP ready --- .../recipe/ingredient/StateIngredientTag.java | 130 ++--- .../brainsweep/BrainsweepeeIngredient.java | 8 + .../brainsweep/EntityTagIngredient.java | 52 +- .../brainsweep/EntityTypeIngredient.java | 32 ++ .../brainsweep/VillagerIngredient.java | 119 ++-- .../datagen/recipe/HexplatRecipes.java | 508 ++++++++++++++++++ .../datagen/recipe/HexplatRecipes.kt | 486 ----------------- .../builders/BrainsweepRecipeBuilder.java | 8 +- .../patchouli/BrainsweepProcessor.java | 39 +- .../03e4de26f1265135874f8cdcaebc09d9c08eb42b | 2 +- .../67cce32b1c3cbbcb1f646605f4914e3f196986c2 | 2 +- .../75bcd4dba6ca7d365462b0ec45e291d1056349c4 | 2 +- .../9fb1092f32d4fcbf9e061ffd718d4ec689c6c95e | 22 +- .../brainsweep/testing/bad_to_the_bone.json | 34 ++ .../brainsweep/testing/flowey_the_flower.json | 34 ++ .../recipes/brainsweep/akashic_record.json | 10 +- .../recipes/brainsweep/budding_amethyst.json | 8 +- .../brainsweep/directrix_redstone.json | 10 +- .../recipes/brainsweep/impetus_look.json | 10 +- .../brainsweep/impetus_rightclick.json | 10 +- .../brainsweep/impetus_storedplayer.json | 10 +- .../brainsweep/testing/bad_to_the_bone.json | 18 + .../brainsweep/testing/flowey_the_flower.json | 19 + ...seal_focus.json => dynamicseal_focus.json} | 0 ...llbook.json => dynamicseal_spellbook.json} | 0 .../interop/emi/BrainsweepeeEmiStack.java | 142 +---- .../fabric/interop/emi/EmiLevelupRecipe.java | 25 - .../interop/emi/EmiProfessionRecipe.java | 17 - .../fabric/interop/emi/EmiVillagerRecipe.java | 73 --- .../fabric/interop/emi/HexEMIPlugin.java | 121 ++--- .../fabric/interop/emi/VillagerVariant.java | 7 - .../9fb1092f32d4fcbf9e061ffd718d4ec689c6c95e | 22 +- .../brainsweep/testing/bad_to_the_bone.json | 34 ++ .../brainsweep/testing/flowey_the_flower.json | 34 ++ .../recipes/brainsweep/akashic_record.json | 3 +- .../recipes/brainsweep/budding_amethyst.json | 1 + .../brainsweep/directrix_redstone.json | 3 +- .../recipes/brainsweep/impetus_look.json | 3 +- .../brainsweep/impetus_rightclick.json | 3 +- .../brainsweep/impetus_storedplayer.json | 3 +- .../brainsweep/testing/bad_to_the_bone.json | 18 + .../brainsweep/testing/flowey_the_flower.json | 19 + ...seal_focus.json => dynamicseal_focus.json} | 0 ...llbook.json => dynamicseal_spellbook.json} | 0 44 files changed, 1107 insertions(+), 994 deletions(-) create mode 100644 Common/src/main/java/at/petrak/hexcasting/datagen/recipe/HexplatRecipes.java delete mode 100644 Common/src/main/java/at/petrak/hexcasting/datagen/recipe/HexplatRecipes.kt create mode 100644 Fabric/src/generated/resources/data/hexcasting/advancements/recipes/brainsweep/brainsweep/testing/bad_to_the_bone.json create mode 100644 Fabric/src/generated/resources/data/hexcasting/advancements/recipes/brainsweep/brainsweep/testing/flowey_the_flower.json create mode 100644 Fabric/src/generated/resources/data/hexcasting/recipes/brainsweep/testing/bad_to_the_bone.json create mode 100644 Fabric/src/generated/resources/data/hexcasting/recipes/brainsweep/testing/flowey_the_flower.json rename Fabric/src/generated/resources/data/hexcasting/recipes/{dynamic/seal_focus.json => dynamicseal_focus.json} (100%) rename Fabric/src/generated/resources/data/hexcasting/recipes/{dynamic/seal_spellbook.json => dynamicseal_spellbook.json} (100%) delete mode 100644 Fabric/src/main/java/at/petrak/hexcasting/fabric/interop/emi/EmiLevelupRecipe.java delete mode 100644 Fabric/src/main/java/at/petrak/hexcasting/fabric/interop/emi/EmiProfessionRecipe.java delete mode 100644 Fabric/src/main/java/at/petrak/hexcasting/fabric/interop/emi/EmiVillagerRecipe.java delete mode 100644 Fabric/src/main/java/at/petrak/hexcasting/fabric/interop/emi/VillagerVariant.java create mode 100644 Forge/src/generated/resources/data/hexcasting/advancements/recipes/brainsweep/brainsweep/testing/bad_to_the_bone.json create mode 100644 Forge/src/generated/resources/data/hexcasting/advancements/recipes/brainsweep/brainsweep/testing/flowey_the_flower.json create mode 100644 Forge/src/generated/resources/data/hexcasting/recipes/brainsweep/testing/bad_to_the_bone.json create mode 100644 Forge/src/generated/resources/data/hexcasting/recipes/brainsweep/testing/flowey_the_flower.json rename Forge/src/generated/resources/data/hexcasting/recipes/{dynamic/seal_focus.json => dynamicseal_focus.json} (100%) rename Forge/src/generated/resources/data/hexcasting/recipes/{dynamic/seal_spellbook.json => dynamicseal_spellbook.json} (100%) diff --git a/Common/src/main/java/at/petrak/hexcasting/common/recipe/ingredient/StateIngredientTag.java b/Common/src/main/java/at/petrak/hexcasting/common/recipe/ingredient/StateIngredientTag.java index 11a59450..923a43d7 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/recipe/ingredient/StateIngredientTag.java +++ b/Common/src/main/java/at/petrak/hexcasting/common/recipe/ingredient/StateIngredientTag.java @@ -19,81 +19,81 @@ import java.util.stream.Stream; import java.util.stream.StreamSupport; public class StateIngredientTag extends StateIngredientBlocks { - private final TagKey tag; + private final TagKey tag; - public StateIngredientTag(ResourceLocation tag) { - super(ImmutableSet.of()); - this.tag = TagKey.create(Registry.BLOCK_REGISTRY, tag); - } + public StateIngredientTag(ResourceLocation tag) { + super(ImmutableSet.of()); + this.tag = TagKey.create(Registry.BLOCK_REGISTRY, tag); + } - public Stream resolve() { - return StreamSupport.stream(Registry.BLOCK.getTagOrEmpty(tag).spliterator(), false) - .map(Holder::value); - } + public Stream resolve() { + return StreamSupport.stream(Registry.BLOCK.getTagOrEmpty(tag).spliterator(), false) + .map(Holder::value); + } - @Override - public boolean test(BlockState state) { - return state.is(tag); - } + @Override + public boolean test(BlockState state) { + return state.is(tag); + } - @Override - public BlockState pick(Random random) { - var values = resolve().toList(); - if (values.isEmpty()) { - return null; - } - return values.get(random.nextInt(values.size())).defaultBlockState(); - } + @Override + public BlockState pick(Random random) { + var values = resolve().toList(); + if (values.isEmpty()) { + return null; + } + return values.get(random.nextInt(values.size())).defaultBlockState(); + } - @Override - public JsonObject serialize() { - JsonObject object = new JsonObject(); - object.addProperty("type", "tag"); - object.addProperty("tag", tag.toString()); - return object; - } + @Override + public JsonObject serialize() { + JsonObject object = new JsonObject(); + object.addProperty("type", "tag"); + object.addProperty("tag", tag.location().toString()); + return object; + } - @Override - public List getDisplayedStacks() { - return resolve() - .filter(b -> b.asItem() != Items.AIR) - .map(ItemStack::new) - .collect(Collectors.toList()); - } + @Override + public List getDisplayedStacks() { + return resolve() + .filter(b -> b.asItem() != Items.AIR) + .map(ItemStack::new) + .collect(Collectors.toList()); + } - @Nonnull - @Override - protected List getBlocks() { - return resolve().toList(); - } + @Nonnull + @Override + protected List getBlocks() { + return resolve().toList(); + } - @Override - public List getDisplayed() { - return resolve().map(Block::defaultBlockState).collect(Collectors.toList()); - } + @Override + public List getDisplayed() { + return resolve().map(Block::defaultBlockState).collect(Collectors.toList()); + } - public ResourceLocation getTagId() { - return tag.location(); - } + public ResourceLocation getTagId() { + return tag.location(); + } - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - return tag.equals(((StateIngredientTag) o).tag); - } + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + return tag.equals(((StateIngredientTag) o).tag); + } - @Override - public int hashCode() { - return tag.hashCode(); - } + @Override + public int hashCode() { + return tag.hashCode(); + } - @Override - public String toString() { - return "StateIngredientTag{" + tag + "}"; - } + @Override + public String toString() { + return "StateIngredientTag{" + tag + "}"; + } } diff --git a/Common/src/main/java/at/petrak/hexcasting/common/recipe/ingredient/brainsweep/BrainsweepeeIngredient.java b/Common/src/main/java/at/petrak/hexcasting/common/recipe/ingredient/brainsweep/BrainsweepeeIngredient.java index 4a06ba8e..293857d6 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/recipe/ingredient/brainsweep/BrainsweepeeIngredient.java +++ b/Common/src/main/java/at/petrak/hexcasting/common/recipe/ingredient/brainsweep/BrainsweepeeIngredient.java @@ -16,9 +16,13 @@ import java.util.Locale; // Partially based on: // https://github.com/SlimeKnights/Mantle/blob/1.18.2/src/main/java/slimeknights/mantle/recipe/ingredient/EntityIngredient.java // Licensed under MIT +// +// .equals must make sense public abstract class BrainsweepeeIngredient { public abstract boolean test(Entity entity, ServerLevel level); + public abstract Component getName(); + public abstract List getTooltip(boolean advanced); public abstract JsonObject serialize(); @@ -33,6 +37,10 @@ public abstract class BrainsweepeeIngredient { @Nullable public abstract Entity exampleEntity(ClientLevel level); + public abstract Type ingrType(); + + public abstract String getSomeKindOfReasonableIDForEmi(); + public static BrainsweepeeIngredient read(FriendlyByteBuf buf) { var type = buf.readVarInt(); return switch (Type.values()[type]) { diff --git a/Common/src/main/java/at/petrak/hexcasting/common/recipe/ingredient/brainsweep/EntityTagIngredient.java b/Common/src/main/java/at/petrak/hexcasting/common/recipe/ingredient/brainsweep/EntityTagIngredient.java index e37b1432..1224ab6e 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/recipe/ingredient/brainsweep/EntityTagIngredient.java +++ b/Common/src/main/java/at/petrak/hexcasting/common/recipe/ingredient/brainsweep/EntityTagIngredient.java @@ -16,6 +16,7 @@ import net.minecraft.world.entity.EntityType; import java.util.ArrayList; import java.util.List; +import java.util.Objects; public class EntityTagIngredient extends BrainsweepeeIngredient { public final TagKey> entityTypeTag; @@ -29,12 +30,25 @@ public class EntityTagIngredient extends BrainsweepeeIngredient { return entity.getType().is(this.entityTypeTag); } + private static String tagKey(ResourceLocation tagLoc) { + return "tag." + + tagLoc.getNamespace() + + "." + + tagLoc.getPath().replace('/', '.'); + } + + @Override + public Component getName() { + String key = tagKey(this.entityTypeTag.location()); + boolean moddersDidAGoodJob = I18n.exists(key); + return moddersDidAGoodJob + ? Component.translatable(key) + : Component.literal("#" + entityTypeTag); + } + @Override public List getTooltip(boolean advanced) { - String key = "tag." - + this.entityTypeTag.location().getNamespace() - + "." - + this.entityTypeTag.location().getPath().replace('/', '.'); + String key = tagKey(this.entityTypeTag.location()); boolean moddersDidAGoodJob = I18n.exists(key); var out = new ArrayList(); @@ -76,8 +90,8 @@ public class EntityTagIngredient extends BrainsweepeeIngredient { } public static EntityTagIngredient deserialize(JsonObject obj) { - var typeLoc = ResourceLocation.tryParse(GsonHelper.getAsString(obj, "entityType")); - var type = TagKey.create(Registry.ENTITY_TYPE_REGISTRY, typeLoc); + var tagLoc = ResourceLocation.tryParse(GsonHelper.getAsString(obj, "tag")); + var type = TagKey.create(Registry.ENTITY_TYPE_REGISTRY, tagLoc); return new EntityTagIngredient(type); } @@ -86,4 +100,30 @@ public class EntityTagIngredient extends BrainsweepeeIngredient { var type = TagKey.create(Registry.ENTITY_TYPE_REGISTRY, typeLoc); return new EntityTagIngredient(type); } + + @Override + public Type ingrType() { + return Type.ENTITY_TAG; + } + + @Override + public String getSomeKindOfReasonableIDForEmi() { + var resloc = this.entityTypeTag.location(); + return resloc.getNamespace() + + "//" + + resloc.getPath(); + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || getClass() != o.getClass()) return false; + EntityTagIngredient that = (EntityTagIngredient) o; + return Objects.equals(entityTypeTag, that.entityTypeTag); + } + + @Override + public int hashCode() { + return Objects.hashCode(this.entityTypeTag); + } } diff --git a/Common/src/main/java/at/petrak/hexcasting/common/recipe/ingredient/brainsweep/EntityTypeIngredient.java b/Common/src/main/java/at/petrak/hexcasting/common/recipe/ingredient/brainsweep/EntityTypeIngredient.java index 2b0bf664..c5b941a5 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/recipe/ingredient/brainsweep/EntityTypeIngredient.java +++ b/Common/src/main/java/at/petrak/hexcasting/common/recipe/ingredient/brainsweep/EntityTypeIngredient.java @@ -12,6 +12,7 @@ import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.EntityType; import java.util.List; +import java.util.Objects; public class EntityTypeIngredient extends BrainsweepeeIngredient { public final EntityType entityType; @@ -26,6 +27,11 @@ public class EntityTypeIngredient extends BrainsweepeeIngredient { return entity.getType() == this.entityType; } + @Override + public Component getName() { + return this.entityType.getDescription(); + } + @Override public List getTooltip(boolean advanced) { return List.of(this.entityType.getDescription()); @@ -64,4 +70,30 @@ public class EntityTypeIngredient extends BrainsweepeeIngredient { var tyId = buf.readVarInt(); return new EntityTypeIngredient(Registry.ENTITY_TYPE.byId(tyId)); } + + @Override + public Type ingrType() { + return Type.ENTITY_TYPE; + } + + @Override + public String getSomeKindOfReasonableIDForEmi() { + var resloc = Registry.ENTITY_TYPE.getKey(this.entityType); + return resloc.getNamespace() + + "//" + + resloc.getPath(); + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || getClass() != o.getClass()) return false; + EntityTypeIngredient that = (EntityTypeIngredient) o; + return Objects.equals(entityType, that.entityType); + } + + @Override + public int hashCode() { + return Objects.hash(entityType); + } } diff --git a/Common/src/main/java/at/petrak/hexcasting/common/recipe/ingredient/brainsweep/VillagerIngredient.java b/Common/src/main/java/at/petrak/hexcasting/common/recipe/ingredient/brainsweep/VillagerIngredient.java index ba62cfe1..c3b82581 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/recipe/ingredient/brainsweep/VillagerIngredient.java +++ b/Common/src/main/java/at/petrak/hexcasting/common/recipe/ingredient/brainsweep/VillagerIngredient.java @@ -26,13 +26,13 @@ import java.util.Objects; * Special case for villagers so we can have biome/profession/level reqs */ public class VillagerIngredient extends BrainsweepeeIngredient { - public final @Nullable ResourceLocation profession; - public final @Nullable ResourceLocation biome; + public final @Nullable VillagerProfession profession; + public final @Nullable VillagerType biome; public final int minLevel; public VillagerIngredient( - @Nullable ResourceLocation profession, - @Nullable ResourceLocation biome, // aka their "type" + @Nullable VillagerProfession profession, + @Nullable VillagerType biome, int minLevel ) { this.profession = profession; @@ -45,23 +45,18 @@ public class VillagerIngredient extends BrainsweepeeIngredient { if (!(entity instanceof Villager villager)) return false; var data = villager.getVillagerData(); - ResourceLocation profID = IXplatAbstractions.INSTANCE.getID(data.getProfession()); - return (this.profession == null || this.profession.equals(profID)) - && (this.biome == null || this.biome.equals(Registry.VILLAGER_TYPE.getKey(data.getType()))) + return (this.profession == null || this.profession.equals(data.getProfession())) + && (this.biome == null || this.biome.equals(data.getType())) && this.minLevel <= data.getLevel(); } @Override public Entity exampleEntity(ClientLevel level) { - var type = this.biome == null - ? VillagerType.PLAINS - : Registry.VILLAGER_TYPE.get(this.biome); - var out = new Villager(EntityType.VILLAGER, level, type); + var biome = Objects.requireNonNullElse(this.biome, VillagerType.PLAINS); + var out = new Villager(EntityType.VILLAGER, level, biome); - var profession = this.profession == null - ? VillagerProfession.TOOLSMITH - : Registry.VILLAGER_PROFESSION.get(this.profession); + var profession = Objects.requireNonNullElse(this.profession, VillagerProfession.TOOLSMITH); out.getVillagerData().setProfession(profession); out.getVillagerData().setLevel(Math.max(this.minLevel, 1)); return out; @@ -70,7 +65,7 @@ public class VillagerIngredient extends BrainsweepeeIngredient { @Override public List getTooltip(boolean advanced) { List tooltip = new ArrayList<>(); - tooltip.add(name()); + tooltip.add(this.getName()); if (advanced) { if (minLevel >= 5) { @@ -81,21 +76,22 @@ public class VillagerIngredient extends BrainsweepeeIngredient { .withStyle(ChatFormatting.DARK_GRAY)); } - if (biome != null) { - tooltip.add(Component.literal(biome.toString()).withStyle(ChatFormatting.DARK_GRAY)); + if (this.biome != null) { + tooltip.add(Component.literal(this.biome.toString()).withStyle(ChatFormatting.DARK_GRAY)); } - ResourceLocation displayId = Objects.requireNonNullElseGet(profession, - () -> Registry.ENTITY_TYPE.getKey(EntityType.VILLAGER)); - tooltip.add(Component.literal(displayId.toString()).withStyle(ChatFormatting.DARK_GRAY)); + if (this.profession != null) { + tooltip.add(Component.literal(this.profession.toString()).withStyle(ChatFormatting.DARK_GRAY)); + } } - tooltip.add(getModNameComponent()); + tooltip.add(this.getModNameComponent()); return tooltip; } - public Component name() { + @Override + public Component getName() { MutableComponent component = Component.literal(""); boolean addedAny = false; @@ -115,14 +111,19 @@ public class VillagerIngredient extends BrainsweepeeIngredient { if (addedAny) { component.append(" "); } - component.append(Component.translatable("biome.minecraft." + biome.getPath())); + var biomeLoc = Registry.VILLAGER_TYPE.getKey(this.biome); + component.append(Component.translatable("biome." + biomeLoc.getNamespace() + "." + biomeLoc.getPath())); addedAny = true; } if (profession != null) { // We've for sure added something component.append(" "); - component.append(Component.translatable("entity.minecraft.villager." + profession.getPath())); + var professionLoc = Registry.VILLAGER_PROFESSION.getKey(this.profession); + // TODO: what's the convention used for modded villager types? + // Villager::getTypeName implies that it there's no namespace information. + // i hope there is some convention + component.append(Component.translatable("entity.minecraft.villager." + professionLoc.getPath())); } else { if (addedAny) { component.append(" "); @@ -134,7 +135,9 @@ public class VillagerIngredient extends BrainsweepeeIngredient { } public Component getModNameComponent() { - String namespace = profession == null ? "minecraft" : profession.getNamespace(); + String namespace = profession == null + ? "minecraft" + : Registry.VILLAGER_PROFESSION.getKey(this.profession).getNamespace(); String mod = IXplatAbstractions.INSTANCE.getModName(namespace); return Component.literal(mod).withStyle(ChatFormatting.BLUE, ChatFormatting.ITALIC); } @@ -158,13 +161,13 @@ public class VillagerIngredient extends BrainsweepeeIngredient { public void write(FriendlyByteBuf buf) { if (this.profession != null) { buf.writeVarInt(1); - buf.writeResourceLocation(this.profession); + buf.writeVarInt(Registry.VILLAGER_PROFESSION.getId(this.profession)); } else { buf.writeVarInt(0); } if (this.biome != null) { buf.writeVarInt(1); - buf.writeResourceLocation(this.biome); + buf.writeVarInt(Registry.VILLAGER_TYPE.getId(this.biome)); } else { buf.writeVarInt(0); } @@ -172,31 +175,75 @@ public class VillagerIngredient extends BrainsweepeeIngredient { } public static VillagerIngredient deserialize(JsonObject json) { - ResourceLocation profession = null; + VillagerProfession profession = null; if (json.has("profession") && !json.get("profession").isJsonNull()) { - profession = new ResourceLocation(GsonHelper.getAsString(json, "profession")); + profession = Registry.VILLAGER_PROFESSION.get(new ResourceLocation(GsonHelper.getAsString(json, + "profession"))); } - ResourceLocation biome = null; + VillagerType biome = null; if (json.has("biome") && !json.get("biome").isJsonNull()) { - biome = new ResourceLocation(GsonHelper.getAsString(json, "biome")); + biome = Registry.VILLAGER_TYPE.get(new ResourceLocation(GsonHelper.getAsString(json, "biome"))); } int minLevel = GsonHelper.getAsInt(json, "minLevel"); - int cost = GsonHelper.getAsInt(json, "cost"); return new VillagerIngredient(profession, biome, minLevel); } public static VillagerIngredient read(FriendlyByteBuf buf) { - ResourceLocation profession = null; + VillagerProfession profession = null; var hasProfession = buf.readVarInt(); if (hasProfession != 0) { - profession = buf.readResourceLocation(); + profession = Registry.VILLAGER_PROFESSION.byId(buf.readVarInt()); } - ResourceLocation biome = null; + VillagerType biome = null; var hasBiome = buf.readVarInt(); if (hasBiome != 0) { - biome = buf.readResourceLocation(); + biome = Registry.VILLAGER_TYPE.byId(buf.readVarInt()); } int minLevel = buf.readInt(); return new VillagerIngredient(profession, biome, minLevel); } + + @Override + public Type ingrType() { + return Type.VILLAGER; + } + + @Override + public String getSomeKindOfReasonableIDForEmi() { + var bob = new StringBuilder(); + if (this.profession != null) { + var profLoc = Registry.VILLAGER_PROFESSION.getKey(this.profession); + bob.append(profLoc.getNamespace()) + .append("//") + .append(profLoc.getPath()); + } else { + bob.append("null"); + } + bob.append("_"); + if (this.biome != null) { + var biomeLoc = Registry.VILLAGER_TYPE.getKey(this.biome); + bob.append(biomeLoc.getNamespace()) + .append("//") + .append(biomeLoc.getPath()); + } else { + bob.append("null"); + } + + bob.append(this.minLevel); + return bob.toString(); + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || getClass() != o.getClass()) return false; + VillagerIngredient that = (VillagerIngredient) o; + return minLevel == that.minLevel && Objects.equals(profession, that.profession) && Objects.equals(biome, + that.biome); + } + + @Override + public int hashCode() { + return Objects.hash(profession, biome, minLevel); + } } diff --git a/Common/src/main/java/at/petrak/hexcasting/datagen/recipe/HexplatRecipes.java b/Common/src/main/java/at/petrak/hexcasting/datagen/recipe/HexplatRecipes.java new file mode 100644 index 00000000..84ce42d2 --- /dev/null +++ b/Common/src/main/java/at/petrak/hexcasting/datagen/recipe/HexplatRecipes.java @@ -0,0 +1,508 @@ +package at.petrak.hexcasting.datagen.recipe; + +import at.petrak.hexcasting.api.HexAPI; +import at.petrak.hexcasting.api.advancements.OvercastTrigger; +import at.petrak.hexcasting.api.misc.MediaConstants; +import at.petrak.hexcasting.api.mod.HexTags; +import at.petrak.hexcasting.common.items.ItemStaff; +import at.petrak.hexcasting.common.items.colorizer.ItemPrideColorizer; +import at.petrak.hexcasting.common.lib.HexBlocks; +import at.petrak.hexcasting.common.lib.HexItems; +import at.petrak.hexcasting.common.recipe.SealFocusRecipe; +import at.petrak.hexcasting.common.recipe.SealSpellbookRecipe; +import at.petrak.hexcasting.common.recipe.ingredient.StateIngredientHelper; +import at.petrak.hexcasting.common.recipe.ingredient.brainsweep.EntityTagIngredient; +import at.petrak.hexcasting.common.recipe.ingredient.brainsweep.EntityTypeIngredient; +import at.petrak.hexcasting.common.recipe.ingredient.brainsweep.VillagerIngredient; +import at.petrak.hexcasting.datagen.IXplatConditionsBuilder; +import at.petrak.hexcasting.datagen.IXplatIngredients; +import at.petrak.hexcasting.datagen.recipe.builders.BrainsweepRecipeBuilder; +import at.petrak.hexcasting.datagen.recipe.builders.CompatIngredientValue; +import at.petrak.hexcasting.datagen.recipe.builders.CreateCrushingRecipeBuilder; +import at.petrak.hexcasting.datagen.recipe.builders.FarmersDelightCuttingRecipeBuilder; +import at.petrak.paucal.api.datagen.PaucalRecipeProvider; +import net.minecraft.advancements.critereon.EntityPredicate; +import net.minecraft.advancements.critereon.MinMaxBounds; +import net.minecraft.core.Registry; +import net.minecraft.data.DataGenerator; +import net.minecraft.data.recipes.*; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.sounds.SoundEvents; +import net.minecraft.tags.BlockTags; +import net.minecraft.tags.EntityTypeTags; +import net.minecraft.tags.ItemTags; +import net.minecraft.world.entity.EntityType; +import net.minecraft.world.entity.npc.VillagerProfession; +import net.minecraft.world.item.DyeColor; +import net.minecraft.world.item.DyeItem; +import net.minecraft.world.item.Item; +import net.minecraft.world.item.Items; +import net.minecraft.world.item.crafting.Ingredient; +import net.minecraft.world.item.crafting.SimpleRecipeSerializer; +import net.minecraft.world.level.block.Blocks; + +import java.util.function.Consumer; +import java.util.function.Function; + +// TODO: need to do a big refactor of this class cause it's giant and unwieldy, probably as part of #360 +public class HexplatRecipes extends PaucalRecipeProvider { + private final DataGenerator generator; + private final IXplatIngredients ingredients; + private final Function conditions; + + public HexplatRecipes(DataGenerator generator, IXplatIngredients ingredients, + Function conditions) { + super(generator, HexAPI.MOD_ID); + this.generator = generator; + this.ingredients = ingredients; + this.conditions = conditions; + } + + @Override + protected void makeRecipes(Consumer recipes) { + specialRecipe(recipes, SealFocusRecipe.SERIALIZER); + specialRecipe(recipes, SealSpellbookRecipe.SERIALIZER); + + staffRecipe(recipes, HexItems.STAFF_OAK, Items.OAK_PLANKS); + staffRecipe(recipes, HexItems.STAFF_BIRCH, Items.BIRCH_PLANKS); + staffRecipe(recipes, HexItems.STAFF_SPRUCE, Items.SPRUCE_PLANKS); + staffRecipe(recipes, HexItems.STAFF_JUNGLE, Items.JUNGLE_PLANKS); + staffRecipe(recipes, HexItems.STAFF_DARK_OAK, Items.DARK_OAK_PLANKS); + staffRecipe(recipes, HexItems.STAFF_ACACIA, Items.ACACIA_PLANKS); + staffRecipe(recipes, HexItems.STAFF_CRIMSON, Items.CRIMSON_PLANKS); + staffRecipe(recipes, HexItems.STAFF_WARPED, Items.WARPED_PLANKS); + staffRecipe(recipes, HexItems.STAFF_EDIFIED, HexBlocks.EDIFIED_PLANKS.asItem()); + + ringCornered(HexItems.FOCUS, 1, + ingredients.glowstoneDust(), + ingredients.leather(), + Ingredient.of(HexItems.CHARGED_AMETHYST)) + .unlockedBy("has_item", hasItem(HexTags.Items.STAVES)) + .save(recipes); + + ShapedRecipeBuilder.shaped(HexItems.SPELLBOOK) + .define('N', ingredients.goldNugget()) + .define('B', Items.WRITABLE_BOOK) + .define('A', HexItems.CHARGED_AMETHYST) + .define('F', Items.CHORUS_FRUIT) // i wanna gate this behind the end SOMEHOW + // hey look its my gender ^^ + .pattern("NBA") + .pattern("NFA") + .pattern("NBA") + .unlockedBy("has_focus", hasItem(HexItems.FOCUS)) + .unlockedBy("has_chorus", hasItem(Items.CHORUS_FRUIT)).save(recipes); + + ringCornerless( + HexItems.CYPHER, 1, + ingredients.copperIngot(), + Ingredient.of(HexItems.AMETHYST_DUST)) + .unlockedBy("has_item", hasItem(HexTags.Items.STAVES)).save(recipes); + + ringCornerless( + HexItems.TRINKET, 1, + ingredients.ironIngot(), + Ingredient.of(Items.AMETHYST_SHARD)) + .unlockedBy("has_item", hasItem(HexTags.Items.STAVES)).save(recipes); + + ShapedRecipeBuilder.shaped(HexItems.ARTIFACT) + .define('F', ingredients.goldIngot()) + .define('A', HexItems.CHARGED_AMETHYST) + // why in god's name does minecraft have two different places for item tags + .define('D', ItemTags.MUSIC_DISCS) + .pattern(" F ") + .pattern("FAF") + .pattern(" D ") + .unlockedBy("has_item", hasItem(HexTags.Items.STAVES)).save(recipes); + + ringCornerless(HexItems.SCRYING_LENS, 1, Items.GLASS, HexItems.AMETHYST_DUST) + .unlockedBy("has_item", hasItem(HexTags.Items.STAVES)).save(recipes); + + ShapedRecipeBuilder.shaped(HexItems.ABACUS) + .define('S', Items.STICK) + .define('A', Items.AMETHYST_SHARD) + .define('W', ItemTags.PLANKS) + .pattern("WAW") + .pattern("SAS") + .pattern("WAW") + .unlockedBy("has_item", hasItem(HexTags.Items.STAVES)).save(recipes); + + // Why am I like this + ShapedRecipeBuilder.shaped(HexItems.SUBMARINE_SANDWICH) + .define('S', Items.STICK) + .define('A', Items.AMETHYST_SHARD) + .define('C', Items.COOKED_BEEF) + .define('B', Items.BREAD) + .pattern(" SA") + .pattern(" C ") + .pattern(" B ") + .unlockedBy("has_item", hasItem(Items.AMETHYST_SHARD)).save(recipes); + + for (var dye : DyeColor.values()) { + var item = HexItems.DYE_COLORIZERS.get(dye); + ShapedRecipeBuilder.shaped(item) + .define('D', HexItems.AMETHYST_DUST) + .define('C', DyeItem.byColor(dye)) + .pattern(" D ") + .pattern("DCD") + .pattern(" D ") + .unlockedBy("has_item", hasItem(HexItems.AMETHYST_DUST)).save(recipes); + } + + gayRecipe(recipes, ItemPrideColorizer.Type.AGENDER, Ingredient.of(Items.GLASS)); + gayRecipe(recipes, ItemPrideColorizer.Type.AROACE, Ingredient.of(Items.WHEAT_SEEDS)); + gayRecipe(recipes, ItemPrideColorizer.Type.AROMANTIC, Ingredient.of(Items.ARROW)); + gayRecipe(recipes, ItemPrideColorizer.Type.ASEXUAL, Ingredient.of(Items.BREAD)); + gayRecipe(recipes, ItemPrideColorizer.Type.BISEXUAL, Ingredient.of(Items.WHEAT)); + gayRecipe(recipes, ItemPrideColorizer.Type.DEMIBOY, Ingredient.of(Items.RAW_IRON)); + gayRecipe(recipes, ItemPrideColorizer.Type.DEMIGIRL, Ingredient.of(Items.RAW_COPPER)); + gayRecipe(recipes, ItemPrideColorizer.Type.GAY, Ingredient.of(Items.STONE_BRICK_WALL)); + gayRecipe(recipes, ItemPrideColorizer.Type.GENDERFLUID, Ingredient.of(Items.WATER_BUCKET)); + gayRecipe(recipes, ItemPrideColorizer.Type.GENDERQUEER, Ingredient.of(Items.GLASS_BOTTLE)); + gayRecipe(recipes, ItemPrideColorizer.Type.INTERSEX, Ingredient.of(Items.AZALEA)); + gayRecipe(recipes, ItemPrideColorizer.Type.LESBIAN, Ingredient.of(Items.HONEYCOMB)); + gayRecipe(recipes, ItemPrideColorizer.Type.NONBINARY, Ingredient.of(Items.MOSS_BLOCK)); + gayRecipe(recipes, ItemPrideColorizer.Type.PANSEXUAL, ingredients.whenModIngredient( + Ingredient.of(Items.CARROT), + "farmersdelight", + CompatIngredientValue.of("farmersdelight:skillet") + )); + gayRecipe(recipes, ItemPrideColorizer.Type.PLURAL, Ingredient.of(Items.REPEATER)); + gayRecipe(recipes, ItemPrideColorizer.Type.TRANSGENDER, Ingredient.of(Items.EGG)); + + ShapedRecipeBuilder.shaped(HexItems.UUID_COLORIZER) + .define('B', Items.BOWL) + .define('D', HexItems.AMETHYST_DUST) + .define('C', Items.AMETHYST_SHARD) + .pattern(" C ") + .pattern(" D ") + .pattern(" B ") + .unlockedBy("has_item", hasItem(HexItems.AMETHYST_DUST)).save(recipes); + + ShapedRecipeBuilder.shaped(HexItems.SCROLL_SMOL) + .define('P', Items.PAPER) + .define('A', Items.AMETHYST_SHARD) + .pattern(" A") + .pattern("P ") + .unlockedBy("has_item", hasItem(Items.AMETHYST_SHARD)).save(recipes); + + ShapedRecipeBuilder.shaped(HexItems.SCROLL_MEDIUM) + .define('P', Items.PAPER) + .define('A', Items.AMETHYST_SHARD) + .pattern(" A") + .pattern("PP ") + .pattern("PP ") + .unlockedBy("has_item", hasItem(Items.AMETHYST_SHARD)).save(recipes); + + ShapedRecipeBuilder.shaped(HexItems.SCROLL_LARGE) + .define('P', Items.PAPER) + .define('A', Items.AMETHYST_SHARD) + .pattern("PPA") + .pattern("PPP") + .pattern("PPP") + .unlockedBy("has_item", hasItem(Items.AMETHYST_SHARD)).save(recipes); + + ShapedRecipeBuilder.shaped(HexItems.SLATE, 6) + .define('S', Items.DEEPSLATE) + .define('A', HexItems.AMETHYST_DUST) + .pattern(" A ") + .pattern("SSS") + .unlockedBy("has_item", hasItem(HexItems.AMETHYST_DUST)).save(recipes); + + ShapedRecipeBuilder.shaped(HexItems.JEWELER_HAMMER) + .define('I', ingredients.ironIngot()) + .define('N', ingredients.ironNugget()) + .define('A', Items.AMETHYST_SHARD) + .define('S', ingredients.stick()) + .pattern("IAN") + .pattern(" S ") + .pattern(" S ") + .unlockedBy("has_item", hasItem(Items.AMETHYST_SHARD)).save(recipes); + + ShapedRecipeBuilder.shaped(HexBlocks.SLATE_BLOCK) + .define('S', HexItems.SLATE) + .pattern("S") + .pattern("S") + .unlockedBy("has_item", hasItem(HexItems.SLATE)) + .save(recipes, modLoc("slate_block_from_slates")); + + ringAll(HexBlocks.SLATE_BLOCK, 8, Blocks.DEEPSLATE, HexItems.AMETHYST_DUST) + .unlockedBy("has_item", hasItem(HexItems.SLATE)).save(recipes); + + packing(HexItems.AMETHYST_DUST, HexBlocks.AMETHYST_DUST_BLOCK.asItem(), "amethyst_dust", + false, recipes); + + ringAll(HexBlocks.AMETHYST_TILES, 8, Blocks.AMETHYST_BLOCK, HexItems.AMETHYST_DUST) + .unlockedBy("has_item", hasItem(HexItems.AMETHYST_DUST)).save(recipes); + + SingleItemRecipeBuilder.stonecutting(Ingredient.of(Blocks.AMETHYST_BLOCK), HexBlocks.AMETHYST_TILES) + .unlockedBy("has_item", hasItem(Blocks.AMETHYST_BLOCK)) + .save(recipes, modLoc("stonecutting/amethyst_tiles")); + + ringAll(HexBlocks.SCROLL_PAPER, 8, Items.PAPER, Items.AMETHYST_SHARD) + .unlockedBy("has_item", hasItem(Items.AMETHYST_SHARD)).save(recipes); + + ShapelessRecipeBuilder.shapeless(HexBlocks.ANCIENT_SCROLL_PAPER, 8) + .requires(ingredients.dyes().get(DyeColor.BROWN)) + .requires(HexBlocks.SCROLL_PAPER, 8) + .unlockedBy("has_item", hasItem(HexBlocks.SCROLL_PAPER)).save(recipes); + + stack(HexBlocks.SCROLL_PAPER_LANTERN, 1, HexBlocks.SCROLL_PAPER, Items.TORCH) + .unlockedBy("has_item", hasItem(HexBlocks.SCROLL_PAPER)).save(recipes); + + stack(HexBlocks.ANCIENT_SCROLL_PAPER_LANTERN, 1, HexBlocks.ANCIENT_SCROLL_PAPER, Items.TORCH) + .unlockedBy("has_item", hasItem(HexBlocks.ANCIENT_SCROLL_PAPER)).save(recipes); + + ShapelessRecipeBuilder.shapeless(HexBlocks.ANCIENT_SCROLL_PAPER_LANTERN, 8) + .requires(ingredients.dyes().get(DyeColor.BROWN)) + .requires(HexBlocks.SCROLL_PAPER_LANTERN, 8) + .unlockedBy("has_item", hasItem(HexBlocks.SCROLL_PAPER_LANTERN)) + .save(recipes, modLoc("ageing_scroll_paper_lantern")); + + stack(HexBlocks.SCONCE, 4, + Ingredient.of(HexItems.CHARGED_AMETHYST), + ingredients.copperIngot()) + .unlockedBy("has_item", hasItem(HexItems.CHARGED_AMETHYST)).save(recipes); + + ShapelessRecipeBuilder.shapeless(HexBlocks.EDIFIED_PLANKS, 4) + .requires(HexTags.Items.EDIFIED_LOGS) + .unlockedBy("has_item", hasItem(HexTags.Items.EDIFIED_LOGS)).save(recipes); + + ShapedRecipeBuilder.shaped(HexBlocks.EDIFIED_WOOD, 3) + .define('W', HexBlocks.EDIFIED_LOG) + .pattern("WW") + .pattern("WW") + .unlockedBy("has_item", hasItem(HexBlocks.EDIFIED_LOG)).save(recipes); + + ShapedRecipeBuilder.shaped(HexBlocks.STRIPPED_EDIFIED_WOOD, 3) + .define('W', HexBlocks.STRIPPED_EDIFIED_LOG) + .pattern("WW") + .pattern("WW") + .unlockedBy("has_item", hasItem(HexBlocks.STRIPPED_EDIFIED_LOG)).save(recipes); + + ring(HexBlocks.EDIFIED_PANEL, 8, + HexTags.Items.EDIFIED_PLANKS, null) + .unlockedBy("has_item", hasItem(HexTags.Items.EDIFIED_PLANKS)).save(recipes); + + ShapedRecipeBuilder.shaped(HexBlocks.EDIFIED_TILE, 6) + .define('W', HexTags.Items.EDIFIED_PLANKS) + .pattern("WW ") + .pattern("W W") + .pattern(" WW") + .unlockedBy("has_item", hasItem(HexTags.Items.EDIFIED_PLANKS)).save(recipes); + + ShapedRecipeBuilder.shaped(HexBlocks.EDIFIED_DOOR, 3) + .define('W', HexTags.Items.EDIFIED_PLANKS) + .pattern("WW") + .pattern("WW") + .pattern("WW") + .unlockedBy("has_item", hasItem(HexTags.Items.EDIFIED_PLANKS)).save(recipes); + + ShapedRecipeBuilder.shaped(HexBlocks.EDIFIED_TRAPDOOR, 2) + .define('W', HexTags.Items.EDIFIED_PLANKS) + .pattern("WWW") + .pattern("WWW") + .unlockedBy("has_item", hasItem(HexTags.Items.EDIFIED_PLANKS)).save(recipes); + + ShapedRecipeBuilder.shaped(HexBlocks.EDIFIED_STAIRS, 4) + .define('W', HexTags.Items.EDIFIED_PLANKS) + .pattern("W ") + .pattern("WW ") + .pattern("WWW") + .unlockedBy("has_item", hasItem(HexTags.Items.EDIFIED_PLANKS)).save(recipes); + + ShapedRecipeBuilder.shaped(HexBlocks.EDIFIED_SLAB, 6) + .define('W', HexTags.Items.EDIFIED_PLANKS) + .pattern("WWW") + .unlockedBy("has_item", hasItem(HexTags.Items.EDIFIED_PLANKS)).save(recipes); + + ShapedRecipeBuilder.shaped(HexBlocks.EDIFIED_PRESSURE_PLATE, 1) + .define('W', HexTags.Items.EDIFIED_PLANKS) + .pattern("WW") + .unlockedBy("has_item", hasItem(HexTags.Items.EDIFIED_PLANKS)).save(recipes); + + ShapelessRecipeBuilder.shapeless(HexBlocks.EDIFIED_BUTTON) + .requires(HexTags.Items.EDIFIED_PLANKS) + .unlockedBy("has_item", hasItem(HexTags.Items.EDIFIED_PLANKS)).save(recipes); + + // TODO: probably should have some constant enlightenment trigger somewhere + var enlightenment = new OvercastTrigger.Instance( + EntityPredicate.Composite.ANY, + MinMaxBounds.Ints.ANY, // add a little bit of slop here + MinMaxBounds.Doubles.atLeast(0.8), + MinMaxBounds.Doubles.between(0.1, 2.05) + ); + ShapedRecipeBuilder.shaped(HexBlocks.EMPTY_IMPETUS) + .define('B', Items.IRON_BARS) + .define('A', HexItems.CHARGED_AMETHYST) + .define('S', HexBlocks.SLATE_BLOCK) + .define('P', Items.PURPUR_BLOCK) + .pattern("PSS") + .pattern("BAB") + .pattern("SSP") + .unlockedBy("enlightenment", enlightenment).save(recipes); + + ShapedRecipeBuilder.shaped(HexBlocks.EMPTY_DIRECTRIX) + .define('C', Items.COMPARATOR) + .define('O', Items.OBSERVER) + .define('A', HexItems.CHARGED_AMETHYST) + .define('S', HexBlocks.SLATE_BLOCK) + .pattern("CSS") + .pattern("OAO") + .pattern("SSC") + .unlockedBy("enlightenment", enlightenment).save(recipes); + + ShapedRecipeBuilder.shaped(HexBlocks.AKASHIC_BOOKSHELF) + .define('L', HexTags.Items.EDIFIED_LOGS) + .define('P', HexTags.Items.EDIFIED_PLANKS) + .define('C', Items.BOOK) + /*this is the*/.pattern("LPL") // and what i have for you today is + .pattern("CCC") + .pattern("LPL") + .unlockedBy("enlightenment", enlightenment).save(recipes); + + ShapedRecipeBuilder.shaped(HexBlocks.AKASHIC_LIGATURE) + .define('L', HexTags.Items.EDIFIED_LOGS) + .define('P', HexTags.Items.EDIFIED_PLANKS) + .define('C', HexItems.CHARGED_AMETHYST) + .pattern("LPL") + .pattern("CCC") + .pattern("LPL") + .unlockedBy("enlightenment", enlightenment).save(recipes); + + new BrainsweepRecipeBuilder(StateIngredientHelper.of(Blocks.AMETHYST_BLOCK), + new VillagerIngredient(null, null, 3), + Blocks.BUDDING_AMETHYST.defaultBlockState(), MediaConstants.CRYSTAL_UNIT * 10) + .unlockedBy("enlightenment", enlightenment) + .save(recipes, modLoc("brainsweep/budding_amethyst")); + + new BrainsweepRecipeBuilder(StateIngredientHelper.of(HexBlocks.EMPTY_IMPETUS), + new VillagerIngredient(VillagerProfession.TOOLSMITH, null, 2), + HexBlocks.IMPETUS_RIGHTCLICK.defaultBlockState(), MediaConstants.CRYSTAL_UNIT * 10) + .unlockedBy("enlightenment", enlightenment) + .save(recipes, modLoc("brainsweep/impetus_rightclick")); + + new BrainsweepRecipeBuilder(StateIngredientHelper.of(HexBlocks.EMPTY_IMPETUS), + new VillagerIngredient(VillagerProfession.TOOLSMITH, null, 2), + HexBlocks.IMPETUS_LOOK.defaultBlockState(), MediaConstants.CRYSTAL_UNIT * 10) + .unlockedBy("enlightenment", enlightenment) + .save(recipes, modLoc("brainsweep/impetus_look")); + + new BrainsweepRecipeBuilder(StateIngredientHelper.of(HexBlocks.EMPTY_IMPETUS), + new VillagerIngredient(VillagerProfession.CLERIC, null, 2), + HexBlocks.IMPETUS_STOREDPLAYER.defaultBlockState(), MediaConstants.CRYSTAL_UNIT * 10) + .unlockedBy("enlightenment", enlightenment) + .save(recipes, modLoc("brainsweep/impetus_storedplayer")); + + new BrainsweepRecipeBuilder(StateIngredientHelper.of(HexBlocks.EMPTY_DIRECTRIX), + new VillagerIngredient(VillagerProfession.MASON, null, 1), + HexBlocks.DIRECTRIX_REDSTONE.defaultBlockState(), MediaConstants.CRYSTAL_UNIT * 10) + .unlockedBy("enlightenment", enlightenment) + .save(recipes, modLoc("brainsweep/directrix_redstone")); + + new BrainsweepRecipeBuilder(StateIngredientHelper.of(HexBlocks.AKASHIC_LIGATURE), + new VillagerIngredient(VillagerProfession.LIBRARIAN, null, 5), + HexBlocks.AKASHIC_RECORD.defaultBlockState(), MediaConstants.CRYSTAL_UNIT * 10) + .unlockedBy("enlightenment", enlightenment) + .save(recipes, modLoc("brainsweep/akashic_record")); + + // Temporary tests + new BrainsweepRecipeBuilder(StateIngredientHelper.of(BlockTags.SMALL_FLOWERS), + new EntityTypeIngredient(EntityType.ALLAY), + Blocks.AMETHYST_CLUSTER.defaultBlockState(), MediaConstants.SHARD_UNIT) + .unlockedBy("enlightenment", enlightenment) + .save(recipes, modLoc("brainsweep/testing/flowey_the_flower")); + new BrainsweepRecipeBuilder(StateIngredientHelper.of(Blocks.SCAFFOLDING), + new EntityTagIngredient(EntityTypeTags.SKELETONS), + Blocks.BONE_BLOCK.defaultBlockState(), MediaConstants.SHARD_UNIT) + .unlockedBy("enlightenment", enlightenment) + .save(recipes, modLoc("brainsweep/testing/bad_to_the_bone")); + + // Create compat + this.conditions.apply(new CreateCrushingRecipeBuilder() + .withInput(Blocks.AMETHYST_CLUSTER) + .duration(150) + .withOutput(Items.AMETHYST_SHARD, 7) + .withOutput(HexItems.AMETHYST_DUST, 5) + .withOutput(0.25f, HexItems.CHARGED_AMETHYST)) + .whenModLoaded("create") + .save(recipes, new ResourceLocation("create", "crushing/amethyst_cluster")); + + this.conditions.apply(new CreateCrushingRecipeBuilder() + .withInput(Blocks.AMETHYST_BLOCK) + .duration(150) + .withOutput(Items.AMETHYST_SHARD, 3) + .withOutput(0.5f, HexItems.AMETHYST_DUST, 4)) + .whenModLoaded("create") + .save(recipes, new ResourceLocation("create", "crushing/amethyst_block")); + + this.conditions.apply(new CreateCrushingRecipeBuilder() + .withInput(Items.AMETHYST_SHARD) + .duration(150) + .withOutput(HexItems.AMETHYST_DUST, 4) + .withOutput(0.5f, HexItems.AMETHYST_DUST)) + .whenModLoaded("create") + .save(recipes, modLoc("compat/create/crushing/amethyst_shard")); + + // FD compat + this.conditions.apply(new FarmersDelightCuttingRecipeBuilder() + .withInput(HexBlocks.EDIFIED_LOG) + .withTool(ingredients.axeStrip()) + .withOutput(HexBlocks.STRIPPED_EDIFIED_LOG) + .withOutput("farmersdelight:tree_bark") + .withSound(SoundEvents.AXE_STRIP)) + .whenModLoaded("farmersdelight") + .save(recipes, modLoc("compat/farmersdelight/cutting/akashic_log")); + + this.conditions.apply(new FarmersDelightCuttingRecipeBuilder() + .withInput(HexBlocks.EDIFIED_WOOD) + .withTool(ingredients.axeStrip()) + .withOutput(HexBlocks.STRIPPED_EDIFIED_WOOD) + .withOutput("farmersdelight:tree_bark") + .withSound(SoundEvents.AXE_STRIP)) + .whenModLoaded("farmersdelight") + .save(recipes, modLoc("compat/farmersdelight/cutting/akashic_wood")); + + this.conditions.apply(new FarmersDelightCuttingRecipeBuilder() + .withInput(HexBlocks.EDIFIED_TRAPDOOR) + .withTool(ingredients.axeDig()) + .withOutput(HexBlocks.EDIFIED_PLANKS)) + .whenModLoaded("farmersdelight") + .save(recipes, modLoc("compat/farmersdelight/cutting/akashic_trapdoor")); + + this.conditions.apply(new FarmersDelightCuttingRecipeBuilder() + .withInput(HexBlocks.EDIFIED_DOOR) + .withTool(ingredients.axeDig()) + .withOutput(HexBlocks.EDIFIED_PLANKS)) + .whenModLoaded("farmersdelight") + .save(recipes, modLoc("compat/farmersdelight/cutting/akashic_door")); + } + + private void staffRecipe(Consumer recipes, ItemStaff staff, Item plank) { + ShapedRecipeBuilder.shaped(staff) + .define('W', plank) + .define('S', Items.STICK) + .define('A', HexItems.CHARGED_AMETHYST) + .pattern(" SA") + .pattern(" WS") + .pattern("S ") + .unlockedBy("has_item", hasItem(HexItems.CHARGED_AMETHYST)) + .save(recipes); + } + + private void gayRecipe(Consumer recipes, ItemPrideColorizer.Type type, Ingredient material) { + var colorizer = HexItems.PRIDE_COLORIZERS.get(type); + ShapedRecipeBuilder.shaped(colorizer) + .define('D', HexItems.AMETHYST_DUST) + .define('C', material) + .pattern(" D ") + .pattern("DCD") + .pattern(" D ") + .unlockedBy("has_item", hasItem(HexItems.AMETHYST_DUST)) + .save(recipes); + } + + private void specialRecipe(Consumer consumer, SimpleRecipeSerializer serializer) { + var name = Registry.RECIPE_SERIALIZER.getKey(serializer); + SpecialRecipeBuilder.special(serializer).save(consumer, HexAPI.MOD_ID + ":dynamic" + name.getPath()); + } +} diff --git a/Common/src/main/java/at/petrak/hexcasting/datagen/recipe/HexplatRecipes.kt b/Common/src/main/java/at/petrak/hexcasting/datagen/recipe/HexplatRecipes.kt deleted file mode 100644 index 17c69dc5..00000000 --- a/Common/src/main/java/at/petrak/hexcasting/datagen/recipe/HexplatRecipes.kt +++ /dev/null @@ -1,486 +0,0 @@ -package at.petrak.hexcasting.datagen.recipe - -import at.petrak.hexcasting.api.HexAPI -import at.petrak.hexcasting.api.advancements.OvercastTrigger -import at.petrak.hexcasting.api.misc.MediaConstants -import at.petrak.hexcasting.common.items.ItemStaff -import at.petrak.hexcasting.common.items.colorizer.ItemPrideColorizer -import at.petrak.hexcasting.common.lib.HexBlocks -import at.petrak.hexcasting.common.lib.HexItems -import at.petrak.hexcasting.common.recipe.SealFocusRecipe -import at.petrak.hexcasting.common.recipe.SealSpellbookRecipe -import at.petrak.hexcasting.common.recipe.ingredient.StateIngredientHelper -import at.petrak.hexcasting.common.recipe.ingredient.brainsweep.VillagerIngredient -import at.petrak.hexcasting.datagen.IXplatConditionsBuilder -import at.petrak.hexcasting.datagen.IXplatIngredients -import at.petrak.hexcasting.datagen.recipe.builders.BrainsweepRecipeBuilder -import at.petrak.hexcasting.datagen.recipe.builders.CompatIngredientValue -import at.petrak.hexcasting.datagen.recipe.builders.CreateCrushingRecipeBuilder -import at.petrak.hexcasting.datagen.recipe.builders.FarmersDelightCuttingRecipeBuilder -import at.petrak.paucal.api.datagen.PaucalRecipeProvider -import net.minecraft.advancements.critereon.EntityPredicate -import net.minecraft.advancements.critereon.MinMaxBounds -import net.minecraft.core.Registry -import net.minecraft.data.DataGenerator -import net.minecraft.data.recipes.* -import net.minecraft.resources.ResourceLocation -import net.minecraft.sounds.SoundEvents -import net.minecraft.tags.ItemTags -import net.minecraft.world.item.DyeColor -import net.minecraft.world.item.DyeItem -import net.minecraft.world.item.Item -import net.minecraft.world.item.Items -import net.minecraft.world.item.crafting.Ingredient -import net.minecraft.world.item.crafting.SimpleRecipeSerializer -import net.minecraft.world.level.block.Blocks -import java.util.function.Consumer - -class HexplatRecipes( - val generator: DataGenerator, - val ingredients: IXplatIngredients, - val conditions: (RecipeBuilder) -> IXplatConditionsBuilder -) : PaucalRecipeProvider(generator, HexAPI.MOD_ID) { - - override fun makeRecipes(recipes: Consumer) { - specialRecipe(recipes, SealFocusRecipe.SERIALIZER) - specialRecipe(recipes, SealSpellbookRecipe.SERIALIZER) - - wandRecipe(recipes, HexItems.STAFF_OAK, Items.OAK_PLANKS) - wandRecipe(recipes, HexItems.STAFF_BIRCH, Items.BIRCH_PLANKS) - wandRecipe(recipes, HexItems.STAFF_SPRUCE, Items.SPRUCE_PLANKS) - wandRecipe(recipes, HexItems.STAFF_JUNGLE, Items.JUNGLE_PLANKS) - wandRecipe(recipes, HexItems.STAFF_DARK_OAK, Items.DARK_OAK_PLANKS) - wandRecipe(recipes, HexItems.STAFF_ACACIA, Items.ACACIA_PLANKS) - wandRecipe(recipes, HexItems.STAFF_CRIMSON, Items.CRIMSON_PLANKS) - wandRecipe(recipes, HexItems.STAFF_WARPED, Items.WARPED_PLANKS) - wandRecipe(recipes, HexItems.STAFF_EDIFIED, HexBlocks.EDIFIED_PLANKS.asItem()) - - ringCornered(HexItems.FOCUS, 1, - ingredients.glowstoneDust(), - ingredients.leather(), - Ingredient.of(HexItems.CHARGED_AMETHYST)) - .unlockedBy("has_item", hasItem(HexTags.Items.STAVES)) - .save(recipes) - - ShapedRecipeBuilder.shaped(HexItems.SPELLBOOK) - .define('N', ingredients.goldNugget()) - .define('B', Items.WRITABLE_BOOK) - .define('A', HexItems.CHARGED_AMETHYST) - .define('F', Items.CHORUS_FRUIT) // i wanna gate this behind the end SOMEHOW - // hey look its my gender ^^ - .pattern("NBA") - .pattern("NFA") - .pattern("NBA") - .unlockedBy("has_focus", hasItem(HexItems.FOCUS)) - .unlockedBy("has_chorus", hasItem(Items.CHORUS_FRUIT)).save(recipes) - - ringCornerless( - HexItems.CYPHER, 1, - ingredients.copperIngot(), - Ingredient.of(HexItems.AMETHYST_DUST)) - .unlockedBy("has_item", hasItem(HexTags.Items.STAVES)).save(recipes) - - ringCornerless( - HexItems.TRINKET, 1, - ingredients.ironIngot(), - Ingredient.of(Items.AMETHYST_SHARD)) - .unlockedBy("has_item", hasItem(HexTags.Items.STAVES)).save(recipes) - - ShapedRecipeBuilder.shaped(HexItems.ARTIFACT) - .define('F', ingredients.goldIngot()) - .define('A', HexItems.CHARGED_AMETHYST) - // why in god's name does minecraft have two different places for item tags - .define('D', ItemTags.MUSIC_DISCS) - .pattern(" F ") - .pattern("FAF") - .pattern(" D ") - .unlockedBy("has_item", hasItem(HexTags.Items.STAVES)).save(recipes) - - ringCornerless(HexItems.SCRYING_LENS, 1, Items.GLASS, HexItems.AMETHYST_DUST) - .unlockedBy("has_item", hasItem(HexTags.Items.STAVES)).save(recipes) - - ShapedRecipeBuilder.shaped(HexItems.ABACUS) - .define('S', Items.STICK) - .define('A', Items.AMETHYST_SHARD) - .define('W', ItemTags.PLANKS) - .pattern("WAW") - .pattern("SAS") - .pattern("WAW") - .unlockedBy("has_item", hasItem(HexTags.Items.STAVES)).save(recipes) - - // Why am I like this - ShapedRecipeBuilder.shaped(HexItems.SUBMARINE_SANDWICH) - .define('S', Items.STICK) - .define('A', Items.AMETHYST_SHARD) - .define('C', Items.COOKED_BEEF) - .define('B', Items.BREAD) - .pattern(" SA") - .pattern(" C ") - .pattern(" B ") - .unlockedBy("has_item", hasItem(Items.AMETHYST_SHARD)).save(recipes) - - for (dye in DyeColor.values()) { - val item = HexItems.DYE_COLORIZERS[dye]!! - ShapedRecipeBuilder.shaped(item) - .define('D', HexItems.AMETHYST_DUST) - .define('C', DyeItem.byColor(dye)) - .pattern(" D ") - .pattern("DCD") - .pattern(" D ") - .unlockedBy("has_item", hasItem(HexItems.AMETHYST_DUST)).save(recipes) - } - - gayRecipe(recipes, ItemPrideColorizer.Type.AGENDER, Ingredient.of(Items.GLASS)) - gayRecipe(recipes, ItemPrideColorizer.Type.AROACE, Ingredient.of(Items.WHEAT_SEEDS)) - gayRecipe(recipes, ItemPrideColorizer.Type.AROMANTIC, Ingredient.of(Items.ARROW)) - gayRecipe(recipes, ItemPrideColorizer.Type.ASEXUAL, Ingredient.of(Items.BREAD)) - gayRecipe(recipes, ItemPrideColorizer.Type.BISEXUAL, Ingredient.of(Items.WHEAT)) - gayRecipe(recipes, ItemPrideColorizer.Type.DEMIBOY, Ingredient.of(Items.RAW_IRON)) - gayRecipe(recipes, ItemPrideColorizer.Type.DEMIGIRL, Ingredient.of(Items.RAW_COPPER)) - gayRecipe(recipes, ItemPrideColorizer.Type.GAY, Ingredient.of(Items.STONE_BRICK_WALL)) - gayRecipe(recipes, ItemPrideColorizer.Type.GENDERFLUID, Ingredient.of(Items.WATER_BUCKET)) - gayRecipe(recipes, ItemPrideColorizer.Type.GENDERQUEER, Ingredient.of(Items.GLASS_BOTTLE)) - gayRecipe(recipes, ItemPrideColorizer.Type.INTERSEX, Ingredient.of(Items.AZALEA)) - gayRecipe(recipes, ItemPrideColorizer.Type.LESBIAN, Ingredient.of(Items.HONEYCOMB)) - gayRecipe(recipes, ItemPrideColorizer.Type.NONBINARY, Ingredient.of(Items.MOSS_BLOCK)) - gayRecipe(recipes, ItemPrideColorizer.Type.PANSEXUAL, ingredients.whenModIngredient( - Ingredient.of(Items.CARROT), - "farmersdelight", - CompatIngredientValue.of("farmersdelight:skillet") - )) - gayRecipe(recipes, ItemPrideColorizer.Type.PLURAL, Ingredient.of(Items.REPEATER)) - gayRecipe(recipes, ItemPrideColorizer.Type.TRANSGENDER, Ingredient.of(Items.EGG)) - - ShapedRecipeBuilder.shaped(HexItems.UUID_COLORIZER) - .define('B', Items.BOWL) - .define('D', HexItems.AMETHYST_DUST) - .define('C', Items.AMETHYST_SHARD) - .pattern(" C ") - .pattern(" D ") - .pattern(" B ") - .unlockedBy("has_item", hasItem(HexItems.AMETHYST_DUST)).save(recipes) - - ShapedRecipeBuilder.shaped(HexItems.SCROLL_SMOL) - .define('P', Items.PAPER) - .define('A', Items.AMETHYST_SHARD) - .pattern(" A") - .pattern("P ") - .unlockedBy("has_item", hasItem(Items.AMETHYST_SHARD)).save(recipes) - - ShapedRecipeBuilder.shaped(HexItems.SCROLL_MEDIUM) - .define('P', Items.PAPER) - .define('A', Items.AMETHYST_SHARD) - .pattern(" A") - .pattern("PP ") - .pattern("PP ") - .unlockedBy("has_item", hasItem(Items.AMETHYST_SHARD)).save(recipes) - - ShapedRecipeBuilder.shaped(HexItems.SCROLL_LARGE) - .define('P', Items.PAPER) - .define('A', Items.AMETHYST_SHARD) - .pattern("PPA") - .pattern("PPP") - .pattern("PPP") - .unlockedBy("has_item", hasItem(Items.AMETHYST_SHARD)).save(recipes) - - ShapedRecipeBuilder.shaped(HexItems.SLATE, 6) - .define('S', Items.DEEPSLATE) - .define('A', HexItems.AMETHYST_DUST) - .pattern(" A ") - .pattern("SSS") - .unlockedBy("has_item", hasItem(HexItems.AMETHYST_DUST)).save(recipes) - - ShapedRecipeBuilder.shaped(HexItems.JEWELER_HAMMER) - .define('I', ingredients.ironIngot()) - .define('N', ingredients.ironNugget()) - .define('A', Items.AMETHYST_SHARD) - .define('S', ingredients.stick()) - .pattern("IAN") - .pattern(" S ") - .pattern(" S ") - .unlockedBy("has_item", hasItem(Items.AMETHYST_SHARD)).save(recipes) - - ShapedRecipeBuilder.shaped(HexBlocks.SLATE_BLOCK) - .define('S', HexItems.SLATE) - .pattern("S") - .pattern("S") - .unlockedBy("has_item", hasItem(HexItems.SLATE)) - .save(recipes, modLoc("slate_block_from_slates")) - - ringAll(HexBlocks.SLATE_BLOCK, 8, Blocks.DEEPSLATE, HexItems.AMETHYST_DUST) - .unlockedBy("has_item", hasItem(HexItems.SLATE)).save(recipes) - - packing(HexItems.AMETHYST_DUST, HexBlocks.AMETHYST_DUST_BLOCK.asItem(), "amethyst_dust", - false, recipes) - - ringAll(HexBlocks.AMETHYST_TILES, 8, Blocks.AMETHYST_BLOCK, HexItems.AMETHYST_DUST) - .unlockedBy("has_item", hasItem(HexItems.AMETHYST_DUST)).save(recipes) - - SingleItemRecipeBuilder.stonecutting(Ingredient.of(Blocks.AMETHYST_BLOCK), HexBlocks.AMETHYST_TILES) - .unlockedBy("has_item", hasItem(Blocks.AMETHYST_BLOCK)) - .save(recipes, modLoc("stonecutting/amethyst_tiles")) - - ringAll(HexBlocks.SCROLL_PAPER, 8, Items.PAPER, Items.AMETHYST_SHARD) - .unlockedBy("has_item", hasItem(Items.AMETHYST_SHARD)).save(recipes) - - ShapelessRecipeBuilder.shapeless(HexBlocks.ANCIENT_SCROLL_PAPER, 8) - .requires(ingredients.dyes()[DyeColor.BROWN]!!) - .requires(HexBlocks.SCROLL_PAPER, 8) - .unlockedBy("has_item", hasItem(HexBlocks.SCROLL_PAPER)).save(recipes) - - stack(HexBlocks.SCROLL_PAPER_LANTERN, 1, HexBlocks.SCROLL_PAPER, Items.TORCH) - .unlockedBy("has_item", hasItem(HexBlocks.SCROLL_PAPER)).save(recipes) - - stack(HexBlocks.ANCIENT_SCROLL_PAPER_LANTERN, 1, HexBlocks.ANCIENT_SCROLL_PAPER, Items.TORCH) - .unlockedBy("has_item", hasItem(HexBlocks.ANCIENT_SCROLL_PAPER)).save(recipes) - - ShapelessRecipeBuilder.shapeless(HexBlocks.ANCIENT_SCROLL_PAPER_LANTERN, 8) - .requires(ingredients.dyes()[DyeColor.BROWN]!!) - .requires(HexBlocks.SCROLL_PAPER_LANTERN, 8) - .unlockedBy("has_item", hasItem(HexBlocks.SCROLL_PAPER_LANTERN)) - .save(recipes, modLoc("ageing_scroll_paper_lantern")) - - stack(HexBlocks.SCONCE, 4, - Ingredient.of(HexItems.CHARGED_AMETHYST), - ingredients.copperIngot()) - .unlockedBy("has_item", hasItem(HexItems.CHARGED_AMETHYST)).save(recipes) - - ShapelessRecipeBuilder.shapeless(HexBlocks.EDIFIED_PLANKS, 4) - .requires(HexTags.Items.EDIFIED_LOGS) - .unlockedBy("has_item", hasItem(HexTags.Items.EDIFIED_LOGS)).save(recipes) - - ShapedRecipeBuilder.shaped(HexBlocks.EDIFIED_WOOD, 3) - .define('W', HexBlocks.EDIFIED_LOG) - .pattern("WW") - .pattern("WW") - .unlockedBy("has_item", hasItem(HexBlocks.EDIFIED_LOG)).save(recipes) - - ShapedRecipeBuilder.shaped(HexBlocks.STRIPPED_EDIFIED_WOOD, 3) - .define('W', HexBlocks.STRIPPED_EDIFIED_LOG) - .pattern("WW") - .pattern("WW") - .unlockedBy("has_item", hasItem(HexBlocks.STRIPPED_EDIFIED_LOG)).save(recipes) - - ring(HexBlocks.EDIFIED_PANEL, 8, - HexTags.Items.EDIFIED_PLANKS, null) - .unlockedBy("has_item", hasItem(HexTags.Items.EDIFIED_PLANKS)).save(recipes) - - ShapedRecipeBuilder.shaped(HexBlocks.EDIFIED_TILE, 6) - .define('W', HexTags.Items.EDIFIED_PLANKS) - .pattern("WW ") - .pattern("W W") - .pattern(" WW") - .unlockedBy("has_item", hasItem(HexTags.Items.EDIFIED_PLANKS)).save(recipes) - - ShapedRecipeBuilder.shaped(HexBlocks.EDIFIED_DOOR, 3) - .define('W', HexTags.Items.EDIFIED_PLANKS) - .pattern("WW") - .pattern("WW") - .pattern("WW") - .unlockedBy("has_item", hasItem(HexTags.Items.EDIFIED_PLANKS)).save(recipes) - - ShapedRecipeBuilder.shaped(HexBlocks.EDIFIED_TRAPDOOR, 2) - .define('W', HexTags.Items.EDIFIED_PLANKS) - .pattern("WWW") - .pattern("WWW") - .unlockedBy("has_item", hasItem(HexTags.Items.EDIFIED_PLANKS)).save(recipes) - - ShapedRecipeBuilder.shaped(HexBlocks.EDIFIED_STAIRS, 4) - .define('W', HexTags.Items.EDIFIED_PLANKS) - .pattern("W ") - .pattern("WW ") - .pattern("WWW") - .unlockedBy("has_item", hasItem(HexTags.Items.EDIFIED_PLANKS)).save(recipes) - - ShapedRecipeBuilder.shaped(HexBlocks.EDIFIED_SLAB, 6) - .define('W', HexTags.Items.EDIFIED_PLANKS) - .pattern("WWW") - .unlockedBy("has_item", hasItem(HexTags.Items.EDIFIED_PLANKS)).save(recipes) - - ShapedRecipeBuilder.shaped(HexBlocks.EDIFIED_PRESSURE_PLATE, 1) - .define('W', HexTags.Items.EDIFIED_PLANKS) - .pattern("WW") - .unlockedBy("has_item", hasItem(HexTags.Items.EDIFIED_PLANKS)).save(recipes) - - ShapelessRecipeBuilder.shapeless(HexBlocks.EDIFIED_BUTTON) - .requires(HexTags.Items.EDIFIED_PLANKS) - .unlockedBy("has_item", hasItem(HexTags.Items.EDIFIED_PLANKS)).save(recipes) - - val enlightenment = OvercastTrigger.Instance( - EntityPredicate.Composite.ANY, - MinMaxBounds.Ints.ANY, // add a little bit of slop here - MinMaxBounds.Doubles.atLeast(0.8), - MinMaxBounds.Doubles.between(0.1, 2.05) - ) - ShapedRecipeBuilder.shaped(HexBlocks.EMPTY_IMPETUS) - .define('B', Items.IRON_BARS) - .define('A', HexItems.CHARGED_AMETHYST) - .define('S', HexBlocks.SLATE_BLOCK) - .define('P', Items.PURPUR_BLOCK) - .pattern("PSS") - .pattern("BAB") - .pattern("SSP") - .unlockedBy("enlightenment", enlightenment).save(recipes) - - ShapedRecipeBuilder.shaped(HexBlocks.EMPTY_DIRECTRIX) - .define('C', Items.COMPARATOR) - .define('O', Items.OBSERVER) - .define('A', HexItems.CHARGED_AMETHYST) - .define('S', HexBlocks.SLATE_BLOCK) - .pattern("CSS") - .pattern("OAO") - .pattern("SSC") - .unlockedBy("enlightenment", enlightenment).save(recipes) - - ShapedRecipeBuilder.shaped(HexBlocks.AKASHIC_BOOKSHELF) - .define('L', HexTags.Items.EDIFIED_LOGS) - .define('P', HexTags.Items.EDIFIED_PLANKS) - .define('C', Items.BOOK) - /*this is the*/.pattern("LPL") // and what i have for you today is - .pattern("CCC") - .pattern("LPL") - .unlockedBy("enlightenment", enlightenment).save(recipes) - - ShapedRecipeBuilder.shaped(HexBlocks.AKASHIC_LIGATURE) - .define('L', HexTags.Items.EDIFIED_LOGS) - .define('P', HexTags.Items.EDIFIED_PLANKS) - .define('C', HexItems.CHARGED_AMETHYST) - .pattern("LPL") - .pattern("CCC") - .pattern("LPL") - .unlockedBy("enlightenment", enlightenment).save(recipes) - - BrainsweepRecipeBuilder(StateIngredientHelper.of(Blocks.AMETHYST_BLOCK), - VillagerIngredient(null, null, 3), - Blocks.BUDDING_AMETHYST.defaultBlockState(), MediaConstants.CRYSTAL_UNIT * 10) - .unlockedBy("enlightenment", enlightenment) - .save(recipes, modLoc("brainsweep/budding_amethyst")) - - BrainsweepRecipeBuilder(StateIngredientHelper.of(HexBlocks.EMPTY_IMPETUS), - VillagerIngredient(ResourceLocation("toolsmith"), null, 2), - HexBlocks.IMPETUS_RIGHTCLICK.defaultBlockState(), MediaConstants.CRYSTAL_UNIT * 10) - .unlockedBy("enlightenment", enlightenment) - .save(recipes, modLoc("brainsweep/impetus_rightclick")) - - BrainsweepRecipeBuilder(StateIngredientHelper.of(HexBlocks.EMPTY_IMPETUS), - VillagerIngredient(ResourceLocation("fletcher"), null, 2), - HexBlocks.IMPETUS_LOOK.defaultBlockState(), MediaConstants.CRYSTAL_UNIT * 10) - .unlockedBy("enlightenment", enlightenment) - .save(recipes, modLoc("brainsweep/impetus_look")) - - BrainsweepRecipeBuilder(StateIngredientHelper.of(HexBlocks.EMPTY_IMPETUS), - VillagerIngredient(ResourceLocation("cleric"), null, 2), - HexBlocks.IMPETUS_STOREDPLAYER.defaultBlockState(), MediaConstants.CRYSTAL_UNIT * 10) - .unlockedBy("enlightenment", enlightenment) - .save(recipes, modLoc("brainsweep/impetus_storedplayer")) - - BrainsweepRecipeBuilder(StateIngredientHelper.of(HexBlocks.EMPTY_DIRECTRIX), - VillagerIngredient(ResourceLocation("mason"), null, 1), - HexBlocks.DIRECTRIX_REDSTONE.defaultBlockState(), MediaConstants.CRYSTAL_UNIT * 10) - .unlockedBy("enlightenment", enlightenment) - .save(recipes, modLoc("brainsweep/directrix_redstone")) - - BrainsweepRecipeBuilder(StateIngredientHelper.of(HexBlocks.AKASHIC_LIGATURE), - VillagerIngredient(ResourceLocation("librarian"), null, 5), - HexBlocks.AKASHIC_RECORD.defaultBlockState(), MediaConstants.CRYSTAL_UNIT * 10) - .unlockedBy("enlightenment", enlightenment) - .save(recipes, modLoc("brainsweep/akashic_record")) - - // Create compat - CreateCrushingRecipeBuilder() - .withInput(Blocks.AMETHYST_CLUSTER) - .duration(150) - .withOutput(Items.AMETHYST_SHARD, 7) - .withOutput(HexItems.AMETHYST_DUST, 5) - .withOutput(0.25f, HexItems.CHARGED_AMETHYST) - .withConditions() - .whenModLoaded("create") - .save(recipes, ResourceLocation("create", "crushing/amethyst_cluster")) - - CreateCrushingRecipeBuilder() - .withInput(Blocks.AMETHYST_BLOCK) - .duration(150) - .withOutput(Items.AMETHYST_SHARD, 3) - .withOutput(0.5f, HexItems.AMETHYST_DUST, 4) - .withConditions() - .whenModLoaded("create") - .save(recipes, ResourceLocation("create", "crushing/amethyst_block")) - - CreateCrushingRecipeBuilder() - .withInput(Items.AMETHYST_SHARD) - .duration(150) - .withOutput(HexItems.AMETHYST_DUST, 4) - .withOutput(0.5f, HexItems.AMETHYST_DUST) - .withConditions() - .whenModLoaded("create") - .save(recipes, modLoc("compat/create/crushing/amethyst_shard")) - - // FD compat - FarmersDelightCuttingRecipeBuilder() - .withInput(HexBlocks.EDIFIED_LOG) - .withTool(ingredients.axeStrip()) - .withOutput(HexBlocks.STRIPPED_EDIFIED_LOG) - .withOutput("farmersdelight:tree_bark") - .withSound(SoundEvents.AXE_STRIP) - .withConditions() - .whenModLoaded("farmersdelight") - .save(recipes, modLoc("compat/farmersdelight/cutting/akashic_log")) - - FarmersDelightCuttingRecipeBuilder() - .withInput(HexBlocks.EDIFIED_WOOD) - .withTool(ingredients.axeStrip()) - .withOutput(HexBlocks.STRIPPED_EDIFIED_WOOD) - .withOutput("farmersdelight:tree_bark") - .withSound(SoundEvents.AXE_STRIP) - .withConditions() - .whenModLoaded("farmersdelight") - .save(recipes, modLoc("compat/farmersdelight/cutting/akashic_wood")) - - FarmersDelightCuttingRecipeBuilder() - .withInput(HexBlocks.EDIFIED_TRAPDOOR) - .withTool(ingredients.axeDig()) - .withOutput(HexBlocks.EDIFIED_PLANKS) - .withConditions() - .whenModLoaded("farmersdelight") - .save(recipes, modLoc("compat/farmersdelight/cutting/akashic_trapdoor")) - - FarmersDelightCuttingRecipeBuilder() - .withInput(HexBlocks.EDIFIED_DOOR) - .withTool(ingredients.axeDig()) - .withOutput(HexBlocks.EDIFIED_PLANKS) - .withConditions() - .whenModLoaded("farmersdelight") - .save(recipes, modLoc("compat/farmersdelight/cutting/akashic_door")) - } - - private fun wandRecipe(recipes: Consumer, wand: ItemStaff, plank: Item) { - ShapedRecipeBuilder.shaped(wand) - .define('W', plank) - .define('S', Items.STICK) - .define('A', HexItems.CHARGED_AMETHYST) - .pattern(" SA") - .pattern(" WS") - .pattern("S ") - .unlockedBy("has_item", hasItem(HexItems.CHARGED_AMETHYST)) - .save(recipes) - } - - private fun gayRecipe(recipes: Consumer, type: ItemPrideColorizer.Type, material: Ingredient) { - val colorizer = HexItems.PRIDE_COLORIZERS[type]!! - ShapedRecipeBuilder.shaped(colorizer) - .define('D', HexItems.AMETHYST_DUST) - .define('C', material) - .pattern(" D ") - .pattern("DCD") - .pattern(" D ") - .unlockedBy("has_item", hasItem(HexItems.AMETHYST_DUST)) - .save(recipes) - } - - private fun specialRecipe(consumer: Consumer, serializer: SimpleRecipeSerializer<*>) { - val name = Registry.RECIPE_SERIALIZER.getKey(serializer) - SpecialRecipeBuilder.special(serializer).save(consumer, HexAPI.MOD_ID + ":dynamic/" + name!!.path) - } - - private fun RecipeBuilder.withConditions(): IXplatConditionsBuilder = conditions(this) -} diff --git a/Common/src/main/java/at/petrak/hexcasting/datagen/recipe/builders/BrainsweepRecipeBuilder.java b/Common/src/main/java/at/petrak/hexcasting/datagen/recipe/builders/BrainsweepRecipeBuilder.java index c3f5c76f..5a0bbeef 100644 --- a/Common/src/main/java/at/petrak/hexcasting/datagen/recipe/builders/BrainsweepRecipeBuilder.java +++ b/Common/src/main/java/at/petrak/hexcasting/datagen/recipe/builders/BrainsweepRecipeBuilder.java @@ -22,16 +22,16 @@ import java.util.function.Consumer; public class BrainsweepRecipeBuilder implements RecipeBuilder { private final StateIngredient blockIn; - private final BrainsweepeeIngredient villagerIn; + private final BrainsweepeeIngredient entityIn; private final int mediaCost; private final BlockState result; private final Advancement.Builder advancement; - public BrainsweepRecipeBuilder(StateIngredient blockIn, BrainsweepeeIngredient villagerIn, BlockState result, + public BrainsweepRecipeBuilder(StateIngredient blockIn, BrainsweepeeIngredient entityIn, BlockState result, int mediaCost) { this.blockIn = blockIn; - this.villagerIn = villagerIn; + this.entityIn = entityIn; this.result = result; this.mediaCost = mediaCost; this.advancement = Advancement.Builder.advancement(); @@ -65,7 +65,7 @@ public class BrainsweepRecipeBuilder implements RecipeBuilder { .requirements(RequirementsStrategy.OR); pFinishedRecipeConsumer.accept(new Result( pRecipeId, - this.blockIn, this.villagerIn, this.mediaCost, this.result, + this.blockIn, this.entityIn, this.mediaCost, this.result, this.advancement, new ResourceLocation(pRecipeId.getNamespace(), "recipes/brainsweep/" + pRecipeId.getPath()))); } diff --git a/Common/src/main/java/at/petrak/hexcasting/interop/patchouli/BrainsweepProcessor.java b/Common/src/main/java/at/petrak/hexcasting/interop/patchouli/BrainsweepProcessor.java index 33cfad4e..6694a8ab 100644 --- a/Common/src/main/java/at/petrak/hexcasting/interop/patchouli/BrainsweepProcessor.java +++ b/Common/src/main/java/at/petrak/hexcasting/interop/patchouli/BrainsweepProcessor.java @@ -2,19 +2,20 @@ package at.petrak.hexcasting.interop.patchouli; import at.petrak.hexcasting.common.recipe.BrainsweepRecipe; import at.petrak.hexcasting.common.recipe.HexRecipeStuffRegistry; -import at.petrak.hexcasting.common.recipe.ingredient.brainsweep.EntityTypeIngredient; -import at.petrak.hexcasting.common.recipe.ingredient.brainsweep.VillagerIngredient; import net.minecraft.client.Minecraft; +import net.minecraft.core.Registry; +import net.minecraft.nbt.CompoundTag; import net.minecraft.resources.ResourceLocation; import net.minecraft.world.item.ItemStack; +import org.jetbrains.annotations.Nullable; import vazkii.patchouli.api.IComponentProcessor; import vazkii.patchouli.api.IVariable; import vazkii.patchouli.api.IVariableProvider; -import java.util.Objects; - public class BrainsweepProcessor implements IComponentProcessor { private BrainsweepRecipe recipe; + @Nullable + private String exampleEntityString; @Override public void setup(IVariableProvider vars) { @@ -49,22 +50,22 @@ public class BrainsweepProcessor implements IComponentProcessor { } case "entity" -> { - if (this.recipe.entityIn() instanceof VillagerIngredient villager) { - var profession = Objects.requireNonNullElse(villager.profession, - new ResourceLocation("toolsmith")); - var biome = Objects.requireNonNullElse(villager.biome, - new ResourceLocation("plains")); - var level = villager.minLevel; - var iHatePatchouli = String.format( - "minecraft:villager{VillagerData:{profession:'%s',type:'%s',level:%d}}", - profession, biome, level); - return IVariable.wrap(iHatePatchouli); - } else if (this.recipe.entityIn() instanceof EntityTypeIngredient entity) { - // TODO - return IVariable.wrap("minecraft:chicken"); - } else { - throw new IllegalStateException(); + if (this.exampleEntityString == null) { + var entity = this.recipe.entityIn().exampleEntity(Minecraft.getInstance().level); + if (entity == null) { + // oh dear + return null; + } + var bob = new StringBuilder(); + bob.append(Registry.ENTITY_TYPE.getKey(entity.getType())); + + var tag = new CompoundTag(); + entity.save(tag); + bob.append(tag.toString()); + this.exampleEntityString = bob.toString(); } + + return IVariable.wrap(this.exampleEntityString); } case "entityTooltip" -> { Minecraft mc = Minecraft.getInstance(); diff --git a/Fabric/src/generated/resources/.cache/03e4de26f1265135874f8cdcaebc09d9c08eb42b b/Fabric/src/generated/resources/.cache/03e4de26f1265135874f8cdcaebc09d9c08eb42b index 209aa213..40812693 100644 --- a/Fabric/src/generated/resources/.cache/03e4de26f1265135874f8cdcaebc09d9c08eb42b +++ b/Fabric/src/generated/resources/.cache/03e4de26f1265135874f8cdcaebc09d9c08eb42b @@ -1,4 +1,4 @@ -// 1.19.2 2022-11-21T19:55:21.969467688 Tags for minecraft:item +// 1.19.2 2022-12-29T13:31:04.089602837 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 e7aa2ff7..b8815f06 100644 --- a/Fabric/src/generated/resources/.cache/67cce32b1c3cbbcb1f646605f4914e3f196986c2 +++ b/Fabric/src/generated/resources/.cache/67cce32b1c3cbbcb1f646605f4914e3f196986c2 @@ -1,4 +1,4 @@ -// 1.19.2 2022-11-21T19:55:21.965828817 LootTables +// 1.19.2 2022-12-29T13:31:04.07610805 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 6dbd1357..ecf16b72 100644 --- a/Fabric/src/generated/resources/.cache/75bcd4dba6ca7d365462b0ec45e291d1056349c4 +++ b/Fabric/src/generated/resources/.cache/75bcd4dba6ca7d365462b0ec45e291d1056349c4 @@ -1,4 +1,4 @@ -// 1.19.2 2022-11-21T19:55:21.971658683 Tags for minecraft:block +// 1.19.2 2022-12-29T13:31:04.07186608 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/9fb1092f32d4fcbf9e061ffd718d4ec689c6c95e b/Fabric/src/generated/resources/.cache/9fb1092f32d4fcbf9e061ffd718d4ec689c6c95e index a823071a..9e9a9a14 100644 --- a/Fabric/src/generated/resources/.cache/9fb1092f32d4fcbf9e061ffd718d4ec689c6c95e +++ b/Fabric/src/generated/resources/.cache/9fb1092f32d4fcbf9e061ffd718d4ec689c6c95e @@ -1,4 +1,4 @@ -// 1.19.2 2022-11-21T19:55:21.951767357 Recipes +// 1.19.2 2022-12-29T13:31:04.05733867 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 @@ -12,7 +12,6 @@ c3f9cca50935f7abf141825d78b441033fc0dab8 data/hexcasting/advancements/recipes/he ef5a19ab2710fd0ce836d767588fe6a54a528a48 data/hexcasting/recipes/dye_colorizer_white.json 768d70365c56ef1fbad089d3e3fd68548f964227 data/hexcasting/recipes/dye_colorizer_black.json dfb42a8b723b37df5c8888bdef86a1be35f2de72 data/hexcasting/recipes/pride_colorizer_bisexual.json -d323e21de69d0606d1fac03fa8820e5857e4e1f1 data/hexcasting/recipes/dynamic/seal_spellbook.json 605f921a98b5dabbd80bc762070916e7d6756df6 data/hexcasting/advancements/recipes/hexcasting.creative_tab/dye_colorizer_orange.json 17aa26ce6bc9941d1477dee99e514fd66be7f664 data/hexcasting/recipes/pride_colorizer_aroace.json 6978ff90efdd067940caccdd29437d2aefd0fe1f data/hexcasting/recipes/scroll_paper.json @@ -36,7 +35,7 @@ be7ceaf2b55525f06178fb09070dfeeef8da1c65 data/hexcasting/advancements/recipes/he 62bfad9dc29406a9807ea33f866cbdfca32e7d0a data/hexcasting/advancements/recipes/hexcasting.creative_tab/amethyst_dust_unpacking.json 4cc110d5ce9831c0072cc2c4fd8f1a6196f42331 data/hexcasting/advancements/recipes/hexcasting.creative_tab/ancient_scroll_paper_lantern.json 1315f615ebc6593829bd86318d8eb45c2de68876 data/hexcasting/advancements/recipes/hexcasting.creative_tab/edified_button.json -3514bb0e92046ca12dfd10afb3c47084434f84c2 data/hexcasting/recipes/brainsweep/akashic_record.json +e0609202271e402d8ae58e4f8eaf11dcdda10a9e data/hexcasting/recipes/brainsweep/akashic_record.json b21f6cbf11e23eac313d68805428cc0da55edb83 data/hexcasting/recipes/compat/farmersdelight/cutting/akashic_log.json 1b210391768fede639b29ae6fc5adf2b8b4e64c6 data/hexcasting/advancements/recipes/hexcasting.creative_tab/dye_colorizer_brown.json ae2c6392cc0ec104c4e3019e1824a1e7f811f1de data/hexcasting/advancements/recipes/hexcasting.creative_tab/abacus.json @@ -55,17 +54,18 @@ ebfa29e0a62a629afbe18681e09cc7be95a3529e data/hexcasting/advancements/recipes/he f8e027860b2505a7217d1264c5d0b6f7feea0679 data/hexcasting/advancements/recipes/hexcasting.creative_tab/edified_door.json 2aa2e5c268ae440238eaf4cea20011b0c8f81a49 data/hexcasting/advancements/recipes/hexcasting.creative_tab/pride_colorizer_demiboy.json 63da3af421dfb38283d750eb3b9761f42e95fb91 data/hexcasting/advancements/recipes/hexcasting.creative_tab/stripped_edified_wood.json -c86adafd19871ba67f0b7b693247c0a5bdec1020 data/hexcasting/recipes/brainsweep/impetus_storedplayer.json +24984d728a5c05967c58be9c0dc1c59e986602e6 data/hexcasting/recipes/brainsweep/impetus_storedplayer.json 326925a948aeb17aabafbc25ed2562a257796d29 data/hexcasting/recipes/dye_colorizer_yellow.json 2a1021614882392be78d22cb557e43cbbd9092ca data/hexcasting/advancements/recipes/brainsweep/brainsweep/impetus_rightclick.json 4440b41499c9c32e297dc184c39da010ff82ac5e data/hexcasting/advancements/recipes/hexcasting.creative_tab/uuid_colorizer.json -63d9172717dd1cbb587fc9d92fd69f47b1bb3307 data/hexcasting/recipes/brainsweep/budding_amethyst.json +5a90084c03d6e8424872870c8b65f4771b447f03 data/hexcasting/recipes/brainsweep/budding_amethyst.json 6e6c73a93e0e06ff399d95e40baf4e06f3a25a0a data/hexcasting/advancements/recipes/hexcasting.creative_tab/slate_block_from_slates.json 3662834d6e0bac03aba28f0f9d9f07f511492118 data/hexcasting/recipes/lens.json 4ba0fcb9b3142029c36cc48b250b89b0cac3f6de data/hexcasting/recipes/akashic_connector.json +eaba34eebb8cb0d8d752ab1d574752e651626c24 data/hexcasting/advancements/recipes/brainsweep/brainsweep/testing/flowey_the_flower.json 1c5681b6bf354ce068c51852b51a5aba9ac2d8f9 data/hexcasting/recipes/compat/create/crushing/amethyst_shard.json 336465276c06fc59be003ccad3d6fc121fa438f5 data/hexcasting/recipes/edified_staff.json -773860888fb2d695b775f3afb93b16f43795bcc6 data/hexcasting/recipes/brainsweep/impetus_rightclick.json +1086a6e3f284fc3b575ee3a21d2b13d0bc62d2bb data/hexcasting/recipes/brainsweep/impetus_rightclick.json ce0cd4d73792c30dcec2eea306bff44b28cb237f data/hexcasting/recipes/pride_colorizer_agender.json f91ab1d68c575970ef48ad499ec92057a8ee7b2e data/hexcasting/recipes/cypher.json a331f4ce9b8d3565cbb154af4d63279f1e2c7a41 data/hexcasting/recipes/compat/farmersdelight/cutting/akashic_trapdoor.json @@ -75,6 +75,7 @@ f75c21d35b926a2303d60115a297c387790bbbd9 data/hexcasting/advancements/recipes/he 3b83dd1c1aa1bcc58e6512bca75c3a6a3b7482b3 data/hexcasting/recipes/edified_tile.json 7ae2bd282afbf2f460a6bb705fe301a2a11d7835 data/hexcasting/advancements/recipes/hexcasting.creative_tab/akashic_connector.json d603560d9bbe0bd3e9c0ca5cd502fe874337599e data/hexcasting/advancements/recipes/hexcasting.creative_tab/dye_colorizer_light_gray.json +0ee8d29cb06065a55017a8fc50576193107f958d data/hexcasting/recipes/dynamicseal_focus.json da3c95902e93fe82e489ceccc84a56159329e091 data/hexcasting/advancements/recipes/brainsweep/brainsweep/impetus_look.json 8c49c1c022cee20fb2a44046425b48cd0e6659af data/hexcasting/advancements/recipes/hexcasting.creative_tab/birch_staff.json 12e1ba1ec29bf0eadf1210d2307fab35e9685085 data/hexcasting/recipes/empty_directrix.json @@ -92,6 +93,7 @@ b494dc17959c76857f25368eb845e58e4f8bca92 data/hexcasting/recipes/compat/farmersd 36c97b8de7a0b67256e8966eca289a865cb85df5 data/hexcasting/advancements/recipes/hexcasting.creative_tab/pride_colorizer_bisexual.json 4bff4a59e32c6d1d99bc3a8abd16cd88c51a8e73 data/hexcasting/recipes/dye_colorizer_orange.json 1f04d75a1c713d3c5ac44e62889ce834f12d6234 data/hexcasting/recipes/jeweler_hammer.json +0de6f2437a3c33a92de2f3e6b7ac6102996c8779 data/hexcasting/advancements/recipes/brainsweep/brainsweep/testing/bad_to_the_bone.json 8a9e7aa8d07556649768729348dff5305b84e1b9 data/hexcasting/recipes/edified_door.json e52dbfc2d86bb3e87ff554fc8d5f0d43b7ff334a data/hexcasting/advancements/recipes/hexcasting.creative_tab/dye_colorizer_gray.json b6d6716724729f0530a524f92d7e4646455de344 data/hexcasting/advancements/recipes/hexcasting.creative_tab/dye_colorizer_red.json @@ -108,9 +110,11 @@ bd3e10b3d468e48e72ad060b9eb0b9f8f4057bf1 data/hexcasting/recipes/ageing_scroll_p 6641b22c79fa29fab15d414afecabd3aa7402b38 data/hexcasting/advancements/recipes/hexcasting.creative_tab/scroll_paper_lantern.json 3ae790bef91b6ae57ed7e3e792740ea059875293 data/hexcasting/advancements/recipes/hexcasting.creative_tab/dye_colorizer_cyan.json c7d28ccf9df6fc46aa142c2e7b176cc0cb5ea62b data/hexcasting/recipes/empty_impetus.json +16c91a664dbe7914a7db566f45158c8191e52afb data/hexcasting/recipes/brainsweep/testing/bad_to_the_bone.json f0a77ba758e649d0c16a8e2d9964d18f95a544f4 data/hexcasting/advancements/recipes/hexcasting.creative_tab/slate.json f9e4d9171ffc6a125d9899f1867398acf8037b27 data/hexcasting/advancements/recipes/hexcasting.creative_tab/pride_colorizer_agender.json c93cecd3f883e57f3cce7ad3d6aad44000ed541c data/hexcasting/recipes/ancient_scroll_paper.json +ba08fd11d19f54c504ceed6f162a5d814e03d1e8 data/hexcasting/recipes/brainsweep/testing/flowey_the_flower.json 12d9ec588869179a8e8a1f4bce718175d57e4a71 data/create/recipes/crushing/amethyst_block.json ab26481b45a7f463e2225b9a04d24a1b4d84daef data/hexcasting/recipes/abacus.json fccc3e05b011e1fd1a41a0bfca11876d0fb16df2 data/hexcasting/advancements/recipes/hexcasting.creative_tab/scroll_small.json @@ -124,6 +128,7 @@ e687ceab424098d586f0b67a34fe65bee1f4dfca data/hexcasting/advancements/recipes/he 202e70722198141d5dd961bb087a25873e4928af data/hexcasting/recipes/edified_stairs.json 6e692bdb7e797c1d0fffb5fcc90c5a3b28e4aaff data/hexcasting/advancements/recipes/hexcasting.creative_tab/pride_colorizer_aromantic.json b640608755649a8bde55a434016b14522fa6d2e0 data/hexcasting/advancements/recipes/hexcasting.creative_tab/edified_wood.json +d323e21de69d0606d1fac03fa8820e5857e4e1f1 data/hexcasting/recipes/dynamicseal_spellbook.json e0e49c8a9977fe2b0619179b11a4379b5b19ace9 data/hexcasting/advancements/recipes/hexcasting.creative_tab/sub_sandwich.json b2dc08cc62b9a36d6b034aead99e0b328b5efecb data/hexcasting/recipes/scroll_small.json e3416c3e103fe206cbaa352eb5011f81ccfc6aca data/hexcasting/recipes/slate.json @@ -140,7 +145,7 @@ b7d75dcd88e5091ff44eec236531a56e82c7bd91 data/hexcasting/advancements/recipes/he 13ca24f9f87a6b34f7717e5c326291079e6db96f data/hexcasting/recipes/sub_sandwich.json 90088535c8e4d0beb0725878314c49ac8deb373b data/hexcasting/recipes/amethyst_dust_packing.json 220f4dc7c8f857092bcb85b5ccf8936237ededa4 data/hexcasting/advancements/recipes/hexcasting.creative_tab/amethyst_sconce.json -ae676c825f58eefb2bfbbd866db13dbb59deff0e data/hexcasting/recipes/brainsweep/impetus_look.json +7a51e934846a0d7fe00a808cfa22fd85da67fe9d data/hexcasting/recipes/brainsweep/impetus_look.json f0849d723141b9f02798d474da6594f78755dd51 data/hexcasting/recipes/amethyst_tiles.json a184ee70962538e4f8641c707d6dca8796ca36e7 data/hexcasting/recipes/edified_slab.json b7250840982952fc23c8b32b77517744329d8d2d data/hexcasting/recipes/spellbook.json @@ -155,7 +160,6 @@ b7250840982952fc23c8b32b77517744329d8d2d data/hexcasting/recipes/spellbook.json d7f93550b7c25b963eaf34d4d2ab9d9871830983 data/hexcasting/recipes/dye_colorizer_cyan.json 9c8503715195c4cb2e2d9a1abe4f94df7bb9f4b5 data/hexcasting/advancements/recipes/hexcasting.creative_tab/stonecutting/amethyst_tiles.json e91b58b8a52d0d69e13102fbf743aab8be177924 data/hexcasting/recipes/pride_colorizer_genderfluid.json -0ee8d29cb06065a55017a8fc50576193107f958d data/hexcasting/recipes/dynamic/seal_focus.json b7fc41f8cfd83a0d138290251d63bb6cc04e0f9a data/hexcasting/recipes/edified_pressure_plate.json 122ca20f3a77c1267e4b8c755e9cd66e56734547 data/hexcasting/advancements/recipes/hexcasting.creative_tab/pride_colorizer_genderqueer.json 3c552071e6b3cfd4932b8f1e8d8b91aae8ead99d data/hexcasting/advancements/recipes/hexcasting.creative_tab/dark_oak_staff.json @@ -166,7 +170,7 @@ a22233090497e1c44082b6eb16ad079d9acc8f7c data/hexcasting/advancements/recipes/br aa4a00864f1b22835612fe60a4715250f3ab2126 data/hexcasting/advancements/recipes/hexcasting.creative_tab/edified_panel.json 6f5ee50706640e9be82810e22388fc7b2bce13b1 data/hexcasting/recipes/birch_staff.json e35c89ccc099c511c9ab321a7490d35f2e8c9353 data/hexcasting/advancements/recipes/hexcasting.creative_tab/amethyst_dust_packing.json -9bd09d681a608e465feb6d6a63d0b021920c7a1d data/hexcasting/recipes/brainsweep/directrix_redstone.json +3127e275f4dc31d80a21f9119fcebc527e821caa data/hexcasting/recipes/brainsweep/directrix_redstone.json 735a7d770f23a02dc4ae93644e7f4c44a32e313a data/hexcasting/recipes/oak_staff.json d75bc1009064769735d46e7f4f32c65d10a470e3 data/hexcasting/recipes/pride_colorizer_asexual.json 36c3ea4547b49c7553e7024192d5ddf6f2163422 data/hexcasting/recipes/scroll_paper_lantern.json diff --git a/Fabric/src/generated/resources/data/hexcasting/advancements/recipes/brainsweep/brainsweep/testing/bad_to_the_bone.json b/Fabric/src/generated/resources/data/hexcasting/advancements/recipes/brainsweep/brainsweep/testing/bad_to_the_bone.json new file mode 100644 index 00000000..edd1db8e --- /dev/null +++ b/Fabric/src/generated/resources/data/hexcasting/advancements/recipes/brainsweep/brainsweep/testing/bad_to_the_bone.json @@ -0,0 +1,34 @@ +{ + "parent": "minecraft:recipes/root", + "criteria": { + "enlightenment": { + "conditions": { + "health_used": { + "min": 0.8 + }, + "mojang_i_am_begging_and_crying_please_add_an_entity_health_criterion": { + "max": 2.05, + "min": 0.1 + } + }, + "trigger": "hexcasting:overcast" + }, + "has_the_recipe": { + "conditions": { + "recipe": "hexcasting:brainsweep/testing/bad_to_the_bone" + }, + "trigger": "minecraft:recipe_unlocked" + } + }, + "requirements": [ + [ + "enlightenment", + "has_the_recipe" + ] + ], + "rewards": { + "recipes": [ + "hexcasting:brainsweep/testing/bad_to_the_bone" + ] + } +} \ No newline at end of file diff --git a/Fabric/src/generated/resources/data/hexcasting/advancements/recipes/brainsweep/brainsweep/testing/flowey_the_flower.json b/Fabric/src/generated/resources/data/hexcasting/advancements/recipes/brainsweep/brainsweep/testing/flowey_the_flower.json new file mode 100644 index 00000000..7b01dd50 --- /dev/null +++ b/Fabric/src/generated/resources/data/hexcasting/advancements/recipes/brainsweep/brainsweep/testing/flowey_the_flower.json @@ -0,0 +1,34 @@ +{ + "parent": "minecraft:recipes/root", + "criteria": { + "enlightenment": { + "conditions": { + "health_used": { + "min": 0.8 + }, + "mojang_i_am_begging_and_crying_please_add_an_entity_health_criterion": { + "max": 2.05, + "min": 0.1 + } + }, + "trigger": "hexcasting:overcast" + }, + "has_the_recipe": { + "conditions": { + "recipe": "hexcasting:brainsweep/testing/flowey_the_flower" + }, + "trigger": "minecraft:recipe_unlocked" + } + }, + "requirements": [ + [ + "enlightenment", + "has_the_recipe" + ] + ], + "rewards": { + "recipes": [ + "hexcasting:brainsweep/testing/flowey_the_flower" + ] + } +} \ No newline at end of file diff --git a/Fabric/src/generated/resources/data/hexcasting/recipes/brainsweep/akashic_record.json b/Fabric/src/generated/resources/data/hexcasting/recipes/brainsweep/akashic_record.json index 65f772c8..6ff75581 100644 --- a/Fabric/src/generated/resources/data/hexcasting/recipes/brainsweep/akashic_record.json +++ b/Fabric/src/generated/resources/data/hexcasting/recipes/brainsweep/akashic_record.json @@ -4,11 +4,13 @@ "type": "block", "block": "hexcasting:akashic_connector" }, + "cost": 1000000, + "entityIn": { + "type": "villager", + "minLevel": 5, + "profession": "librarian" + }, "result": { "name": "hexcasting:akashic_record" - }, - "villagerIn": { - "minLevel": 5, - "profession": "minecraft:librarian" } } \ No newline at end of file diff --git a/Fabric/src/generated/resources/data/hexcasting/recipes/brainsweep/budding_amethyst.json b/Fabric/src/generated/resources/data/hexcasting/recipes/brainsweep/budding_amethyst.json index 0d7b8aeb..b58a6ec9 100644 --- a/Fabric/src/generated/resources/data/hexcasting/recipes/brainsweep/budding_amethyst.json +++ b/Fabric/src/generated/resources/data/hexcasting/recipes/brainsweep/budding_amethyst.json @@ -4,10 +4,12 @@ "type": "block", "block": "minecraft:amethyst_block" }, + "cost": 1000000, + "entityIn": { + "type": "villager", + "minLevel": 3 + }, "result": { "name": "minecraft:budding_amethyst" - }, - "villagerIn": { - "minLevel": 3 } } \ No newline at end of file diff --git a/Fabric/src/generated/resources/data/hexcasting/recipes/brainsweep/directrix_redstone.json b/Fabric/src/generated/resources/data/hexcasting/recipes/brainsweep/directrix_redstone.json index cd6f95c3..614ea5a6 100644 --- a/Fabric/src/generated/resources/data/hexcasting/recipes/brainsweep/directrix_redstone.json +++ b/Fabric/src/generated/resources/data/hexcasting/recipes/brainsweep/directrix_redstone.json @@ -4,6 +4,12 @@ "type": "block", "block": "hexcasting:empty_directrix" }, + "cost": 1000000, + "entityIn": { + "type": "villager", + "minLevel": 1, + "profession": "mason" + }, "result": { "name": "hexcasting:directrix_redstone", "properties": { @@ -11,9 +17,5 @@ "facing": "north", "powered": "false" } - }, - "villagerIn": { - "minLevel": 1, - "profession": "minecraft:mason" } } \ No newline at end of file diff --git a/Fabric/src/generated/resources/data/hexcasting/recipes/brainsweep/impetus_look.json b/Fabric/src/generated/resources/data/hexcasting/recipes/brainsweep/impetus_look.json index 1eaa96b3..882d44e4 100644 --- a/Fabric/src/generated/resources/data/hexcasting/recipes/brainsweep/impetus_look.json +++ b/Fabric/src/generated/resources/data/hexcasting/recipes/brainsweep/impetus_look.json @@ -4,15 +4,17 @@ "type": "block", "block": "hexcasting:empty_impetus" }, + "cost": 1000000, + "entityIn": { + "type": "villager", + "minLevel": 2, + "profession": "toolsmith" + }, "result": { "name": "hexcasting:impetus_look", "properties": { "energized": "false", "facing": "north" } - }, - "villagerIn": { - "minLevel": 2, - "profession": "minecraft:fletcher" } } \ No newline at end of file diff --git a/Fabric/src/generated/resources/data/hexcasting/recipes/brainsweep/impetus_rightclick.json b/Fabric/src/generated/resources/data/hexcasting/recipes/brainsweep/impetus_rightclick.json index a92539c0..36366977 100644 --- a/Fabric/src/generated/resources/data/hexcasting/recipes/brainsweep/impetus_rightclick.json +++ b/Fabric/src/generated/resources/data/hexcasting/recipes/brainsweep/impetus_rightclick.json @@ -4,15 +4,17 @@ "type": "block", "block": "hexcasting:empty_impetus" }, + "cost": 1000000, + "entityIn": { + "type": "villager", + "minLevel": 2, + "profession": "toolsmith" + }, "result": { "name": "hexcasting:impetus_rightclick", "properties": { "energized": "false", "facing": "north" } - }, - "villagerIn": { - "minLevel": 2, - "profession": "minecraft:toolsmith" } } \ No newline at end of file diff --git a/Fabric/src/generated/resources/data/hexcasting/recipes/brainsweep/impetus_storedplayer.json b/Fabric/src/generated/resources/data/hexcasting/recipes/brainsweep/impetus_storedplayer.json index ea63f87c..8529689e 100644 --- a/Fabric/src/generated/resources/data/hexcasting/recipes/brainsweep/impetus_storedplayer.json +++ b/Fabric/src/generated/resources/data/hexcasting/recipes/brainsweep/impetus_storedplayer.json @@ -4,6 +4,12 @@ "type": "block", "block": "hexcasting:empty_impetus" }, + "cost": 1000000, + "entityIn": { + "type": "villager", + "minLevel": 2, + "profession": "cleric" + }, "result": { "name": "hexcasting:impetus_storedplayer", "properties": { @@ -11,9 +17,5 @@ "facing": "north", "powered": "true" } - }, - "villagerIn": { - "minLevel": 2, - "profession": "minecraft:cleric" } } \ No newline at end of file diff --git a/Fabric/src/generated/resources/data/hexcasting/recipes/brainsweep/testing/bad_to_the_bone.json b/Fabric/src/generated/resources/data/hexcasting/recipes/brainsweep/testing/bad_to_the_bone.json new file mode 100644 index 00000000..19eb1018 --- /dev/null +++ b/Fabric/src/generated/resources/data/hexcasting/recipes/brainsweep/testing/bad_to_the_bone.json @@ -0,0 +1,18 @@ +{ + "type": "hexcasting:brainsweep", + "blockIn": { + "type": "block", + "block": "minecraft:scaffolding" + }, + "cost": 50000, + "entityIn": { + "type": "entity_tag", + "tag": "minecraft:skeletons" + }, + "result": { + "name": "minecraft:bone_block", + "properties": { + "axis": "y" + } + } +} \ No newline at end of file diff --git a/Fabric/src/generated/resources/data/hexcasting/recipes/brainsweep/testing/flowey_the_flower.json b/Fabric/src/generated/resources/data/hexcasting/recipes/brainsweep/testing/flowey_the_flower.json new file mode 100644 index 00000000..23d5177f --- /dev/null +++ b/Fabric/src/generated/resources/data/hexcasting/recipes/brainsweep/testing/flowey_the_flower.json @@ -0,0 +1,19 @@ +{ + "type": "hexcasting:brainsweep", + "blockIn": { + "type": "tag", + "tag": "minecraft:small_flowers" + }, + "cost": 50000, + "entityIn": { + "type": "entity_type", + "entityType": "minecraft:allay" + }, + "result": { + "name": "minecraft:amethyst_cluster", + "properties": { + "facing": "up", + "waterlogged": "false" + } + } +} \ No newline at end of file diff --git a/Fabric/src/generated/resources/data/hexcasting/recipes/dynamic/seal_focus.json b/Fabric/src/generated/resources/data/hexcasting/recipes/dynamicseal_focus.json similarity index 100% rename from Fabric/src/generated/resources/data/hexcasting/recipes/dynamic/seal_focus.json rename to Fabric/src/generated/resources/data/hexcasting/recipes/dynamicseal_focus.json diff --git a/Fabric/src/generated/resources/data/hexcasting/recipes/dynamic/seal_spellbook.json b/Fabric/src/generated/resources/data/hexcasting/recipes/dynamicseal_spellbook.json similarity index 100% rename from Fabric/src/generated/resources/data/hexcasting/recipes/dynamic/seal_spellbook.json rename to Fabric/src/generated/resources/data/hexcasting/recipes/dynamicseal_spellbook.json diff --git a/Fabric/src/main/java/at/petrak/hexcasting/fabric/interop/emi/BrainsweepeeEmiStack.java b/Fabric/src/main/java/at/petrak/hexcasting/fabric/interop/emi/BrainsweepeeEmiStack.java index 1580204a..bd72ece1 100644 --- a/Fabric/src/main/java/at/petrak/hexcasting/fabric/interop/emi/BrainsweepeeEmiStack.java +++ b/Fabric/src/main/java/at/petrak/hexcasting/fabric/interop/emi/BrainsweepeeEmiStack.java @@ -2,103 +2,45 @@ package at.petrak.hexcasting.fabric.interop.emi; import at.petrak.hexcasting.client.ClientTickCounter; import at.petrak.hexcasting.client.RenderLib; -import at.petrak.hexcasting.client.shader.FakeBufferSource; -import at.petrak.hexcasting.client.shader.HexRenderTypes; import at.petrak.hexcasting.common.recipe.ingredient.brainsweep.BrainsweepeeIngredient; import com.mojang.blaze3d.systems.RenderSystem; import com.mojang.blaze3d.vertex.PoseStack; -import dev.emi.emi.api.render.EmiRender; -import dev.emi.emi.api.render.EmiTooltipComponents; -import dev.emi.emi.api.stack.EmiIngredient; import dev.emi.emi.api.stack.EmiStack; -import net.minecraft.ChatFormatting; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.screens.inventory.tooltip.ClientTooltipComponent; import net.minecraft.client.multiplayer.ClientLevel; -import net.minecraft.core.Registry; import net.minecraft.nbt.CompoundTag; import net.minecraft.network.chat.Component; import net.minecraft.resources.ResourceLocation; -import net.minecraft.world.entity.EntityType; import net.minecraft.world.entity.npc.Villager; -import net.minecraft.world.entity.npc.VillagerProfession; -import net.minecraft.world.level.block.state.BlockState; -import java.util.ArrayList; import java.util.List; -import java.util.Objects; -import java.util.Set; import java.util.stream.Collectors; import static at.petrak.hexcasting.api.HexAPI.modLoc; import static at.petrak.hexcasting.client.RenderLib.renderEntity; public class BrainsweepeeEmiStack extends EmiStack { - private final VillagerEntry entry; public final BrainsweepeeIngredient ingredient; - public final boolean mindless; - private final ResourceLocation id; + private final BrainsweepeeEntry entry; - public BrainsweepeeEmiStack(BrainsweepeeIngredient villager) { - this(villager, false); - } + public BrainsweepeeEmiStack(BrainsweepeeIngredient ingr) { + this.ingredient = ingr; - public BrainsweepeeEmiStack(BrainsweepeeIngredient villager, boolean mindless) { - this(villager, mindless, 1); - } - - public BrainsweepeeEmiStack(BrainsweepeeIngredient villager, boolean mindless, long amount) { - entry = new VillagerEntry(new VillagerVariant(villager, mindless)); - this.ingredient = villager; - this.mindless = mindless; - this.amount = amount; - // This is so scuffed - this.id = modLoc((Objects.toString(villager.profession()) + villager.minLevel() + mindless) - .replace(':', '-')); - } - - public static Set matchingStatesForProfession(VillagerProfession profession) { - return Registry.POINT_OF_INTEREST_TYPE.holders() - .filter(profession.heldJobSite()) - .flatMap(it -> it.value().matchingStates().stream()) - .collect(Collectors.toSet()); - } - - public static EmiIngredient atLevelOrHigher(BrainsweepeeIngredient ingredient, boolean remainder) { - if (ingredient.profession() == null) { - return EmiIngredient.of(Registry.VILLAGER_PROFESSION.stream() - .filter(it -> matchingStatesForProfession(it).isEmpty()) - .map(it -> atLevelOrHigher(new BrainsweepeeIngredient(Registry.VILLAGER_PROFESSION.getKey(it), - ingredient.biome(), ingredient.minLevel()), true)) - .toList()); - } - - BrainsweepeeEmiStack stack = new BrainsweepeeEmiStack(ingredient).orHigher(true); - if (remainder) { - stack.setRemainder(new BrainsweepeeEmiStack(ingredient, true)); - } - return stack; - } - - private boolean orHigher = false; - - public BrainsweepeeEmiStack orHigher(boolean orHigher) { - this.orHigher = orHigher; - return this; + var bareId = this.ingredient.getSomeKindOfReasonableIDForEmi(); + this.id = modLoc(bareId); + this.entry = new BrainsweepeeEntry(this.ingredient); } @Override public EmiStack copy() { - BrainsweepeeEmiStack e = new BrainsweepeeEmiStack(ingredient, mindless, amount); - e.orHigher(orHigher).setRemainder(getRemainder().copy()); - e.comparison = comparison; - return e; + return new BrainsweepeeEmiStack(this.ingredient); } @Override public boolean isEmpty() { - return amount == 0; + return false; } @Override @@ -126,42 +68,20 @@ public class BrainsweepeeEmiStack extends EmiStack { Minecraft mc = Minecraft.getInstance(); boolean advanced = mc.options.advancedItemTooltips; - if (mindless) { - List tooltip = new ArrayList<>(); - tooltip.add(Component.translatable("hexcasting.tooltip.brainsweep.product")); - - if (advanced) { - if (ingredient.biome() != null) { - tooltip.add(Component.literal(ingredient.biome().toString()).withStyle(ChatFormatting.DARK_GRAY)); - } - - ResourceLocation displayId = Objects.requireNonNullElseGet(ingredient.profession(), - () -> Registry.ENTITY_TYPE.getKey(EntityType.VILLAGER)); - tooltip.add(Component.literal(displayId.toString()).withStyle(ChatFormatting.DARK_GRAY)); - } - - tooltip.add(ingredient.getModNameComponent()); - return tooltip; - } - - return ingredient.getTooltip(advanced, orHigher); + return ingredient.getTooltip(advanced); } @Override public List getTooltip() { - List list = getTooltipText().stream() + return getTooltipText().stream() .map(Component::getVisualOrderText) .map(ClientTooltipComponent::create) .collect(Collectors.toList()); - if (!getRemainder().isEmpty()) { - list.add(EmiTooltipComponents.getRemainderTooltipComponent(this)); - } - return list; } @Override public Component getName() { - return ingredient.name(); + return ingredient.getName(); } @Override @@ -174,51 +94,29 @@ public class BrainsweepeeEmiStack extends EmiStack { RenderSystem.enableBlend(); RenderSystem.setShaderColor(1.0F, 1.0F, 1.0F, 1.0F); - renderEntity(poseStack, villager, level, x + 8, y + 16, ClientTickCounter.getTotal(), 8, 0, - mindless ? (it) -> new FakeBufferSource(it, HexRenderTypes::getGrayscaleLayer) : it -> it); + renderEntity(poseStack, villager, level, x + 8, y + 16, ClientTickCounter.getTotal(), 8, 0, it -> it); } } - - if ((flags & RENDER_REMAINDER) != 0) { - EmiRender.renderRemainderIcon(this, poseStack, x, y); - } +// if ((flags & RENDER_REMAINDER) != 0) { +// EmiRender.renderRemainderIcon(this, poseStack, x, y); +// } } - public static class VillagerEntry extends EmiStack.Entry { + public static class BrainsweepeeEntry extends EmiStack.Entry { - public VillagerEntry(VillagerVariant variant) { + public BrainsweepeeEntry(BrainsweepeeIngredient variant) { super(variant); } @Override - public Class getType() { - return VillagerVariant.class; + public Class getType() { + return BrainsweepeeIngredient.class; } @Override public boolean equals(Object obj) { - if (!(obj instanceof VillagerEntry e)) { - return false; - } - - VillagerVariant self = getValue(); - VillagerVariant other = e.getValue(); - - ResourceLocation selfBiome = self.ingredient().biome(); - ResourceLocation otherBiome = other.ingredient().biome(); - if (selfBiome != null && otherBiome != null && !selfBiome.equals(otherBiome)) { - return false; - } - - ResourceLocation selfProfession = self.ingredient().profession(); - ResourceLocation otherProfession = other.ingredient().profession(); - if (selfProfession != null && otherProfession != null && !selfProfession.equals(otherProfession)) { - return false; - } - - return self.ingredient().minLevel() == other.ingredient().minLevel() && self.mindless() == other.mindless(); + return obj instanceof BrainsweepeeIngredient bi && bi.equals(this.getValue()); } } - } diff --git a/Fabric/src/main/java/at/petrak/hexcasting/fabric/interop/emi/EmiLevelupRecipe.java b/Fabric/src/main/java/at/petrak/hexcasting/fabric/interop/emi/EmiLevelupRecipe.java deleted file mode 100644 index 0f9a6ba3..00000000 --- a/Fabric/src/main/java/at/petrak/hexcasting/fabric/interop/emi/EmiLevelupRecipe.java +++ /dev/null @@ -1,25 +0,0 @@ -package at.petrak.hexcasting.fabric.interop.emi; - -import dev.emi.emi.api.recipe.EmiRecipeCategory; -import dev.emi.emi.api.stack.EmiIngredient; -import dev.emi.emi.api.stack.EmiStack; -import net.minecraft.resources.ResourceLocation; -import net.minecraft.world.item.Items; - -import java.util.List; - -public class EmiLevelupRecipe extends EmiVillagerRecipe { - public EmiLevelupRecipe(EmiIngredient input, BrainsweepeeEmiStack result, ResourceLocation id) { - super(input, EmiStack.of(Items.EMERALD), result, id, false); - } - - @Override - public List getInputs() { - return List.of(input); - } - - @Override - public EmiRecipeCategory getCategory() { - return HexEMIPlugin.VILLAGER_LEVELING; - } -} diff --git a/Fabric/src/main/java/at/petrak/hexcasting/fabric/interop/emi/EmiProfessionRecipe.java b/Fabric/src/main/java/at/petrak/hexcasting/fabric/interop/emi/EmiProfessionRecipe.java deleted file mode 100644 index eefd23fc..00000000 --- a/Fabric/src/main/java/at/petrak/hexcasting/fabric/interop/emi/EmiProfessionRecipe.java +++ /dev/null @@ -1,17 +0,0 @@ -package at.petrak.hexcasting.fabric.interop.emi; - -import dev.emi.emi.api.recipe.EmiRecipeCategory; -import dev.emi.emi.api.stack.EmiIngredient; -import net.minecraft.resources.ResourceLocation; - -public class EmiProfessionRecipe extends EmiVillagerRecipe { - public EmiProfessionRecipe(EmiIngredient input, EmiIngredient catalyst, BrainsweepeeEmiStack result, - ResourceLocation id) { - super(input, catalyst, result, id); - } - - @Override - public EmiRecipeCategory getCategory() { - return HexEMIPlugin.VILLAGER_PROFESSION; - } -} diff --git a/Fabric/src/main/java/at/petrak/hexcasting/fabric/interop/emi/EmiVillagerRecipe.java b/Fabric/src/main/java/at/petrak/hexcasting/fabric/interop/emi/EmiVillagerRecipe.java deleted file mode 100644 index 1b25673c..00000000 --- a/Fabric/src/main/java/at/petrak/hexcasting/fabric/interop/emi/EmiVillagerRecipe.java +++ /dev/null @@ -1,73 +0,0 @@ -package at.petrak.hexcasting.fabric.interop.emi; - -import dev.emi.emi.api.recipe.EmiRecipe; -import dev.emi.emi.api.render.EmiTexture; -import dev.emi.emi.api.stack.EmiIngredient; -import dev.emi.emi.api.stack.EmiStack; -import dev.emi.emi.api.widget.WidgetHolder; -import net.minecraft.resources.ResourceLocation; -import org.jetbrains.annotations.Nullable; - -import java.util.List; - -// Mostly copypasta from EmiWorldRecipe, to avoid depending on impl -public abstract class EmiVillagerRecipe implements EmiRecipe { - protected final boolean isCatalyst; - protected final ResourceLocation id; - protected final EmiIngredient input; - protected final EmiIngredient catalyst; - protected final EmiStack result; - - public EmiVillagerRecipe(EmiIngredient input, EmiIngredient catalyst, BrainsweepeeEmiStack result, - ResourceLocation id) { - this(input, catalyst, result, id, true); - } - - public EmiVillagerRecipe(EmiIngredient input, EmiIngredient catalyst, BrainsweepeeEmiStack result, - ResourceLocation id, boolean isCatalyst) { - this.isCatalyst = isCatalyst; - this.input = input; - this.catalyst = catalyst; - this.result = result; - this.id = id; - if (isCatalyst) { - for (EmiStack stack : catalyst.getEmiStacks()) { - stack.setRemainder(stack); - } - } - - } - - @Nullable - public ResourceLocation getId() { - return this.id; - } - - public List getInputs() { - return this.isCatalyst ? List.of(this.input) : List.of(this.input, this.catalyst); - } - - public List getCatalysts() { - return this.isCatalyst ? List.of(this.catalyst) : List.of(); - } - - public List getOutputs() { - return List.of(this.result); - } - - public int getDisplayWidth() { - return 125; - } - - public int getDisplayHeight() { - return 18; - } - - public void addWidgets(WidgetHolder widgets) { - widgets.addTexture(EmiTexture.PLUS, 27, 3); - widgets.addTexture(EmiTexture.EMPTY_ARROW, 75, 1); - widgets.addSlot(this.input, 0, 0); - widgets.addSlot(this.catalyst, 49, 0).catalyst(this.isCatalyst); - widgets.addSlot(this.result, 107, 0).recipeContext(this); - } -} diff --git a/Fabric/src/main/java/at/petrak/hexcasting/fabric/interop/emi/HexEMIPlugin.java b/Fabric/src/main/java/at/petrak/hexcasting/fabric/interop/emi/HexEMIPlugin.java index 8942c247..3c10fb9d 100644 --- a/Fabric/src/main/java/at/petrak/hexcasting/fabric/interop/emi/HexEMIPlugin.java +++ b/Fabric/src/main/java/at/petrak/hexcasting/fabric/interop/emi/HexEMIPlugin.java @@ -15,97 +15,48 @@ import net.minecraft.resources.ResourceLocation; import static at.petrak.hexcasting.api.HexAPI.modLoc; public class HexEMIPlugin implements EmiPlugin { - private static final ResourceLocation BRAINSWEEP_ID = modLoc("brainsweep"); - public static final ResourceLocation PHIAL_ID = modLoc("craft/battery"); - public static final ResourceLocation EDIFY_ID = modLoc("edify"); - private static final ResourceLocation VILLAGER_LEVELING_ID = modLoc("villager_leveling"); - private static final ResourceLocation VILLAGER_PROFESSION_ID = modLoc("villager_profession"); + private static final ResourceLocation BRAINSWEEP_ID = modLoc("brainsweep"); + public static final ResourceLocation PHIAL_ID = modLoc("craft/battery"); + public static final ResourceLocation EDIFY_ID = modLoc("edify"); - private static final ResourceLocation SIMPLIFIED_ICON_BRAINSWEEP = modLoc("textures/gui/brainsweep_emi.png"); - private static final ResourceLocation SIMPLIFIED_ICON_PHIAL = modLoc("textures/gui/phial_emi.png"); - private static final ResourceLocation SIMPLIFIED_ICON_EDIFY = modLoc("textures/gui/edify_emi.png"); - private static final ResourceLocation SIMPLIFIED_ICON_LEVELING = modLoc("textures/gui/villager_leveling.png"); - private static final ResourceLocation SIMPLIFIED_ICON_PROFESSION = modLoc("textures/gui/villager_profession.png"); + private static final ResourceLocation SIMPLIFIED_ICON_BRAINSWEEP = modLoc("textures/gui/brainsweep_emi.png"); + private static final ResourceLocation SIMPLIFIED_ICON_PHIAL = modLoc("textures/gui/phial_emi.png"); + private static final ResourceLocation SIMPLIFIED_ICON_EDIFY = modLoc("textures/gui/edify_emi.png"); - public static final EmiRecipeCategory BRAINSWEEP = new EmiRecipeCategory(BRAINSWEEP_ID, - new PatternRendererEMI(BRAINSWEEP_ID, 16, 16), - new EmiTexture(SIMPLIFIED_ICON_BRAINSWEEP, 0, 0, 16, 16, 16, 16, 16, 16)); + public static final EmiRecipeCategory BRAINSWEEP = new EmiRecipeCategory(BRAINSWEEP_ID, + new PatternRendererEMI(BRAINSWEEP_ID, 16, 16), + new EmiTexture(SIMPLIFIED_ICON_BRAINSWEEP, 0, 0, 16, 16, 16, 16, 16, 16)); - public static final EmiRecipeCategory PHIAL = new EmiRecipeCategory(PHIAL_ID, - new PatternRendererEMI(PHIAL_ID, 12, 12).shift(2, 2), - new EmiTexture(SIMPLIFIED_ICON_PHIAL, 0, 0, 16, 16, 16, 16, 16, 16)); + public static final EmiRecipeCategory PHIAL = new EmiRecipeCategory(PHIAL_ID, + new PatternRendererEMI(PHIAL_ID, 12, 12).shift(2, 2), + new EmiTexture(SIMPLIFIED_ICON_PHIAL, 0, 0, 16, 16, 16, 16, 16, 16)); - public static final EmiRecipeCategory EDIFY = new EmiRecipeCategory(EDIFY_ID, - new PatternRendererEMI(EDIFY_ID, 16, 16).strokeOrder(false), - new EmiTexture(SIMPLIFIED_ICON_EDIFY, 0, 0, 16, 16, 16, 16, 16, 16)); + public static final EmiRecipeCategory EDIFY = new EmiRecipeCategory(EDIFY_ID, + new PatternRendererEMI(EDIFY_ID, 16, 16).strokeOrder(false), + new EmiTexture(SIMPLIFIED_ICON_EDIFY, 0, 0, 16, 16, 16, 16, 16, 16)); -// public static final EmiRecipeCategory VILLAGER_LEVELING = new EmiRecipeCategory(VILLAGER_LEVELING_ID, -// EmiStack.of(Items.EMERALD), -// new EmiTexture(SIMPLIFIED_ICON_LEVELING, 0, 0, 16, 16, 16, 16, 16, 16)); -// -// public static final EmiRecipeCategory VILLAGER_PROFESSION = new EmiRecipeCategory(VILLAGER_PROFESSION_ID, -// EmiStack.of(Blocks.LECTERN), -// new EmiTexture(SIMPLIFIED_ICON_PROFESSION, 0, 0, 16, 16, 16, 16, 16, 16)); + @Override + public void register(EmiRegistry registry) { + registry.addCategory(BRAINSWEEP); + registry.addCategory(PHIAL); + registry.addCategory(EDIFY); + registry.addWorkstation(BRAINSWEEP, EmiIngredient.of(HexTags.Items.STAVES)); + registry.addWorkstation(PHIAL, EmiIngredient.of(HexTags.Items.STAVES)); + registry.addWorkstation(EDIFY, EmiIngredient.of(HexTags.Items.STAVES)); - @Override - public void register(EmiRegistry registry) { - registry.addCategory(BRAINSWEEP); - registry.addCategory(PHIAL); - registry.addCategory(EDIFY); -// registry.addCategory(VILLAGER_LEVELING); -// registry.addCategory(VILLAGER_PROFESSION); - registry.addWorkstation(BRAINSWEEP, EmiIngredient.of(HexItemTags.STAVES)); - registry.addWorkstation(PHIAL, EmiIngredient.of(HexItemTags.STAVES)); - registry.addWorkstation(EDIFY, EmiIngredient.of(HexItemTags.STAVES)); + for (BrainsweepRecipe recipe : registry.getRecipeManager() + .getAllRecipesFor(HexRecipeStuffRegistry.BRAINSWEEP_TYPE)) { + var inputBlocks = EmiIngredient.of(recipe.blockIn().getDisplayedStacks().stream() + .map(EmiStack::of).toList()); + var inputEntity = new BrainsweepeeEmiStack(recipe.entityIn()); + var output = EmiStack.of(recipe.result().getBlock()); + registry.addRecipe(new EmiBrainsweepRecipe(inputBlocks, inputEntity, output, recipe.getId())); + } - for (BrainsweepRecipe recipe : registry.getRecipeManager() - .getAllRecipesFor(HexRecipeStuffRegistry.BRAINSWEEP_TYPE)) { - var inputs = EmiIngredient.of(recipe.blockIn().getDisplayedStacks().stream() - .map(EmiStack::of).toList()); - var output = EmiStack.of(recipe.result().getBlock()); - registry.addRecipe(new EmiBrainsweepRecipe(inputs, villagerInput, output, recipe.getId())); - } + if (PhialRecipeStackBuilder.shouldAddRecipe()) { + registry.addRecipe(new EmiPhialRecipe()); + } - if (PhialRecipeStackBuilder.shouldAddRecipe()) { - registry.addRecipe(new EmiPhialRecipe()); - } - - registry.addRecipe(new EmiEdifyRecipe()); - -// var basicVillager = new BrainsweepIngredient(null, null, 1); -// for (VillagerProfession profession : Registry.VILLAGER_PROFESSION) { -// ResourceLocation id = Registry.VILLAGER_PROFESSION.getKey(profession); -// ResourceLocation poiRecipeId = modLoc("villager/poi/" + id.getNamespace() + "/" + id.getPath()); -// var manWithJob = new BrainsweepIngredient(id, null, 1); -// -// Set states = BrainsweepeeEmiStack.matchingStatesForProfession(profession); -// if (!states.isEmpty()) { -// List workstations = states.stream() -// .map(BlockState::getBlock) -// .map(Block::asItem) -// .distinct() -// .filter((it) -> it != Items.AIR) -// .toList(); -// -// if (!workstations.isEmpty()) { -// registry.addWorkstation(VILLAGER_LEVELING, -// EmiIngredient.of(workstations.stream().map(EmiStack::of).toList())); -// registry.addWorkstation(VILLAGER_PROFESSION, -// EmiIngredient.of(workstations.stream().map(EmiStack::of).toList())); -// registry.addRecipe(new EmiProfessionRecipe(new BrainsweepeeEmiStack(basicVillager), -// EmiIngredient.of(workstations.stream().map(EmiStack::of).toList()), -// new BrainsweepeeEmiStack(manWithJob), poiRecipeId)); -// -// for (int lvl = 1; lvl < 5; lvl++) { -// ResourceLocation levelRecipeId = modLoc( -// "villager/levelup/" + lvl + "/" + id.getNamespace() + "/" + id.getPath()); -// var manWithBadJob = new BrainsweepIngredient(id, null, lvl); -// var manWithBetterJob = new BrainsweepIngredient(id, null, lvl + 1); -// registry.addRecipe(new EmiLevelupRecipe(new BrainsweepeeEmiStack(manWithBadJob), -// new BrainsweepeeEmiStack(manWithBetterJob), levelRecipeId)); -// } -// } -// } -// } - } + registry.addRecipe(new EmiEdifyRecipe()); + } } diff --git a/Fabric/src/main/java/at/petrak/hexcasting/fabric/interop/emi/VillagerVariant.java b/Fabric/src/main/java/at/petrak/hexcasting/fabric/interop/emi/VillagerVariant.java deleted file mode 100644 index 5b06a5cd..00000000 --- a/Fabric/src/main/java/at/petrak/hexcasting/fabric/interop/emi/VillagerVariant.java +++ /dev/null @@ -1,7 +0,0 @@ -package at.petrak.hexcasting.fabric.interop.emi; - -import at.petrak.hexcasting.common.recipe.ingredient.brainsweep.BrainsweepeeIngredient; - -public record VillagerVariant(BrainsweepeeIngredient ingredient, boolean mindless) { - // NO-OP -} diff --git a/Forge/src/generated/resources/.cache/9fb1092f32d4fcbf9e061ffd718d4ec689c6c95e b/Forge/src/generated/resources/.cache/9fb1092f32d4fcbf9e061ffd718d4ec689c6c95e index 5da627b8..8ce849b4 100644 --- a/Forge/src/generated/resources/.cache/9fb1092f32d4fcbf9e061ffd718d4ec689c6c95e +++ b/Forge/src/generated/resources/.cache/9fb1092f32d4fcbf9e061ffd718d4ec689c6c95e @@ -1,4 +1,4 @@ -// 1.19.2 2022-11-23T20:06:32.313241156 Recipes +// 1.19.2 2022-12-29T13:32:49.589849082 Recipes 29056d8bbc023668564ee81f4eb8b2a11411cf4a data/create/recipes/crushing/amethyst_block.json 5bb0b70967a422bfd88c01fa1af64e9b98781fd1 data/create/recipes/crushing/amethyst_cluster.json 8d6f58c45be52e22559fdbc2806ee48ab40d133c data/hexcasting/advancements/recipes/brainsweep/brainsweep/akashic_record.json @@ -7,6 +7,8 @@ f58700261f72cf87acacf1df0f163890c8b7ae00 data/hexcasting/advancements/recipes/br da3c95902e93fe82e489ceccc84a56159329e091 data/hexcasting/advancements/recipes/brainsweep/brainsweep/impetus_look.json 2a1021614882392be78d22cb557e43cbbd9092ca data/hexcasting/advancements/recipes/brainsweep/brainsweep/impetus_rightclick.json a22233090497e1c44082b6eb16ad079d9acc8f7c data/hexcasting/advancements/recipes/brainsweep/brainsweep/impetus_storedplayer.json +0de6f2437a3c33a92de2f3e6b7ac6102996c8779 data/hexcasting/advancements/recipes/brainsweep/brainsweep/testing/bad_to_the_bone.json +eaba34eebb8cb0d8d752ab1d574752e651626c24 data/hexcasting/advancements/recipes/brainsweep/brainsweep/testing/flowey_the_flower.json ae2c6392cc0ec104c4e3019e1824a1e7f811f1de data/hexcasting/advancements/recipes/hexcasting/abacus.json 0cb3e2e6e0be9f53811f24ad43bf711d07560210 data/hexcasting/advancements/recipes/hexcasting/acacia_staff.json d73e5d8fec4d3f7d15888bd292f4ad9c1b37cac5 data/hexcasting/advancements/recipes/hexcasting/ageing_scroll_paper_lantern.json @@ -102,12 +104,14 @@ f0849d723141b9f02798d474da6594f78755dd51 data/hexcasting/recipes/amethyst_tiles. 260f89eb21b360ea8b7fdbd23f9977d03ab57149 data/hexcasting/recipes/ancient_scroll_paper_lantern.json 1880b1519b100f2185ed27a9bfd8f98e83fa728f data/hexcasting/recipes/artifact.json 6f5ee50706640e9be82810e22388fc7b2bce13b1 data/hexcasting/recipes/birch_staff.json -9d4405e831b27dfa6dad7f42f7c2a298de6049a7 data/hexcasting/recipes/brainsweep/akashic_record.json -12b4e03df1c9115dd94790ff27b818c2b7c335d3 data/hexcasting/recipes/brainsweep/budding_amethyst.json -adc3ad0e6cbf522ebe73cc1301089b6b9a4873c0 data/hexcasting/recipes/brainsweep/directrix_redstone.json -67ceb2990df8405119a6ef76af1bb3f9aab5dace data/hexcasting/recipes/brainsweep/impetus_look.json -b864b6c88f1026a371fd72cd7f43bd3b57376c00 data/hexcasting/recipes/brainsweep/impetus_rightclick.json -8f6956c2d1293948d2f1e2ae9eefe890c9168900 data/hexcasting/recipes/brainsweep/impetus_storedplayer.json +e0609202271e402d8ae58e4f8eaf11dcdda10a9e data/hexcasting/recipes/brainsweep/akashic_record.json +5a90084c03d6e8424872870c8b65f4771b447f03 data/hexcasting/recipes/brainsweep/budding_amethyst.json +3127e275f4dc31d80a21f9119fcebc527e821caa data/hexcasting/recipes/brainsweep/directrix_redstone.json +7a51e934846a0d7fe00a808cfa22fd85da67fe9d data/hexcasting/recipes/brainsweep/impetus_look.json +1086a6e3f284fc3b575ee3a21d2b13d0bc62d2bb data/hexcasting/recipes/brainsweep/impetus_rightclick.json +24984d728a5c05967c58be9c0dc1c59e986602e6 data/hexcasting/recipes/brainsweep/impetus_storedplayer.json +16c91a664dbe7914a7db566f45158c8191e52afb data/hexcasting/recipes/brainsweep/testing/bad_to_the_bone.json +ba08fd11d19f54c504ceed6f162a5d814e03d1e8 data/hexcasting/recipes/brainsweep/testing/flowey_the_flower.json c4e770cfd4d855d5b4fdc66e424d58621302f51a data/hexcasting/recipes/compat/create/crushing/amethyst_shard.json 64ee84a9bce988bacde0911d05d0f3834e0b1ae7 data/hexcasting/recipes/compat/farmersdelight/cutting/akashic_door.json f398f4a10736f967482dd1d254d37c7ba9e67bb0 data/hexcasting/recipes/compat/farmersdelight/cutting/akashic_log.json @@ -132,8 +136,8 @@ bc100b94798f0b456877b42a5fc9aee7c4f25218 data/hexcasting/recipes/dye_colorizer_m bc91b7e096d8a0033916101f21fa43c06b343e86 data/hexcasting/recipes/dye_colorizer_red.json ef5a19ab2710fd0ce836d767588fe6a54a528a48 data/hexcasting/recipes/dye_colorizer_white.json 326925a948aeb17aabafbc25ed2562a257796d29 data/hexcasting/recipes/dye_colorizer_yellow.json -0ee8d29cb06065a55017a8fc50576193107f958d data/hexcasting/recipes/dynamic/seal_focus.json -d323e21de69d0606d1fac03fa8820e5857e4e1f1 data/hexcasting/recipes/dynamic/seal_spellbook.json +0ee8d29cb06065a55017a8fc50576193107f958d data/hexcasting/recipes/dynamicseal_focus.json +d323e21de69d0606d1fac03fa8820e5857e4e1f1 data/hexcasting/recipes/dynamicseal_spellbook.json fc0476880c79cf4458dd5b24f77fc980b02534d2 data/hexcasting/recipes/edified_button.json 8a9e7aa8d07556649768729348dff5305b84e1b9 data/hexcasting/recipes/edified_door.json 0efcdb6cd338f382c823e8599e298322a0080dae data/hexcasting/recipes/edified_panel.json diff --git a/Forge/src/generated/resources/data/hexcasting/advancements/recipes/brainsweep/brainsweep/testing/bad_to_the_bone.json b/Forge/src/generated/resources/data/hexcasting/advancements/recipes/brainsweep/brainsweep/testing/bad_to_the_bone.json new file mode 100644 index 00000000..edd1db8e --- /dev/null +++ b/Forge/src/generated/resources/data/hexcasting/advancements/recipes/brainsweep/brainsweep/testing/bad_to_the_bone.json @@ -0,0 +1,34 @@ +{ + "parent": "minecraft:recipes/root", + "criteria": { + "enlightenment": { + "conditions": { + "health_used": { + "min": 0.8 + }, + "mojang_i_am_begging_and_crying_please_add_an_entity_health_criterion": { + "max": 2.05, + "min": 0.1 + } + }, + "trigger": "hexcasting:overcast" + }, + "has_the_recipe": { + "conditions": { + "recipe": "hexcasting:brainsweep/testing/bad_to_the_bone" + }, + "trigger": "minecraft:recipe_unlocked" + } + }, + "requirements": [ + [ + "enlightenment", + "has_the_recipe" + ] + ], + "rewards": { + "recipes": [ + "hexcasting:brainsweep/testing/bad_to_the_bone" + ] + } +} \ No newline at end of file diff --git a/Forge/src/generated/resources/data/hexcasting/advancements/recipes/brainsweep/brainsweep/testing/flowey_the_flower.json b/Forge/src/generated/resources/data/hexcasting/advancements/recipes/brainsweep/brainsweep/testing/flowey_the_flower.json new file mode 100644 index 00000000..7b01dd50 --- /dev/null +++ b/Forge/src/generated/resources/data/hexcasting/advancements/recipes/brainsweep/brainsweep/testing/flowey_the_flower.json @@ -0,0 +1,34 @@ +{ + "parent": "minecraft:recipes/root", + "criteria": { + "enlightenment": { + "conditions": { + "health_used": { + "min": 0.8 + }, + "mojang_i_am_begging_and_crying_please_add_an_entity_health_criterion": { + "max": 2.05, + "min": 0.1 + } + }, + "trigger": "hexcasting:overcast" + }, + "has_the_recipe": { + "conditions": { + "recipe": "hexcasting:brainsweep/testing/flowey_the_flower" + }, + "trigger": "minecraft:recipe_unlocked" + } + }, + "requirements": [ + [ + "enlightenment", + "has_the_recipe" + ] + ], + "rewards": { + "recipes": [ + "hexcasting:brainsweep/testing/flowey_the_flower" + ] + } +} \ No newline at end of file diff --git a/Forge/src/generated/resources/data/hexcasting/recipes/brainsweep/akashic_record.json b/Forge/src/generated/resources/data/hexcasting/recipes/brainsweep/akashic_record.json index 9f087e42..6ff75581 100644 --- a/Forge/src/generated/resources/data/hexcasting/recipes/brainsweep/akashic_record.json +++ b/Forge/src/generated/resources/data/hexcasting/recipes/brainsweep/akashic_record.json @@ -6,8 +6,9 @@ }, "cost": 1000000, "entityIn": { + "type": "villager", "minLevel": 5, - "profession": "minecraft:librarian" + "profession": "librarian" }, "result": { "name": "hexcasting:akashic_record" diff --git a/Forge/src/generated/resources/data/hexcasting/recipes/brainsweep/budding_amethyst.json b/Forge/src/generated/resources/data/hexcasting/recipes/brainsweep/budding_amethyst.json index 821ada6e..b58a6ec9 100644 --- a/Forge/src/generated/resources/data/hexcasting/recipes/brainsweep/budding_amethyst.json +++ b/Forge/src/generated/resources/data/hexcasting/recipes/brainsweep/budding_amethyst.json @@ -6,6 +6,7 @@ }, "cost": 1000000, "entityIn": { + "type": "villager", "minLevel": 3 }, "result": { diff --git a/Forge/src/generated/resources/data/hexcasting/recipes/brainsweep/directrix_redstone.json b/Forge/src/generated/resources/data/hexcasting/recipes/brainsweep/directrix_redstone.json index a20511db..614ea5a6 100644 --- a/Forge/src/generated/resources/data/hexcasting/recipes/brainsweep/directrix_redstone.json +++ b/Forge/src/generated/resources/data/hexcasting/recipes/brainsweep/directrix_redstone.json @@ -6,8 +6,9 @@ }, "cost": 1000000, "entityIn": { + "type": "villager", "minLevel": 1, - "profession": "minecraft:mason" + "profession": "mason" }, "result": { "name": "hexcasting:directrix_redstone", diff --git a/Forge/src/generated/resources/data/hexcasting/recipes/brainsweep/impetus_look.json b/Forge/src/generated/resources/data/hexcasting/recipes/brainsweep/impetus_look.json index 0a45783f..882d44e4 100644 --- a/Forge/src/generated/resources/data/hexcasting/recipes/brainsweep/impetus_look.json +++ b/Forge/src/generated/resources/data/hexcasting/recipes/brainsweep/impetus_look.json @@ -6,8 +6,9 @@ }, "cost": 1000000, "entityIn": { + "type": "villager", "minLevel": 2, - "profession": "minecraft:fletcher" + "profession": "toolsmith" }, "result": { "name": "hexcasting:impetus_look", diff --git a/Forge/src/generated/resources/data/hexcasting/recipes/brainsweep/impetus_rightclick.json b/Forge/src/generated/resources/data/hexcasting/recipes/brainsweep/impetus_rightclick.json index de05a0c4..36366977 100644 --- a/Forge/src/generated/resources/data/hexcasting/recipes/brainsweep/impetus_rightclick.json +++ b/Forge/src/generated/resources/data/hexcasting/recipes/brainsweep/impetus_rightclick.json @@ -6,8 +6,9 @@ }, "cost": 1000000, "entityIn": { + "type": "villager", "minLevel": 2, - "profession": "minecraft:toolsmith" + "profession": "toolsmith" }, "result": { "name": "hexcasting:impetus_rightclick", diff --git a/Forge/src/generated/resources/data/hexcasting/recipes/brainsweep/impetus_storedplayer.json b/Forge/src/generated/resources/data/hexcasting/recipes/brainsweep/impetus_storedplayer.json index f662bbba..8529689e 100644 --- a/Forge/src/generated/resources/data/hexcasting/recipes/brainsweep/impetus_storedplayer.json +++ b/Forge/src/generated/resources/data/hexcasting/recipes/brainsweep/impetus_storedplayer.json @@ -6,8 +6,9 @@ }, "cost": 1000000, "entityIn": { + "type": "villager", "minLevel": 2, - "profession": "minecraft:cleric" + "profession": "cleric" }, "result": { "name": "hexcasting:impetus_storedplayer", diff --git a/Forge/src/generated/resources/data/hexcasting/recipes/brainsweep/testing/bad_to_the_bone.json b/Forge/src/generated/resources/data/hexcasting/recipes/brainsweep/testing/bad_to_the_bone.json new file mode 100644 index 00000000..19eb1018 --- /dev/null +++ b/Forge/src/generated/resources/data/hexcasting/recipes/brainsweep/testing/bad_to_the_bone.json @@ -0,0 +1,18 @@ +{ + "type": "hexcasting:brainsweep", + "blockIn": { + "type": "block", + "block": "minecraft:scaffolding" + }, + "cost": 50000, + "entityIn": { + "type": "entity_tag", + "tag": "minecraft:skeletons" + }, + "result": { + "name": "minecraft:bone_block", + "properties": { + "axis": "y" + } + } +} \ No newline at end of file diff --git a/Forge/src/generated/resources/data/hexcasting/recipes/brainsweep/testing/flowey_the_flower.json b/Forge/src/generated/resources/data/hexcasting/recipes/brainsweep/testing/flowey_the_flower.json new file mode 100644 index 00000000..23d5177f --- /dev/null +++ b/Forge/src/generated/resources/data/hexcasting/recipes/brainsweep/testing/flowey_the_flower.json @@ -0,0 +1,19 @@ +{ + "type": "hexcasting:brainsweep", + "blockIn": { + "type": "tag", + "tag": "minecraft:small_flowers" + }, + "cost": 50000, + "entityIn": { + "type": "entity_type", + "entityType": "minecraft:allay" + }, + "result": { + "name": "minecraft:amethyst_cluster", + "properties": { + "facing": "up", + "waterlogged": "false" + } + } +} \ No newline at end of file diff --git a/Forge/src/generated/resources/data/hexcasting/recipes/dynamic/seal_focus.json b/Forge/src/generated/resources/data/hexcasting/recipes/dynamicseal_focus.json similarity index 100% rename from Forge/src/generated/resources/data/hexcasting/recipes/dynamic/seal_focus.json rename to Forge/src/generated/resources/data/hexcasting/recipes/dynamicseal_focus.json diff --git a/Forge/src/generated/resources/data/hexcasting/recipes/dynamic/seal_spellbook.json b/Forge/src/generated/resources/data/hexcasting/recipes/dynamicseal_spellbook.json similarity index 100% rename from Forge/src/generated/resources/data/hexcasting/recipes/dynamic/seal_spellbook.json rename to Forge/src/generated/resources/data/hexcasting/recipes/dynamicseal_spellbook.json From 5f9ced55fc1ed5f50783606fd475d230a3313c1b Mon Sep 17 00:00:00 2001 From: "petrak@" Date: Fri, 30 Dec 2022 13:07:21 -0500 Subject: [PATCH 31/95] clean up xplat --- .../client/ScryingLensOverlayRegistry.java | 7 +- ...sweeping.java => BrainsweepingEvents.java} | 2 +- .../hexcasting/xplat/IXplatAbstractions.java | 17 +- .../hexcasting/fabric/FabricHexInitializer.kt | 6 +- .../fabric/xplat/FabricXplatImpl.java | 29 +- .../hexcasting/forge/ForgeHexInitializer.java | 289 +++++++++--------- .../forge/xplat/ForgeXplatImpl.java | 29 +- gradle.properties | 2 +- 8 files changed, 173 insertions(+), 208 deletions(-) rename Common/src/main/java/at/petrak/hexcasting/common/misc/{Brainsweeping.java => BrainsweepingEvents.java} (97%) diff --git a/Common/src/main/java/at/petrak/hexcasting/api/client/ScryingLensOverlayRegistry.java b/Common/src/main/java/at/petrak/hexcasting/api/client/ScryingLensOverlayRegistry.java index 88cc62df..127c4a8b 100644 --- a/Common/src/main/java/at/petrak/hexcasting/api/client/ScryingLensOverlayRegistry.java +++ b/Common/src/main/java/at/petrak/hexcasting/api/client/ScryingLensOverlayRegistry.java @@ -4,13 +4,14 @@ import at.petrak.hexcasting.xplat.IXplatAbstractions; import com.google.common.collect.Lists; import com.mojang.datafixers.util.Pair; import net.minecraft.client.Minecraft; -import net.minecraft.world.level.Level; -import net.minecraft.world.entity.player.Player; import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; +import net.minecraft.core.Registry; import net.minecraft.network.chat.Component; import net.minecraft.resources.ResourceLocation; +import net.minecraft.world.entity.player.Player; import net.minecraft.world.item.ItemStack; +import net.minecraft.world.level.Level; import net.minecraft.world.level.block.BeehiveBlock; import net.minecraft.world.level.block.Block; import net.minecraft.world.level.block.Blocks; @@ -120,7 +121,7 @@ public final class ScryingLensOverlayRegistry { * @throws IllegalArgumentException if the block is already registered. */ public static void addDisplayer(Block block, OverlayBuilder displayer) { - addDisplayer(IXplatAbstractions.INSTANCE.getID(block), displayer); + addDisplayer(Registry.BLOCK.getKey(block), displayer); } /** diff --git a/Common/src/main/java/at/petrak/hexcasting/common/misc/Brainsweeping.java b/Common/src/main/java/at/petrak/hexcasting/common/misc/BrainsweepingEvents.java similarity index 97% rename from Common/src/main/java/at/petrak/hexcasting/common/misc/Brainsweeping.java rename to Common/src/main/java/at/petrak/hexcasting/common/misc/BrainsweepingEvents.java index 6a5b1996..25079712 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/misc/Brainsweeping.java +++ b/Common/src/main/java/at/petrak/hexcasting/common/misc/BrainsweepingEvents.java @@ -11,7 +11,7 @@ import net.minecraft.world.level.Level; import net.minecraft.world.phys.EntityHitResult; import org.jetbrains.annotations.Nullable; -public class Brainsweeping { +public class BrainsweepingEvents { public static InteractionResult interactWithBrainswept(Player player, Level world, InteractionHand hand, Entity entity, @Nullable EntityHitResult hitResult) { if (entity instanceof Mob mob && IXplatAbstractions.INSTANCE.isBrainswept(mob)) { diff --git a/Common/src/main/java/at/petrak/hexcasting/xplat/IXplatAbstractions.java b/Common/src/main/java/at/petrak/hexcasting/xplat/IXplatAbstractions.java index e5019d6e..ffa155a7 100644 --- a/Common/src/main/java/at/petrak/hexcasting/xplat/IXplatAbstractions.java +++ b/Common/src/main/java/at/petrak/hexcasting/xplat/IXplatAbstractions.java @@ -16,14 +16,12 @@ import at.petrak.hexcasting.interop.pehkui.PehkuiInterop; import net.minecraft.core.BlockPos; import net.minecraft.core.Registry; import net.minecraft.network.protocol.Packet; -import net.minecraft.resources.ResourceLocation; import net.minecraft.server.level.ServerLevel; import net.minecraft.server.level.ServerPlayer; import net.minecraft.world.InteractionHand; import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.EquipmentSlot; import net.minecraft.world.entity.Mob; -import net.minecraft.world.entity.npc.VillagerProfession; import net.minecraft.world.entity.player.Player; import net.minecraft.world.item.CreativeModeTab; import net.minecraft.world.item.Item; @@ -125,7 +123,7 @@ public interface IXplatAbstractions { // Blocks BlockEntityType createBlockEntityType(BiFunction func, - Block... blocks); + Block... blocks); boolean tryPlaceFluid(Level level, InteractionHand hand, BlockPos pos, Fluid fluid); @@ -137,19 +135,6 @@ public interface IXplatAbstractions { boolean isCorrectTierForDrops(Tier tier, BlockState bs); - // These don't need to be xplat anymore, but it does save refactoring if they're still defined here - default ResourceLocation getID(Block block) { - return Registry.BLOCK.getKey(block); - } - - default ResourceLocation getID(Item item) { - return Registry.ITEM.getKey(item); - } - - default ResourceLocation getID(VillagerProfession profession) { - return Registry.VILLAGER_PROFESSION.getKey(profession); - } - Ingredient getUnsealedIngredient(ItemStack stack); IXplatTags tags(); diff --git a/Fabric/src/main/java/at/petrak/hexcasting/fabric/FabricHexInitializer.kt b/Fabric/src/main/java/at/petrak/hexcasting/fabric/FabricHexInitializer.kt index f3c5e2e7..286c9ff0 100644 --- a/Fabric/src/main/java/at/petrak/hexcasting/fabric/FabricHexInitializer.kt +++ b/Fabric/src/main/java/at/petrak/hexcasting/fabric/FabricHexInitializer.kt @@ -15,7 +15,7 @@ import at.petrak.hexcasting.common.lib.* import at.petrak.hexcasting.common.lib.hex.HexIotaTypes import at.petrak.hexcasting.common.loot.HexLootHandler import at.petrak.hexcasting.common.misc.AkashicTreeGrower -import at.petrak.hexcasting.common.misc.Brainsweeping +import at.petrak.hexcasting.common.misc.BrainsweepingEvents import at.petrak.hexcasting.common.misc.PlayerPositionRecorder import at.petrak.hexcasting.common.recipe.HexRecipeStuffRegistry import at.petrak.hexcasting.fabric.event.VillagerConversionCallback @@ -63,8 +63,8 @@ object FabricHexInitializer : ModInitializer { } fun initListeners() { - UseEntityCallback.EVENT.register(Brainsweeping::interactWithBrainswept) - VillagerConversionCallback.EVENT.register(Brainsweeping::copyBrainsweepPostTransformation) + UseEntityCallback.EVENT.register(BrainsweepingEvents::interactWithBrainswept) + VillagerConversionCallback.EVENT.register(BrainsweepingEvents::copyBrainsweepPostTransformation) AttackBlockCallback.EVENT.register { player, world, _, pos, _ -> // SUCCESS cancels further processing and, on the client, sends a packet to the server. // PASS falls back to further processing. diff --git a/Fabric/src/main/java/at/petrak/hexcasting/fabric/xplat/FabricXplatImpl.java b/Fabric/src/main/java/at/petrak/hexcasting/fabric/xplat/FabricXplatImpl.java index 7f3399d9..4ce2f0f8 100644 --- a/Fabric/src/main/java/at/petrak/hexcasting/fabric/xplat/FabricXplatImpl.java +++ b/Fabric/src/main/java/at/petrak/hexcasting/fabric/xplat/FabricXplatImpl.java @@ -61,7 +61,6 @@ import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.EquipmentSlot; import net.minecraft.world.entity.Mob; import net.minecraft.world.entity.npc.Villager; -import net.minecraft.world.entity.npc.VillagerProfession; import net.minecraft.world.entity.player.Player; import net.minecraft.world.item.*; import net.minecraft.world.item.crafting.Ingredient; @@ -306,37 +305,19 @@ public class FabricXplatImpl implements IXplatAbstractions { return false; } - @Override - public ResourceLocation getID(Block block) { - return Registry.BLOCK.getKey(block); - } - - @Override - public ResourceLocation getID(Item item) { - return Registry.ITEM.getKey(item); - } - - @Override - public ResourceLocation getID(VillagerProfession profession) { - return Registry.VILLAGER_PROFESSION.getKey(profession); - } - @Override public Ingredient getUnsealedIngredient(ItemStack stack) { return FabricUnsealedIngredient.of(stack); } - private static CreativeModeTab TAB = null; + private static Supplier TAB = Suppliers.memoize(() -> FabricItemGroupBuilder.create( + modLoc("creative_tab")) + .icon(HexItems::tabIcon) + .build()); @Override public CreativeModeTab getTab() { - if (TAB == null) { - TAB = FabricItemGroupBuilder.create(modLoc("creative_tab")) - .icon(HexItems::tabIcon) - .build(); - } - - return TAB; + return TAB.get(); } // do a stupid hack from botania diff --git a/Forge/src/main/java/at/petrak/hexcasting/forge/ForgeHexInitializer.java b/Forge/src/main/java/at/petrak/hexcasting/forge/ForgeHexInitializer.java index 06b4706d..47d83e60 100644 --- a/Forge/src/main/java/at/petrak/hexcasting/forge/ForgeHexInitializer.java +++ b/Forge/src/main/java/at/petrak/hexcasting/forge/ForgeHexInitializer.java @@ -16,7 +16,7 @@ import at.petrak.hexcasting.common.lib.*; import at.petrak.hexcasting.common.lib.hex.HexIotaTypes; import at.petrak.hexcasting.common.loot.HexLootHandler; import at.petrak.hexcasting.common.misc.AkashicTreeGrower; -import at.petrak.hexcasting.common.misc.Brainsweeping; +import at.petrak.hexcasting.common.misc.BrainsweepingEvents; import at.petrak.hexcasting.common.misc.PlayerPositionRecorder; import at.petrak.hexcasting.common.recipe.HexRecipeStuffRegistry; import at.petrak.hexcasting.forge.cap.CapSyncers; @@ -70,175 +70,176 @@ import java.util.function.Consumer; @Mod(HexAPI.MOD_ID) public class ForgeHexInitializer { - public ForgeHexInitializer() { - initConfig(); - initRegistry(); - initListeners(); - } + public ForgeHexInitializer() { + initConfig(); + initRegistry(); + initListeners(); + } - private static void initConfig() { - var config = new ForgeConfigSpec.Builder().configure(ForgeHexConfig::new); - var clientConfig = new ForgeConfigSpec.Builder().configure(ForgeHexConfig.Client::new); - var serverConfig = new ForgeConfigSpec.Builder().configure(ForgeHexConfig.Server::new); - HexConfig.setCommon(config.getLeft()); - HexConfig.setClient(clientConfig.getLeft()); - HexConfig.setServer(serverConfig.getLeft()); - var mlc = ModLoadingContext.get(); - mlc.registerConfig(ModConfig.Type.COMMON, config.getRight()); - mlc.registerConfig(ModConfig.Type.CLIENT, clientConfig.getRight()); - mlc.registerConfig(ModConfig.Type.SERVER, serverConfig.getRight()); - } + private static void initConfig() { + var config = new ForgeConfigSpec.Builder().configure(ForgeHexConfig::new); + var clientConfig = new ForgeConfigSpec.Builder().configure(ForgeHexConfig.Client::new); + var serverConfig = new ForgeConfigSpec.Builder().configure(ForgeHexConfig.Server::new); + HexConfig.setCommon(config.getLeft()); + HexConfig.setClient(clientConfig.getLeft()); + HexConfig.setServer(serverConfig.getLeft()); + var mlc = ModLoadingContext.get(); + mlc.registerConfig(ModConfig.Type.COMMON, config.getRight()); + mlc.registerConfig(ModConfig.Type.CLIENT, clientConfig.getRight()); + mlc.registerConfig(ModConfig.Type.SERVER, serverConfig.getRight()); + } - private static void initRegistry() { - bind(Registry.SOUND_EVENT_REGISTRY, HexSounds::registerSounds); - bind(Registry.BLOCK_REGISTRY, HexBlocks::registerBlocks); - bind(Registry.ITEM_REGISTRY, HexBlocks::registerBlockItems); - bind(Registry.BLOCK_ENTITY_TYPE_REGISTRY, HexBlockEntities::registerTiles); - bind(Registry.ITEM_REGISTRY, HexItems::registerItems); + private static void initRegistry() { + bind(Registry.SOUND_EVENT_REGISTRY, HexSounds::registerSounds); + bind(Registry.BLOCK_REGISTRY, HexBlocks::registerBlocks); + bind(Registry.ITEM_REGISTRY, HexBlocks::registerBlockItems); + bind(Registry.BLOCK_ENTITY_TYPE_REGISTRY, HexBlockEntities::registerTiles); + bind(Registry.ITEM_REGISTRY, HexItems::registerItems); - bind(Registry.RECIPE_SERIALIZER_REGISTRY, HexRecipeStuffRegistry::registerSerializers); - bind(Registry.RECIPE_TYPE_REGISTRY, HexRecipeStuffRegistry::registerTypes); + bind(Registry.RECIPE_SERIALIZER_REGISTRY, HexRecipeStuffRegistry::registerSerializers); + bind(Registry.RECIPE_TYPE_REGISTRY, HexRecipeStuffRegistry::registerTypes); - bind(Registry.ENTITY_TYPE_REGISTRY, HexEntities::registerEntities); + bind(Registry.ENTITY_TYPE_REGISTRY, HexEntities::registerEntities); - bind(Registry.PARTICLE_TYPE_REGISTRY, HexParticles::registerParticles); + bind(Registry.PARTICLE_TYPE_REGISTRY, HexParticles::registerParticles); - ForgeHexArgumentTypeRegistry.ARGUMENT_TYPES.register(getModEventBus()); + ForgeHexArgumentTypeRegistry.ARGUMENT_TYPES.register(getModEventBus()); - HexIotaTypes.registerTypes(); + HexIotaTypes.registerTypes(); - HexAdvancementTriggers.registerTriggers(); - } + HexAdvancementTriggers.registerTriggers(); + } - // https://github.com/VazkiiMods/Botania/blob/1.18.x/Forge/src/main/java/vazkii/botania/forge/ForgeCommonInitializer.java - private static void bind(ResourceKey> registry, - Consumer> source) { - getModEventBus().addListener((RegisterEvent event) -> { - if (registry.equals(event.getRegistryKey())) { - source.accept((t, rl) -> event.register(registry, rl, () -> t)); - } - }); - } + // https://github.com/VazkiiMods/Botania/blob/1.18.x/Forge/src/main/java/vazkii/botania/forge/ForgeCommonInitializer.java + private static void bind(ResourceKey> registry, + Consumer> source) { + getModEventBus().addListener((RegisterEvent event) -> { + if (registry.equals(event.getRegistryKey())) { + source.accept((t, rl) -> event.register(registry, rl, () -> t)); + } + }); + } - private static void initListeners() { - var modBus = getModEventBus(); - var evBus = MinecraftForge.EVENT_BUS; + private static void initListeners() { + var modBus = getModEventBus(); + var evBus = MinecraftForge.EVENT_BUS; - DistExecutor.unsafeRunWhenOn(Dist.CLIENT, () -> () -> modBus.register(ForgeHexClientInitializer.class)); + DistExecutor.unsafeRunWhenOn(Dist.CLIENT, () -> () -> modBus.register(ForgeHexClientInitializer.class)); - modBus.addListener((FMLCommonSetupEvent evt) -> - evt.enqueueWork(() -> { - ForgePacketHandler.init(); - HexComposting.setup(); - HexStrippables.init(); - RegisterPatterns.registerPatterns(); - // Forge does not strictly require TreeGrowers to initialize during early game stages, unlike Fabric - // and Quilt. - // However, all launcher panic if the same resource is registered twice. But do need blocks and - // items to be completely initialized. - // Explicitly calling here avoids potential confusion, or reliance on tricks that may fail under - // compiler optimization. - AkashicTreeGrower.init(); + modBus.addListener((FMLCommonSetupEvent evt) -> + evt.enqueueWork(() -> { + ForgePacketHandler.init(); + HexComposting.setup(); + HexStrippables.init(); + RegisterPatterns.registerPatterns(); + // Forge does not strictly require TreeGrowers to initialize during early game stages, unlike Fabric + // and Quilt. + // However, all launcher panic if the same resource is registered twice. But do need blocks and + // items to be completely initialized. + // Explicitly calling here avoids potential confusion, or reliance on tricks that may fail under + // compiler optimization. + AkashicTreeGrower.init(); - HexInterop.init(); - })); + HexInterop.init(); + })); - // We have to do these at some point when the registries are still open - modBus.addListener((RegisterEvent evt) -> { - if (evt.getRegistryKey().equals(Registry.ITEM_REGISTRY)) { - CraftingHelper.register(ForgeUnsealedIngredient.ID, ForgeUnsealedIngredient.Serializer.INSTANCE); - CraftingHelper.register(ForgeModConditionalIngredient.ID, - ForgeModConditionalIngredient.Serializer.INSTANCE); - HexStatistics.register(); - HexLootFunctions.registerSerializers((lift, id) -> - Registry.register(Registry.LOOT_FUNCTION_TYPE, id, lift)); - } - }); + // We have to do these at some point when the registries are still open + modBus.addListener((RegisterEvent evt) -> { + if (evt.getRegistryKey().equals(Registry.ITEM_REGISTRY)) { + CraftingHelper.register(ForgeUnsealedIngredient.ID, ForgeUnsealedIngredient.Serializer.INSTANCE); + CraftingHelper.register(ForgeModConditionalIngredient.ID, + ForgeModConditionalIngredient.Serializer.INSTANCE); + HexStatistics.register(); + HexLootFunctions.registerSerializers((lift, id) -> + Registry.register(Registry.LOOT_FUNCTION_TYPE, id, lift)); + } + }); - modBus.addListener((FMLLoadCompleteEvent evt) -> - HexAPI.LOGGER.info(PatternRegistry.getPatternCountInfo())); + modBus.addListener((FMLLoadCompleteEvent evt) -> + HexAPI.LOGGER.info(PatternRegistry.getPatternCountInfo())); - evBus.addListener((PlayerInteractEvent.EntityInteract evt) -> { - var res = Brainsweeping.interactWithBrainswept( - evt.getEntity(), evt.getLevel(), evt.getHand(), evt.getTarget(), null); - if (res.consumesAction()) { - evt.setCanceled(true); - evt.setCancellationResult(res); - } - }); - evBus.addListener((LivingConversionEvent.Post evt) -> - Brainsweeping.copyBrainsweepPostTransformation(evt.getEntity(), evt.getOutcome())); + evBus.addListener((PlayerInteractEvent.EntityInteract evt) -> { + var res = BrainsweepingEvents.interactWithBrainswept( + evt.getEntity(), evt.getLevel(), evt.getHand(), evt.getTarget(), null); + if (res.consumesAction()) { + evt.setCanceled(true); + evt.setCancellationResult(res); + } + }); + evBus.addListener((LivingConversionEvent.Post evt) -> + BrainsweepingEvents.copyBrainsweepPostTransformation(evt.getEntity(), evt.getOutcome())); - evBus.addListener((LivingEvent.LivingTickEvent evt) -> { - OpFlight.INSTANCE.tickDownFlight(evt.getEntity()); - ItemLens.tickLens(evt.getEntity()); - }); + evBus.addListener((LivingEvent.LivingTickEvent evt) -> { + OpFlight.INSTANCE.tickDownFlight(evt.getEntity()); + ItemLens.tickLens(evt.getEntity()); + }); - evBus.addListener((TickEvent.LevelTickEvent evt) -> { - if (evt.phase == TickEvent.Phase.END && evt.level instanceof ServerLevel world) { - PlayerPositionRecorder.updateAllPlayers(world); - } - }); + evBus.addListener((TickEvent.LevelTickEvent evt) -> { + if (evt.phase == TickEvent.Phase.END && evt.level instanceof ServerLevel world) { + PlayerPositionRecorder.updateAllPlayers(world); + } + }); - evBus.addListener((RegisterCommandsEvent evt) -> HexCommands.register(evt.getDispatcher())); + evBus.addListener((RegisterCommandsEvent evt) -> HexCommands.register(evt.getDispatcher())); - evBus.addListener((PlayerEvent.BreakSpeed evt) -> { - var pos = evt.getPosition(); - // tracing the dataflow, this is only empty if someone is calling a deprecated function for the - // break speed. This will probably not ever hapen, but hey! i will never complain about correctness - // enforced at the type level. - if (pos.isEmpty()) { - return; - } - evt.setCanceled(ItemJewelerHammer.shouldFailToBreak(evt.getEntity(), evt.getState(), pos.get())); - }); + evBus.addListener((PlayerEvent.BreakSpeed evt) -> { + var pos = evt.getPosition(); + // tracing the dataflow, this is only empty if someone is calling a deprecated function for the + // break speed. This will probably not ever hapen, but hey! i will never complain about correctness + // enforced at the type level. + if (pos.isEmpty()) { + return; + } + evt.setCanceled(ItemJewelerHammer.shouldFailToBreak(evt.getEntity(), evt.getState(), pos.get())); + }); - evBus.addListener((LootTableLoadEvent evt) -> HexLootHandler.lootLoad( - evt.getName(), - builder -> evt.getTable().addPool(builder.build()))); + evBus.addListener((LootTableLoadEvent evt) -> HexLootHandler.lootLoad( + evt.getName(), + builder -> evt.getTable().addPool(builder.build()))); - // === Events implemented in other ways on Fabric + // === Events implemented in other ways on Fabric - // On Fabric this should be auto-synced - evBus.addListener((PlayerEvent.StartTracking evt) -> { - Entity target = evt.getTarget(); - if (evt.getTarget() instanceof ServerPlayer serverPlayer && - target instanceof Mob mob && IXplatAbstractions.INSTANCE.isBrainswept(mob)) { - ForgePacketHandler.getNetwork() - .send(PacketDistributor.PLAYER.with(() -> serverPlayer), MsgBrainsweepAck.of(mob)); - } - }); + // On Fabric this should be auto-synced + evBus.addListener((PlayerEvent.StartTracking evt) -> { + Entity target = evt.getTarget(); + if (evt.getTarget() instanceof ServerPlayer serverPlayer && + target instanceof Mob mob && IXplatAbstractions.INSTANCE.isBrainswept(mob)) { + ForgePacketHandler.getNetwork() + .send(PacketDistributor.PLAYER.with(() -> serverPlayer), MsgBrainsweepAck.of(mob)); + } + }); - // Implemented with a mixin on Farbc - evBus.addListener((BlockEvent.BlockToolModificationEvent evt) -> { - if (!evt.isSimulated() && evt.getToolAction() == ToolActions.AXE_STRIP) { - BlockState bs = evt.getState(); - var output = HexStrippables.STRIPPABLES.get(bs.getBlock()); - if (output != null) { - evt.setFinalState(output.withPropertiesOf(bs)); - } - } - }); + // Implemented with a mixin on Farbc + evBus.addListener((BlockEvent.BlockToolModificationEvent evt) -> { + if (!evt.isSimulated() && evt.getToolAction() == ToolActions.AXE_STRIP) { + BlockState bs = evt.getState(); + var output = HexStrippables.STRIPPABLES.get(bs.getBlock()); + if (output != null) { + evt.setFinalState(output.withPropertiesOf(bs)); + } + } + }); - // Caps are cardinal components on farbc - modBus.addListener(ForgeCapabilityHandler::registerCaps); - evBus.addGenericListener(ItemStack.class, ForgeCapabilityHandler::attachItemCaps); - evBus.addGenericListener(BlockEntity.class, ForgeCapabilityHandler::attachBlockEntityCaps); - evBus.addGenericListener(Entity.class, ForgeCapabilityHandler::attachEntityCaps); + // Caps are cardinal components on farbc + modBus.addListener(ForgeCapabilityHandler::registerCaps); + evBus.addGenericListener(ItemStack.class, ForgeCapabilityHandler::attachItemCaps); + evBus.addGenericListener(BlockEntity.class, ForgeCapabilityHandler::attachBlockEntityCaps); + evBus.addGenericListener(Entity.class, ForgeCapabilityHandler::attachEntityCaps); - modBus.register(HexForgeDataGenerators.class); - modBus.register(ForgeCapabilityHandler.class); - evBus.register(CapSyncers.class); + modBus.register(HexForgeDataGenerators.class); + modBus.register(ForgeCapabilityHandler.class); + evBus.register(CapSyncers.class); - if (ModList.get().isLoaded(HexInterop.Forge.CURIOS_API_ID)) { - modBus.addListener(CuriosApiInterop::onInterModEnqueue); - modBus.addListener(CuriosApiInterop::onClientSetup); - DistExecutor.unsafeRunWhenOn(Dist.CLIENT, () -> () -> modBus.addListener(CuriosRenderers::onLayerRegister)); - } - } + if (ModList.get().isLoaded(HexInterop.Forge.CURIOS_API_ID)) { + modBus.addListener(CuriosApiInterop::onInterModEnqueue); + modBus.addListener(CuriosApiInterop::onClientSetup); + DistExecutor.unsafeRunWhenOn(Dist.CLIENT, + () -> () -> modBus.addListener(CuriosRenderers::onLayerRegister)); + } + } - // aaaauughhg - private static IEventBus getModEventBus() { - return KotlinModLoadingContext.Companion.get().getKEventBus(); - } + // aaaauughhg + private static IEventBus getModEventBus() { + return KotlinModLoadingContext.Companion.get().getKEventBus(); + } } diff --git a/Forge/src/main/java/at/petrak/hexcasting/forge/xplat/ForgeXplatImpl.java b/Forge/src/main/java/at/petrak/hexcasting/forge/xplat/ForgeXplatImpl.java index 62ddf2ae..4bd6564c 100644 --- a/Forge/src/main/java/at/petrak/hexcasting/forge/xplat/ForgeXplatImpl.java +++ b/Forge/src/main/java/at/petrak/hexcasting/forge/xplat/ForgeXplatImpl.java @@ -353,25 +353,22 @@ public class ForgeXplatImpl implements IXplatAbstractions { return ForgeUnsealedIngredient.of(stack); } - private static CreativeModeTab TAB = null; + private static Supplier TAB = Suppliers.memoize(() -> + new CreativeModeTab(HexAPI.MOD_ID) { + @Override + public ItemStack makeIcon() { + return HexItems.tabIcon(); + } + + @Override + public void fillItemList(NonNullList p_40778_) { + super.fillItemList(p_40778_); + } + }); @Override public CreativeModeTab getTab() { - if (TAB == null) { - TAB = new CreativeModeTab(HexAPI.MOD_ID) { - @Override - public ItemStack makeIcon() { - return HexItems.tabIcon(); - } - - @Override - public void fillItemList(NonNullList p_40778_) { - super.fillItemList(p_40778_); - } - }; - } - - return TAB; + return TAB.get(); } @Override diff --git a/gradle.properties b/gradle.properties index f7e6a0d6..75d91c46 100644 --- a/gradle.properties +++ b/gradle.properties @@ -10,7 +10,7 @@ jetbrainsAnnotationsVersion=23.0.0 minecraftVersion=1.19.2 kotlinVersion=1.7.20 -modVersion=0.10.3 +modVersion=0.11.0 paucalVersion=0.5.0 patchouliVersion=77 From 573fbb738af8e7e9543216a7acf2c0d872a74144 Mon Sep 17 00:00:00 2001 From: "petrak@" Date: Fri, 30 Dec 2022 13:43:38 -0500 Subject: [PATCH 32/95] oh god, this is gonna suck --- .../hexcasting/api/PatternRegistry.java | 12 - .../petrak/hexcasting/api/SpecialHandler.java | 17 + .../client/ScryingLensOverlayRegistry.java | 3 +- .../at/petrak/hexcasting/api/mod/HexTags.java | 18 ++ .../at/petrak/hexcasting/api/spell/Action.kt | 2 - .../api/spell/ActionRegistryEntry.java | 14 + .../hex/HexActionsAndHandlers.java} | 26 +- .../common/lib/hex/HexEvalSounds.java | 2 +- .../common/lib/hex/HexIotaTypes.java | 2 - .../hexcasting/xplat/IXplatAbstractions.java | 12 + .../hexcasting/fabric/FabricHexInitializer.kt | 6 +- .../fabric/xplat/FabricXplatImpl.java | 29 +- .../hexcasting/forge/ForgeHexInitializer.java | 292 +++++++++--------- .../forge/mixin/ForgeAccessorRegistry.java | 6 + .../forge/xplat/ForgeXplatImpl.java | 20 ++ 15 files changed, 289 insertions(+), 172 deletions(-) create mode 100644 Common/src/main/java/at/petrak/hexcasting/api/SpecialHandler.java create mode 100644 Common/src/main/java/at/petrak/hexcasting/api/spell/ActionRegistryEntry.java rename Common/src/main/java/at/petrak/hexcasting/common/{casting/RegisterPatterns.java => lib/hex/HexActionsAndHandlers.java} (97%) diff --git a/Common/src/main/java/at/petrak/hexcasting/api/PatternRegistry.java b/Common/src/main/java/at/petrak/hexcasting/api/PatternRegistry.java index 7e8bae1e..b11489a3 100644 --- a/Common/src/main/java/at/petrak/hexcasting/api/PatternRegistry.java +++ b/Common/src/main/java/at/petrak/hexcasting/api/PatternRegistry.java @@ -202,18 +202,6 @@ public class PatternRegistry { return perWorldPatternLookup.keySet(); } - /** - * Special handling of a pattern. Before checking any of the normal angle-signature based patterns, - * a given pattern is run by all of these special handlers patterns. If none of them return non-null, - * then its signature is checked. - *

- * In the base mod, this is used for number patterns and Bookkeeper's Gambit. - */ - @FunctionalInterface - public interface SpecialHandler { - @Nullable Action handlePattern(HexPattern pattern); - } - public record SpecialHandlerEntry(ResourceLocation id, SpecialHandler handler) { } diff --git a/Common/src/main/java/at/petrak/hexcasting/api/SpecialHandler.java b/Common/src/main/java/at/petrak/hexcasting/api/SpecialHandler.java new file mode 100644 index 00000000..f229da9d --- /dev/null +++ b/Common/src/main/java/at/petrak/hexcasting/api/SpecialHandler.java @@ -0,0 +1,17 @@ +package at.petrak.hexcasting.api; + +import at.petrak.hexcasting.api.spell.Action; +import at.petrak.hexcasting.api.spell.math.HexPattern; +import org.jetbrains.annotations.Nullable; + +/** + * Special handling of a pattern. Before checking any of the normal angle-signature based patterns, + * a given pattern is run by all of these special handlers patterns. If none of them return non-null, + * then its signature is checked. + *

+ * In the base mod, this is used for number patterns and Bookkeeper's Gambit. + */ +@FunctionalInterface +public interface SpecialHandler { + @Nullable Action handlePattern(HexPattern pattern); +} diff --git a/Common/src/main/java/at/petrak/hexcasting/api/client/ScryingLensOverlayRegistry.java b/Common/src/main/java/at/petrak/hexcasting/api/client/ScryingLensOverlayRegistry.java index 127c4a8b..476e7f54 100644 --- a/Common/src/main/java/at/petrak/hexcasting/api/client/ScryingLensOverlayRegistry.java +++ b/Common/src/main/java/at/petrak/hexcasting/api/client/ScryingLensOverlayRegistry.java @@ -1,6 +1,5 @@ package at.petrak.hexcasting.api.client; -import at.petrak.hexcasting.xplat.IXplatAbstractions; import com.google.common.collect.Lists; import com.mojang.datafixers.util.Pair; import net.minecraft.client.Minecraft; @@ -153,7 +152,7 @@ public final class ScryingLensOverlayRegistry { Player observer, Level world, Direction hitFace) { List> lines = Lists.newArrayList(); - var idLookedup = ID_LOOKUP.get(IXplatAbstractions.INSTANCE.getID(state.getBlock())); + var idLookedup = ID_LOOKUP.get(Registry.BLOCK.getKey(state.getBlock())); if (idLookedup != null) { idLookedup.addLines(lines, state, pos, observer, world, hitFace); } 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 41df2c90..e23b6fba 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 @@ -1,5 +1,7 @@ package at.petrak.hexcasting.api.mod; +import at.petrak.hexcasting.api.spell.ActionRegistryEntry; +import at.petrak.hexcasting.xplat.IXplatAbstractions; import net.minecraft.core.Registry; import net.minecraft.resources.ResourceLocation; import net.minecraft.tags.TagKey; @@ -43,4 +45,20 @@ public class HexTags { return TagKey.create(Registry.ENTITY_TYPE_REGISTRY, modLoc(name)); } } + + public static final class Actions { + /** + * Actions with this tag can't be used until the caster is enlightened and send the + * "am I not skilled enough" message + */ + public static final TagKey REQUIRES_ENLIGHTENMENT = create("requires_enlightenment"); + /** + * Actions where the pattern is calculated per-world + */ + public static final TagKey PER_WORLD_PATTERN = create("per_world_pattern"); + + 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/api/spell/Action.kt b/Common/src/main/java/at/petrak/hexcasting/api/spell/Action.kt index 8f1095be..7282ef74 100644 --- a/Common/src/main/java/at/petrak/hexcasting/api/spell/Action.kt +++ b/Common/src/main/java/at/petrak/hexcasting/api/spell/Action.kt @@ -15,8 +15,6 @@ import java.text.DecimalFormat * Manipulates the stack in some way, usually by popping some number of values off the stack * and pushing one new value. * For a more "traditional" pop arguments, push return experience, see [ConstMediaAction]. - * - * Implementors MUST NOT mutate the context. */ interface Action { /** diff --git a/Common/src/main/java/at/petrak/hexcasting/api/spell/ActionRegistryEntry.java b/Common/src/main/java/at/petrak/hexcasting/api/spell/ActionRegistryEntry.java new file mode 100644 index 00000000..f8d77343 --- /dev/null +++ b/Common/src/main/java/at/petrak/hexcasting/api/spell/ActionRegistryEntry.java @@ -0,0 +1,14 @@ +package at.petrak.hexcasting.api.spell; + +import at.petrak.hexcasting.api.spell.math.HexPattern; + +/** + * A bit of wrapper information around an action to go in the registry. + * + * @param action The action itself + * @param prototype The pattern associated with this action. The start dir acts as the "canonical" start direction + * for display in the book. For per-world patterns, the angle signature is the *shape* of the pattern + * but probably not the pattern itself. + */ +public record ActionRegistryEntry(Action action, HexPattern prototype) { +} diff --git a/Common/src/main/java/at/petrak/hexcasting/common/casting/RegisterPatterns.java b/Common/src/main/java/at/petrak/hexcasting/common/lib/hex/HexActionsAndHandlers.java similarity index 97% rename from Common/src/main/java/at/petrak/hexcasting/common/casting/RegisterPatterns.java rename to Common/src/main/java/at/petrak/hexcasting/common/lib/hex/HexActionsAndHandlers.java index b453746c..f7c6e880 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/casting/RegisterPatterns.java +++ b/Common/src/main/java/at/petrak/hexcasting/common/lib/hex/HexActionsAndHandlers.java @@ -1,8 +1,9 @@ -package at.petrak.hexcasting.common.casting; +package at.petrak.hexcasting.common.lib.hex; import at.petrak.hexcasting.api.PatternRegistry; import at.petrak.hexcasting.api.misc.MediaConstants; import at.petrak.hexcasting.api.spell.Action; +import at.petrak.hexcasting.api.spell.ActionRegistryEntry; import at.petrak.hexcasting.api.spell.iota.BooleanIota; import at.petrak.hexcasting.api.spell.iota.DoubleIota; import at.petrak.hexcasting.api.spell.iota.NullIota; @@ -39,7 +40,10 @@ import at.petrak.hexcasting.common.casting.operators.spells.sentinel.OpGetSentin import at.petrak.hexcasting.common.casting.operators.spells.sentinel.OpGetSentinelWayfind; import at.petrak.hexcasting.common.casting.operators.stack.*; import at.petrak.hexcasting.common.lib.HexItems; +import at.petrak.hexcasting.xplat.IXplatAbstractions; import it.unimi.dsi.fastutil.booleans.BooleanArrayList; +import net.minecraft.core.Registry; +import net.minecraft.resources.ResourceLocation; import net.minecraft.world.effect.MobEffects; import net.minecraft.world.item.Items; import net.minecraft.world.level.block.Blocks; @@ -47,9 +51,27 @@ import net.minecraft.world.level.block.LayeredCauldronBlock; import net.minecraft.world.level.material.Fluids; import net.minecraft.world.phys.Vec3; +import java.util.LinkedHashMap; +import java.util.Map; + import static at.petrak.hexcasting.api.HexAPI.modLoc; -public class RegisterPatterns { +public class HexActionsAndHandlers { + public static final Registry ACTIONS = IXplatAbstractions.INSTANCE.getActionRegistry(); + + private static final Map ACTION_MAP = new LinkedHashMap<>(); + + public static final ActionRegistryEntry GET_CASTER = make("get_caster", + new ActionRegistryEntry(OpGetCaster.INSTANCE, HexPattern.fromAngles("qaq", HexDir.NORTH_EAST))); + + private static ActionRegistryEntry make(String name, ActionRegistryEntry are) { + var old = ACTION_MAP.put(modLoc(name), are); + if (old != null) { + throw new IllegalArgumentException("Typo? Duplicate id " + name); + } + return are; + } + // I guess this means the client will have a big empty map for patterns public static void registerPatterns() { try { diff --git a/Common/src/main/java/at/petrak/hexcasting/common/lib/hex/HexEvalSounds.java b/Common/src/main/java/at/petrak/hexcasting/common/lib/hex/HexEvalSounds.java index 355693ab..2c9cf99f 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/lib/hex/HexEvalSounds.java +++ b/Common/src/main/java/at/petrak/hexcasting/common/lib/hex/HexEvalSounds.java @@ -38,7 +38,7 @@ public class HexEvalSounds { return sound; } - public static void registerTypes() { + public static void register() { BiConsumer r = (type, id) -> Registry.register(REGISTRY, id, type); for (var e : SOUNDS.entrySet()) { r.accept(e.getValue(), e.getKey()); diff --git a/Common/src/main/java/at/petrak/hexcasting/common/lib/hex/HexIotaTypes.java b/Common/src/main/java/at/petrak/hexcasting/common/lib/hex/HexIotaTypes.java index ba4bfcf3..cb1548fd 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/lib/hex/HexIotaTypes.java +++ b/Common/src/main/java/at/petrak/hexcasting/common/lib/hex/HexIotaTypes.java @@ -14,7 +14,6 @@ import net.minecraft.network.chat.Component; import net.minecraft.resources.ResourceLocation; import net.minecraft.server.level.ServerLevel; import net.minecraft.util.FormattedCharSequence; -import org.jetbrains.annotations.ApiStatus; import org.jetbrains.annotations.Nullable; import javax.annotation.ParametersAreNonnullByDefault; @@ -180,7 +179,6 @@ public class HexIotaTypes { return type.color(); } - @ApiStatus.Internal public static void registerTypes() { BiConsumer, ResourceLocation> r = (type, id) -> Registry.register(REGISTRY, id, type); for (var e : TYPES.entrySet()) { diff --git a/Common/src/main/java/at/petrak/hexcasting/xplat/IXplatAbstractions.java b/Common/src/main/java/at/petrak/hexcasting/xplat/IXplatAbstractions.java index ffa155a7..d00284ee 100644 --- a/Common/src/main/java/at/petrak/hexcasting/xplat/IXplatAbstractions.java +++ b/Common/src/main/java/at/petrak/hexcasting/xplat/IXplatAbstractions.java @@ -1,12 +1,14 @@ package at.petrak.hexcasting.xplat; import at.petrak.hexcasting.api.HexAPI; +import at.petrak.hexcasting.api.SpecialHandler; import at.petrak.hexcasting.api.addldata.ADHexHolder; import at.petrak.hexcasting.api.addldata.ADIotaHolder; import at.petrak.hexcasting.api.addldata.ADMediaHolder; import at.petrak.hexcasting.api.misc.FrozenColorizer; import at.petrak.hexcasting.api.player.FlightAbility; import at.petrak.hexcasting.api.player.Sentinel; +import at.petrak.hexcasting.api.spell.ActionRegistryEntry; import at.petrak.hexcasting.api.spell.casting.CastingHarness; import at.petrak.hexcasting.api.spell.casting.ResolvedPattern; import at.petrak.hexcasting.api.spell.casting.sideeffects.EvalSound; @@ -143,6 +145,16 @@ public interface IXplatAbstractions { String getModName(String namespace); + /** + * Registry for actions. + *

+ * There's some internal caching (so we can directly look up signatures in a map, for example) + * but this registry is the source of truth. + */ + Registry getActionRegistry(); + + Registry getSpecialHandlerRegistry(); + Registry> getIotaTypeRegistry(); Registry getEvalSoundRegistry(); diff --git a/Fabric/src/main/java/at/petrak/hexcasting/fabric/FabricHexInitializer.kt b/Fabric/src/main/java/at/petrak/hexcasting/fabric/FabricHexInitializer.kt index 286c9ff0..392684f0 100644 --- a/Fabric/src/main/java/at/petrak/hexcasting/fabric/FabricHexInitializer.kt +++ b/Fabric/src/main/java/at/petrak/hexcasting/fabric/FabricHexInitializer.kt @@ -5,13 +5,14 @@ import at.petrak.hexcasting.api.advancements.HexAdvancementTriggers import at.petrak.hexcasting.api.mod.HexStatistics import at.petrak.hexcasting.common.blocks.behavior.HexComposting import at.petrak.hexcasting.common.blocks.behavior.HexStrippables -import at.petrak.hexcasting.common.casting.RegisterPatterns import at.petrak.hexcasting.common.casting.operators.spells.great.OpFlight import at.petrak.hexcasting.common.command.PatternResLocArgument import at.petrak.hexcasting.common.entities.HexEntities import at.petrak.hexcasting.common.items.ItemJewelerHammer import at.petrak.hexcasting.common.items.ItemLens import at.petrak.hexcasting.common.lib.* +import at.petrak.hexcasting.common.lib.hex.HexActionsAndHandlers +import at.petrak.hexcasting.common.lib.hex.HexEvalSounds import at.petrak.hexcasting.common.lib.hex.HexIotaTypes import at.petrak.hexcasting.common.loot.HexLootHandler import at.petrak.hexcasting.common.misc.AkashicTreeGrower @@ -53,7 +54,7 @@ object FabricHexInitializer : ModInitializer { PatternResLocArgument::class.java, SingletonArgumentInfo.contextFree { PatternResLocArgument.id() } ) - RegisterPatterns.registerPatterns() + HexActionsAndHandlers.registerPatterns() HexAdvancementTriggers.registerTriggers() HexComposting.setup() HexStrippables.init() @@ -106,6 +107,7 @@ object FabricHexInitializer : ModInitializer { HexLootFunctions.registerSerializers(bind(Registry.LOOT_FUNCTION_TYPE)) HexIotaTypes.registerTypes() + HexEvalSounds.register() // Because of Java's lazy-loading of classes, can't use Kotlin static initialization for // any calls that will eventually touch FeatureUtils.register(), as the growers here do, diff --git a/Fabric/src/main/java/at/petrak/hexcasting/fabric/xplat/FabricXplatImpl.java b/Fabric/src/main/java/at/petrak/hexcasting/fabric/xplat/FabricXplatImpl.java index 4ce2f0f8..78e96ead 100644 --- a/Fabric/src/main/java/at/petrak/hexcasting/fabric/xplat/FabricXplatImpl.java +++ b/Fabric/src/main/java/at/petrak/hexcasting/fabric/xplat/FabricXplatImpl.java @@ -1,6 +1,7 @@ package at.petrak.hexcasting.fabric.xplat; import at.petrak.hexcasting.api.HexAPI; +import at.petrak.hexcasting.api.SpecialHandler; import at.petrak.hexcasting.api.addldata.ADHexHolder; import at.petrak.hexcasting.api.addldata.ADIotaHolder; import at.petrak.hexcasting.api.addldata.ADMediaHolder; @@ -9,6 +10,7 @@ import at.petrak.hexcasting.api.mod.HexConfig; import at.petrak.hexcasting.api.mod.HexTags; import at.petrak.hexcasting.api.player.FlightAbility; import at.petrak.hexcasting.api.player.Sentinel; +import at.petrak.hexcasting.api.spell.ActionRegistryEntry; import at.petrak.hexcasting.api.spell.casting.CastingHarness; import at.petrak.hexcasting.api.spell.casting.ResolvedPattern; import at.petrak.hexcasting.api.spell.casting.sideeffects.EvalSound; @@ -45,10 +47,7 @@ import net.fabricmc.fabric.api.transfer.v1.transaction.Transaction; import net.fabricmc.loader.api.FabricLoader; import net.fabricmc.loader.api.ModContainer; import net.minecraft.advancements.critereon.ItemPredicate; -import net.minecraft.core.BlockPos; -import net.minecraft.core.DefaultedRegistry; -import net.minecraft.core.Direction; -import net.minecraft.core.Registry; +import net.minecraft.core.*; import net.minecraft.network.protocol.Packet; import net.minecraft.resources.ResourceKey; import net.minecraft.resources.ResourceLocation; @@ -393,6 +392,18 @@ public class FabricXplatImpl implements IXplatAbstractions { return namespace; } + private static final Supplier> ACTION_REGISTRY = Suppliers.memoize(() -> + FabricRegistryBuilder.from(new MappedRegistry( + ResourceKey.createRegistryKey(modLoc("action")), + Lifecycle.stable(), null)) + .buildAndRegister() + ); + private static final Supplier> SPECIAL_HANDLER_REGISTRY = Suppliers.memoize(() -> + FabricRegistryBuilder.from(new MappedRegistry( + ResourceKey.createRegistryKey(modLoc("special_handler")), + Lifecycle.stable(), null)) + .buildAndRegister() + ); private static final Supplier>> IOTA_TYPE_REGISTRY = Suppliers.memoize(() -> FabricRegistryBuilder.from(new DefaultedRegistry>( HexAPI.MOD_ID + ":null", ResourceKey.createRegistryKey(modLoc("iota_type")), @@ -406,6 +417,16 @@ public class FabricXplatImpl implements IXplatAbstractions { .buildAndRegister() ); + @Override + public Registry getActionRegistry() { + return ACTION_REGISTRY.get(); + } + + @Override + public Registry getSpecialHandlerRegistry() { + return SPECIAL_HANDLER_REGISTRY.get(); + } + @Override public Registry> getIotaTypeRegistry() { return IOTA_TYPE_REGISTRY.get(); diff --git a/Forge/src/main/java/at/petrak/hexcasting/forge/ForgeHexInitializer.java b/Forge/src/main/java/at/petrak/hexcasting/forge/ForgeHexInitializer.java index 47d83e60..f8644c5b 100644 --- a/Forge/src/main/java/at/petrak/hexcasting/forge/ForgeHexInitializer.java +++ b/Forge/src/main/java/at/petrak/hexcasting/forge/ForgeHexInitializer.java @@ -7,12 +7,13 @@ import at.petrak.hexcasting.api.mod.HexConfig; import at.petrak.hexcasting.api.mod.HexStatistics; import at.petrak.hexcasting.common.blocks.behavior.HexComposting; import at.petrak.hexcasting.common.blocks.behavior.HexStrippables; -import at.petrak.hexcasting.common.casting.RegisterPatterns; import at.petrak.hexcasting.common.casting.operators.spells.great.OpFlight; import at.petrak.hexcasting.common.entities.HexEntities; import at.petrak.hexcasting.common.items.ItemJewelerHammer; import at.petrak.hexcasting.common.items.ItemLens; import at.petrak.hexcasting.common.lib.*; +import at.petrak.hexcasting.common.lib.hex.HexActionsAndHandlers; +import at.petrak.hexcasting.common.lib.hex.HexEvalSounds; import at.petrak.hexcasting.common.lib.hex.HexIotaTypes; import at.petrak.hexcasting.common.loot.HexLootHandler; import at.petrak.hexcasting.common.misc.AkashicTreeGrower; @@ -70,176 +71,177 @@ import java.util.function.Consumer; @Mod(HexAPI.MOD_ID) public class ForgeHexInitializer { - public ForgeHexInitializer() { - initConfig(); - initRegistry(); - initListeners(); - } + public ForgeHexInitializer() { + initConfig(); + initRegistry(); + initListeners(); + } - private static void initConfig() { - var config = new ForgeConfigSpec.Builder().configure(ForgeHexConfig::new); - var clientConfig = new ForgeConfigSpec.Builder().configure(ForgeHexConfig.Client::new); - var serverConfig = new ForgeConfigSpec.Builder().configure(ForgeHexConfig.Server::new); - HexConfig.setCommon(config.getLeft()); - HexConfig.setClient(clientConfig.getLeft()); - HexConfig.setServer(serverConfig.getLeft()); - var mlc = ModLoadingContext.get(); - mlc.registerConfig(ModConfig.Type.COMMON, config.getRight()); - mlc.registerConfig(ModConfig.Type.CLIENT, clientConfig.getRight()); - mlc.registerConfig(ModConfig.Type.SERVER, serverConfig.getRight()); - } + private static void initConfig() { + var config = new ForgeConfigSpec.Builder().configure(ForgeHexConfig::new); + var clientConfig = new ForgeConfigSpec.Builder().configure(ForgeHexConfig.Client::new); + var serverConfig = new ForgeConfigSpec.Builder().configure(ForgeHexConfig.Server::new); + HexConfig.setCommon(config.getLeft()); + HexConfig.setClient(clientConfig.getLeft()); + HexConfig.setServer(serverConfig.getLeft()); + var mlc = ModLoadingContext.get(); + mlc.registerConfig(ModConfig.Type.COMMON, config.getRight()); + mlc.registerConfig(ModConfig.Type.CLIENT, clientConfig.getRight()); + mlc.registerConfig(ModConfig.Type.SERVER, serverConfig.getRight()); + } - private static void initRegistry() { - bind(Registry.SOUND_EVENT_REGISTRY, HexSounds::registerSounds); - bind(Registry.BLOCK_REGISTRY, HexBlocks::registerBlocks); - bind(Registry.ITEM_REGISTRY, HexBlocks::registerBlockItems); - bind(Registry.BLOCK_ENTITY_TYPE_REGISTRY, HexBlockEntities::registerTiles); - bind(Registry.ITEM_REGISTRY, HexItems::registerItems); + private static void initRegistry() { + bind(Registry.SOUND_EVENT_REGISTRY, HexSounds::registerSounds); + bind(Registry.BLOCK_REGISTRY, HexBlocks::registerBlocks); + bind(Registry.ITEM_REGISTRY, HexBlocks::registerBlockItems); + bind(Registry.BLOCK_ENTITY_TYPE_REGISTRY, HexBlockEntities::registerTiles); + bind(Registry.ITEM_REGISTRY, HexItems::registerItems); - bind(Registry.RECIPE_SERIALIZER_REGISTRY, HexRecipeStuffRegistry::registerSerializers); - bind(Registry.RECIPE_TYPE_REGISTRY, HexRecipeStuffRegistry::registerTypes); + bind(Registry.RECIPE_SERIALIZER_REGISTRY, HexRecipeStuffRegistry::registerSerializers); + bind(Registry.RECIPE_TYPE_REGISTRY, HexRecipeStuffRegistry::registerTypes); - bind(Registry.ENTITY_TYPE_REGISTRY, HexEntities::registerEntities); + bind(Registry.ENTITY_TYPE_REGISTRY, HexEntities::registerEntities); - bind(Registry.PARTICLE_TYPE_REGISTRY, HexParticles::registerParticles); + bind(Registry.PARTICLE_TYPE_REGISTRY, HexParticles::registerParticles); - ForgeHexArgumentTypeRegistry.ARGUMENT_TYPES.register(getModEventBus()); + ForgeHexArgumentTypeRegistry.ARGUMENT_TYPES.register(getModEventBus()); - HexIotaTypes.registerTypes(); + HexIotaTypes.registerTypes(); + HexEvalSounds.register(); - HexAdvancementTriggers.registerTriggers(); - } + HexAdvancementTriggers.registerTriggers(); + } - // https://github.com/VazkiiMods/Botania/blob/1.18.x/Forge/src/main/java/vazkii/botania/forge/ForgeCommonInitializer.java - private static void bind(ResourceKey> registry, - Consumer> source) { - getModEventBus().addListener((RegisterEvent event) -> { - if (registry.equals(event.getRegistryKey())) { - source.accept((t, rl) -> event.register(registry, rl, () -> t)); - } - }); - } + // https://github.com/VazkiiMods/Botania/blob/1.18.x/Forge/src/main/java/vazkii/botania/forge/ForgeCommonInitializer.java + private static void bind(ResourceKey> registry, + Consumer> source) { + getModEventBus().addListener((RegisterEvent event) -> { + if (registry.equals(event.getRegistryKey())) { + source.accept((t, rl) -> event.register(registry, rl, () -> t)); + } + }); + } - private static void initListeners() { - var modBus = getModEventBus(); - var evBus = MinecraftForge.EVENT_BUS; + private static void initListeners() { + var modBus = getModEventBus(); + var evBus = MinecraftForge.EVENT_BUS; - DistExecutor.unsafeRunWhenOn(Dist.CLIENT, () -> () -> modBus.register(ForgeHexClientInitializer.class)); + DistExecutor.unsafeRunWhenOn(Dist.CLIENT, () -> () -> modBus.register(ForgeHexClientInitializer.class)); - modBus.addListener((FMLCommonSetupEvent evt) -> - evt.enqueueWork(() -> { - ForgePacketHandler.init(); - HexComposting.setup(); - HexStrippables.init(); - RegisterPatterns.registerPatterns(); - // Forge does not strictly require TreeGrowers to initialize during early game stages, unlike Fabric - // and Quilt. - // However, all launcher panic if the same resource is registered twice. But do need blocks and - // items to be completely initialized. - // Explicitly calling here avoids potential confusion, or reliance on tricks that may fail under - // compiler optimization. - AkashicTreeGrower.init(); + modBus.addListener((FMLCommonSetupEvent evt) -> + evt.enqueueWork(() -> { + ForgePacketHandler.init(); + HexComposting.setup(); + HexStrippables.init(); + HexActionsAndHandlers.registerPatterns(); + // Forge does not strictly require TreeGrowers to initialize during early game stages, unlike Fabric + // and Quilt. + // However, all launcher panic if the same resource is registered twice. But do need blocks and + // items to be completely initialized. + // Explicitly calling here avoids potential confusion, or reliance on tricks that may fail under + // compiler optimization. + AkashicTreeGrower.init(); - HexInterop.init(); - })); + HexInterop.init(); + })); - // We have to do these at some point when the registries are still open - modBus.addListener((RegisterEvent evt) -> { - if (evt.getRegistryKey().equals(Registry.ITEM_REGISTRY)) { - CraftingHelper.register(ForgeUnsealedIngredient.ID, ForgeUnsealedIngredient.Serializer.INSTANCE); - CraftingHelper.register(ForgeModConditionalIngredient.ID, - ForgeModConditionalIngredient.Serializer.INSTANCE); - HexStatistics.register(); - HexLootFunctions.registerSerializers((lift, id) -> - Registry.register(Registry.LOOT_FUNCTION_TYPE, id, lift)); - } - }); + // We have to do these at some point when the registries are still open + modBus.addListener((RegisterEvent evt) -> { + if (evt.getRegistryKey().equals(Registry.ITEM_REGISTRY)) { + CraftingHelper.register(ForgeUnsealedIngredient.ID, ForgeUnsealedIngredient.Serializer.INSTANCE); + CraftingHelper.register(ForgeModConditionalIngredient.ID, + ForgeModConditionalIngredient.Serializer.INSTANCE); + HexStatistics.register(); + HexLootFunctions.registerSerializers((lift, id) -> + Registry.register(Registry.LOOT_FUNCTION_TYPE, id, lift)); + } + }); - modBus.addListener((FMLLoadCompleteEvent evt) -> - HexAPI.LOGGER.info(PatternRegistry.getPatternCountInfo())); + modBus.addListener((FMLLoadCompleteEvent evt) -> + HexAPI.LOGGER.info(PatternRegistry.getPatternCountInfo())); - evBus.addListener((PlayerInteractEvent.EntityInteract evt) -> { - var res = BrainsweepingEvents.interactWithBrainswept( - evt.getEntity(), evt.getLevel(), evt.getHand(), evt.getTarget(), null); - if (res.consumesAction()) { - evt.setCanceled(true); - evt.setCancellationResult(res); - } - }); - evBus.addListener((LivingConversionEvent.Post evt) -> - BrainsweepingEvents.copyBrainsweepPostTransformation(evt.getEntity(), evt.getOutcome())); + evBus.addListener((PlayerInteractEvent.EntityInteract evt) -> { + var res = BrainsweepingEvents.interactWithBrainswept( + evt.getEntity(), evt.getLevel(), evt.getHand(), evt.getTarget(), null); + if (res.consumesAction()) { + evt.setCanceled(true); + evt.setCancellationResult(res); + } + }); + evBus.addListener((LivingConversionEvent.Post evt) -> + BrainsweepingEvents.copyBrainsweepPostTransformation(evt.getEntity(), evt.getOutcome())); - evBus.addListener((LivingEvent.LivingTickEvent evt) -> { - OpFlight.INSTANCE.tickDownFlight(evt.getEntity()); - ItemLens.tickLens(evt.getEntity()); - }); + evBus.addListener((LivingEvent.LivingTickEvent evt) -> { + OpFlight.INSTANCE.tickDownFlight(evt.getEntity()); + ItemLens.tickLens(evt.getEntity()); + }); - evBus.addListener((TickEvent.LevelTickEvent evt) -> { - if (evt.phase == TickEvent.Phase.END && evt.level instanceof ServerLevel world) { - PlayerPositionRecorder.updateAllPlayers(world); - } - }); + evBus.addListener((TickEvent.LevelTickEvent evt) -> { + if (evt.phase == TickEvent.Phase.END && evt.level instanceof ServerLevel world) { + PlayerPositionRecorder.updateAllPlayers(world); + } + }); - evBus.addListener((RegisterCommandsEvent evt) -> HexCommands.register(evt.getDispatcher())); + evBus.addListener((RegisterCommandsEvent evt) -> HexCommands.register(evt.getDispatcher())); - evBus.addListener((PlayerEvent.BreakSpeed evt) -> { - var pos = evt.getPosition(); - // tracing the dataflow, this is only empty if someone is calling a deprecated function for the - // break speed. This will probably not ever hapen, but hey! i will never complain about correctness - // enforced at the type level. - if (pos.isEmpty()) { - return; - } - evt.setCanceled(ItemJewelerHammer.shouldFailToBreak(evt.getEntity(), evt.getState(), pos.get())); - }); + evBus.addListener((PlayerEvent.BreakSpeed evt) -> { + var pos = evt.getPosition(); + // tracing the dataflow, this is only empty if someone is calling a deprecated function for the + // break speed. This will probably not ever hapen, but hey! i will never complain about correctness + // enforced at the type level. + if (pos.isEmpty()) { + return; + } + evt.setCanceled(ItemJewelerHammer.shouldFailToBreak(evt.getEntity(), evt.getState(), pos.get())); + }); - evBus.addListener((LootTableLoadEvent evt) -> HexLootHandler.lootLoad( - evt.getName(), - builder -> evt.getTable().addPool(builder.build()))); + evBus.addListener((LootTableLoadEvent evt) -> HexLootHandler.lootLoad( + evt.getName(), + builder -> evt.getTable().addPool(builder.build()))); - // === Events implemented in other ways on Fabric + // === Events implemented in other ways on Fabric - // On Fabric this should be auto-synced - evBus.addListener((PlayerEvent.StartTracking evt) -> { - Entity target = evt.getTarget(); - if (evt.getTarget() instanceof ServerPlayer serverPlayer && - target instanceof Mob mob && IXplatAbstractions.INSTANCE.isBrainswept(mob)) { - ForgePacketHandler.getNetwork() - .send(PacketDistributor.PLAYER.with(() -> serverPlayer), MsgBrainsweepAck.of(mob)); - } - }); + // On Fabric this should be auto-synced + evBus.addListener((PlayerEvent.StartTracking evt) -> { + Entity target = evt.getTarget(); + if (evt.getTarget() instanceof ServerPlayer serverPlayer && + target instanceof Mob mob && IXplatAbstractions.INSTANCE.isBrainswept(mob)) { + ForgePacketHandler.getNetwork() + .send(PacketDistributor.PLAYER.with(() -> serverPlayer), MsgBrainsweepAck.of(mob)); + } + }); - // Implemented with a mixin on Farbc - evBus.addListener((BlockEvent.BlockToolModificationEvent evt) -> { - if (!evt.isSimulated() && evt.getToolAction() == ToolActions.AXE_STRIP) { - BlockState bs = evt.getState(); - var output = HexStrippables.STRIPPABLES.get(bs.getBlock()); - if (output != null) { - evt.setFinalState(output.withPropertiesOf(bs)); - } - } - }); + // Implemented with a mixin on Farbc + evBus.addListener((BlockEvent.BlockToolModificationEvent evt) -> { + if (!evt.isSimulated() && evt.getToolAction() == ToolActions.AXE_STRIP) { + BlockState bs = evt.getState(); + var output = HexStrippables.STRIPPABLES.get(bs.getBlock()); + if (output != null) { + evt.setFinalState(output.withPropertiesOf(bs)); + } + } + }); - // Caps are cardinal components on farbc - modBus.addListener(ForgeCapabilityHandler::registerCaps); - evBus.addGenericListener(ItemStack.class, ForgeCapabilityHandler::attachItemCaps); - evBus.addGenericListener(BlockEntity.class, ForgeCapabilityHandler::attachBlockEntityCaps); - evBus.addGenericListener(Entity.class, ForgeCapabilityHandler::attachEntityCaps); + // Caps are cardinal components on farbc + modBus.addListener(ForgeCapabilityHandler::registerCaps); + evBus.addGenericListener(ItemStack.class, ForgeCapabilityHandler::attachItemCaps); + evBus.addGenericListener(BlockEntity.class, ForgeCapabilityHandler::attachBlockEntityCaps); + evBus.addGenericListener(Entity.class, ForgeCapabilityHandler::attachEntityCaps); - modBus.register(HexForgeDataGenerators.class); - modBus.register(ForgeCapabilityHandler.class); - evBus.register(CapSyncers.class); + modBus.register(HexForgeDataGenerators.class); + modBus.register(ForgeCapabilityHandler.class); + evBus.register(CapSyncers.class); - if (ModList.get().isLoaded(HexInterop.Forge.CURIOS_API_ID)) { - modBus.addListener(CuriosApiInterop::onInterModEnqueue); - modBus.addListener(CuriosApiInterop::onClientSetup); - DistExecutor.unsafeRunWhenOn(Dist.CLIENT, - () -> () -> modBus.addListener(CuriosRenderers::onLayerRegister)); - } - } + if (ModList.get().isLoaded(HexInterop.Forge.CURIOS_API_ID)) { + modBus.addListener(CuriosApiInterop::onInterModEnqueue); + modBus.addListener(CuriosApiInterop::onClientSetup); + DistExecutor.unsafeRunWhenOn(Dist.CLIENT, + () -> () -> modBus.addListener(CuriosRenderers::onLayerRegister)); + } + } - // aaaauughhg - private static IEventBus getModEventBus() { - return KotlinModLoadingContext.Companion.get().getKEventBus(); - } + // aaaauughhg + private static IEventBus getModEventBus() { + return KotlinModLoadingContext.Companion.get().getKEventBus(); + } } diff --git a/Forge/src/main/java/at/petrak/hexcasting/forge/mixin/ForgeAccessorRegistry.java b/Forge/src/main/java/at/petrak/hexcasting/forge/mixin/ForgeAccessorRegistry.java index 249f0d4e..4f487e91 100644 --- a/Forge/src/main/java/at/petrak/hexcasting/forge/mixin/ForgeAccessorRegistry.java +++ b/Forge/src/main/java/at/petrak/hexcasting/forge/mixin/ForgeAccessorRegistry.java @@ -14,4 +14,10 @@ public interface ForgeAccessorRegistry { Registry.RegistryBootstrap bootstrap) { throw new IllegalStateException(); } + + @Invoker("registerSimple") + static Registry hex$registerSimple(ResourceKey> registryName, + Registry.RegistryBootstrap bootstrap) { + throw new IllegalStateException(); + } } diff --git a/Forge/src/main/java/at/petrak/hexcasting/forge/xplat/ForgeXplatImpl.java b/Forge/src/main/java/at/petrak/hexcasting/forge/xplat/ForgeXplatImpl.java index 4bd6564c..a1037930 100644 --- a/Forge/src/main/java/at/petrak/hexcasting/forge/xplat/ForgeXplatImpl.java +++ b/Forge/src/main/java/at/petrak/hexcasting/forge/xplat/ForgeXplatImpl.java @@ -1,6 +1,7 @@ package at.petrak.hexcasting.forge.xplat; import at.petrak.hexcasting.api.HexAPI; +import at.petrak.hexcasting.api.SpecialHandler; import at.petrak.hexcasting.api.addldata.ADColorizer; import at.petrak.hexcasting.api.addldata.ADHexHolder; import at.petrak.hexcasting.api.addldata.ADIotaHolder; @@ -9,6 +10,7 @@ import at.petrak.hexcasting.api.misc.FrozenColorizer; import at.petrak.hexcasting.api.mod.HexTags; import at.petrak.hexcasting.api.player.FlightAbility; import at.petrak.hexcasting.api.player.Sentinel; +import at.petrak.hexcasting.api.spell.ActionRegistryEntry; import at.petrak.hexcasting.api.spell.casting.CastingContext; import at.petrak.hexcasting.api.spell.casting.CastingHarness; import at.petrak.hexcasting.api.spell.casting.ResolvedPattern; @@ -415,6 +417,14 @@ public class ForgeXplatImpl implements IXplatAbstractions { return namespace; } + private static final Supplier> ACTION_REGISTRY = Suppliers.memoize(() -> + ForgeAccessorRegistry.hex$registerSimple( + ResourceKey.createRegistryKey(modLoc("action")), null) + ); + private static final Supplier> SPECIAL_HANDLER_REGISTRY = Suppliers.memoize(() -> + ForgeAccessorRegistry.hex$registerSimple( + ResourceKey.createRegistryKey(modLoc("special_handler")), null) + ); private static final Supplier>> IOTA_TYPE_REGISTRY = Suppliers.memoize(() -> ForgeAccessorRegistry.hex$registerDefaulted( ResourceKey.createRegistryKey(modLoc("iota_type")), @@ -426,6 +436,16 @@ public class ForgeXplatImpl implements IXplatAbstractions { HexAPI.MOD_ID + ":nothing", registry -> HexEvalSounds.NOTHING) ); + @Override + public Registry getActionRegistry() { + return ACTION_REGISTRY.get(); + } + + @Override + public Registry getSpecialHandlerRegistry() { + return SPECIAL_HANDLER_REGISTRY.get(); + } + @Override public Registry> getIotaTypeRegistry() { return IOTA_TYPE_REGISTRY.get(); From baf74c64cc62f440267a0461fb12d6a0f10547a4 Mon Sep 17 00:00:00 2001 From: "petrak@" Date: Fri, 30 Dec 2022 14:50:50 -0500 Subject: [PATCH 33/95] converting the ersatz registry. this mega sucks --- .../common/lib/hex/HexActionsAndHandlers.java | 453 +++++++++++++++++- 1 file changed, 437 insertions(+), 16 deletions(-) diff --git a/Common/src/main/java/at/petrak/hexcasting/common/lib/hex/HexActionsAndHandlers.java b/Common/src/main/java/at/petrak/hexcasting/common/lib/hex/HexActionsAndHandlers.java index f7c6e880..a926bb93 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/lib/hex/HexActionsAndHandlers.java +++ b/Common/src/main/java/at/petrak/hexcasting/common/lib/hex/HexActionsAndHandlers.java @@ -61,8 +61,445 @@ public class HexActionsAndHandlers { private static final Map ACTION_MAP = new LinkedHashMap<>(); + // In general: + // - CCW is the normal or construction version + // - CW is the special or destruction version + public static final ActionRegistryEntry GET_CASTER = make("get_caster", new ActionRegistryEntry(OpGetCaster.INSTANCE, HexPattern.fromAngles("qaq", HexDir.NORTH_EAST))); + public static final ActionRegistryEntry OpEntityPos = make("entity_pos/eye", + new ActionRegistryEntry(new OpEntityPos(false), HexPattern.fromAngles("aa", HexDir.EAST)); + public static final ActionRegistryEntry OpEntityPos = make("entity_pos/foot", + new ActionRegistryEntry(new OpEntityPos(true), HexPattern.fromAngles("dd", HexDir.NORTH_EAST)); + public static final ActionRegistryEntry OpEntityLook = make("get_entity_look", + new ActionRegistryEntry(OpEntityLook.INSTANCE, HexPattern.fromAngles("wa", HexDir.EAST)); + public static final ActionRegistryEntry OpEntityHeight = make("get_entity_height", + new ActionRegistryEntry(OpEntityHeight.INSTANCE, HexPattern.fromAngles("awq", HexDir.NORTH_EAST)); + public static final ActionRegistryEntry OpEntityVelocity = make("get_entity_velocity", + + // == Getters == + + public static final ActionRegistryEntry RAYCAST = make("raycast", + new ActionRegistryEntry(OpBlockRaycast.INSTANCE, HexPattern.fromAngles("wqaawdd", HexDir.EAST))); + public static final ActionRegistryEntry RAYCAST_AXIS = make("raycast/axis", + new ActionRegistryEntry(OpBlockAxisRaycast.INSTANCE, HexPattern.fromAngles("weddwaa", HexDir.EAST))); + public static final ActionRegistryEntry = RAYCAST_ENTITY = make("raycast/entity", + new ActionRegistryEntry(OpEntityRaycast.INSTANCE, HexPattern.fromAngles("weaqa", HexDir.EAST))); + + // == spell circle getters == + + public static final ActionRegistryEntry CIRCLE$IMPETUS_POST = make("circle/impetus_pos", + new ActionRegistryEntry(OpImpetusPos.INSTANCE, HexPattern.fromAngles("eaqwqae", HexDir.SOUTH_WEST))); + public static final ActionRegistryEntry CIRCLE$IMPETUS_DIR = make("circle/impetus_dir", + new ActionRegistryEntry(OpImpetusDir.INSTANCE, HexPattern.fromAngles("eaqwqaewede", HexDir.SOUTH_WEST))); + public static final ActionRegistryEntry CIRCLE$BOUNDS$MIN = make ("circle/bounds/min", + new ActionRegistryEntry(new OpCircleBounds(false), HexPattern.fromAngles("eaqwqaewdd", HexDir.SOUTH_WEST))); + public static final ActionRegistryEntry CIRCLE$BOUNDS$MAX = make("circle/bounds/max", + new ActionRegistryEntry(new OpCircleBounds(true), HexPattern.fromAngles("aqwqawaaqa", HexDir.WEST))); + + // == Modify Stack == + + public static final ActionRegistryEntry SWAP = make("swap", + new ActionRegistryEntry(new OpTwiddling(2, new int[]{1, 0}), HexPattern.fromAngles("aawdd", HexDir.EAST))); + public static final ActionRegistryEntry ROTATE = make("rotate", + new ActionRegistryEntry(new OpTwiddling(3, new int[]{1, 2, 0}), HexPattern.fromAngles("aaeaa", HexDir.EAST))); + public static final ActionRegistryEntry ROTATE_REVERSE = make("rotate_reverse", + new ActionRegistryEntry(new OpTwiddling(3, new int[]{2, 0, 1}), HexPattern.fromAngles("ddqdd", HexDir.NORTH_EAST))); + public static final ActionRegistryEntry DUPLICATE = make("duplicate", + new ActionRegistryEntry(new OpTwiddling(1, new int[]{0, 0}), HexPattern.fromAngles("aadaa", HexDir.EAST))); + public static final ActionRegistryEntry OVER = make("over", + new ActionRegistryEntry(new OpTwiddling(2, new int[]{0, 1, 0}), HexPattern.fromAngles("aaedd", HexDir.EAST))); + public static final ActionRegistryEntry TUCK = make("tuck", + new ActionRegistryEntry(new OpTwiddling(2, new int[]{1, 0, 1}), HexPattern.fromAngles("ddqaa", HexDir.EAST))); + public static final ActionRegistryEntry 2DUP = make("2dup", + new ActionRegistryEntry(new OpTwiddling(2, new int[]{0, 1, 0, 1}), HexPattern.fromAngles("aadadaaw", HexDir.EAST))); + + public static final ActionRegistryEntry STACK_LEN = make("stack_len", + new ActionRegistryEntry(OpStackSize.INSTANCE, HexPattern.fromAngles("qwaeawqaeaqa", HexDir.NORTH_WEST))); + public static final ActionRegistryEntry DUPLICATE_N = make("duplicate_n", + new ActionRegistryEntry(OpDuplicateN.INSTANCE, HexPattern.fromAngles("aadaadaa", HexDir.EAST))); + public static final ActionRegistryEntry FISHERMAN = make("fisherman", + new ActionRegistryEntry(OpFisherman.INSTANCE, HexPattern.fromAngles("ddad", HexDir.WEST))); + public static final ActionRegistryEntry FISHERMAN$COPY = make("fisherman/copy", + new ActionRegistryEntry(OpFishermanButItCopies.INSTANCE, HexPattern.fromAngles("aada", HexDir.EAST))); + public static final ActionRegistryEntry SWIZZLE = make("swizzle", + new ActionRegistryEntry(OpAlwinfyHasAscendedToABeingOfPureMath.INSTANCE, HexPattern.fromAngles("qaawdde", HexDir.SOUTH_EAST))); + + // == Math == + + public static final ActionRegistryEntry ADD = make("add", + new ActionRegistryEntry(OpAdd.INSTANCE, HexPattern.fromAngles("waaw", HexDir.NORTH_EAST))); + public static final ActionRegistryEntry SUB = make("sub", + new ActionRegistryEntry(OpSub.INSTANCE, HexPattern.fromAngles("wddw", HexDir.NORTH_WEST))); + public static final ActionRegistryEntry MUL_DOT = make("mul_dot", + new ActionRegistryEntry(OpMulDot.INSTANCE, HexPattern.fromAngles("waqaw", HexDir.SOUTH_EAST))); + public static final ActionRegistryEntry DIV_CROSS = make("div_cross", + new ActionRegistryEntry(OpDivCross.INSTANCE, HexPattern.fromAngles("wdedw", HexDir.NORTH_EAST))); + public static final ActionRegistryEntry ABS_LEN = make("abs_len", + new ActionRegistryEntry(OpAbsLen.INSTANCE, HexPattern.fromAngles("wqaqw", HexDir.NORTH_EAST))); + public static final ActionRegistryEntry POW_PROJ = make("pow_proj", + new ActionRegistryEntry(OpPowProj.INSTANCE, HexPattern.fromAngles("wedew", HexDir.NORTH_WEST))); + public static final ActionRegistryEntry FLOOR = make("floor", + new ActionRegistryEntry(OpFloor.INSTANCE, HexPattern.fromAngles("ewq", HexDir.EAST))); + public static final ActionRegistryEntry CEIL = make("ceil", + new ActionRegistryEntry(OpCeil.INSTANCE, HexPattern.fromAngles("qwe", HexDir.EAST))); + + public static final ActionRegistryEntry CONSTRUCT_VEC = make("construct_vec", + new ActionRegistryEntry(OpConstructVec.INSTANCE, HexPattern.fromAngles("eqqqqq", HexDir.EAST))); + public static final ActionRegistryEntry DECONSTRUCT_VEC = make("deconstruct_vec", + new ActionRegistryEntry(OpDeconstructVec.INSTANCE, HexPattern.fromAngles("qeeeee", HexDir.EAST))); + public static final ActionRegistryEntry COERCE_AXIAL = make("coerce_axial", + new ActionRegistryEntry(OpCoerceToAxial.INSTANCE, HexPattern.fromAngles("qqqqqaww", HexDir.NORTH_WEST))); + + // == Logic == + + public static final ActionRegistryEntry AND = make("and", + new ActionRegistryEntry(OpBoolAnd.INSTANCE, HexPattern.fromAngles("wdw", HexDir.NORTH_EAST)); + public static final ActionRegistryEntry OR = make("or", + new ActionRegistryEntry(OpBoolOr.INSTANCE, HexPattern.fromAngles("waw", HexDir.SOUTH_EAST)); + public static final ActionRegistryEntry XOR = make("xor", + new ActionRegistryEntry(OpBoolXor.INSTANCE, HexPattern.fromAngles("dwa", HexDir.NORTH_WEST)); + public static final ActionRegistryEntry GREATER = make("greater", + new ActionRegistryEntry(new OpCompare(false, (a, b) -> a > b), HexPattern.fromAngles("e", HexDir.SOUTH_EAST))); + public static final ActionRegistryEntry LESS = make("less", + new ActionRegistryEntry(new OpCompare(false, (a, b) -> a < b), HexPattern.fromAngles("q", HexDir.SOUTH_WEST))); + public static final ActionRegistryEntry GREATER_EQ = make("greater_eq", + new ActionRegistryEntry(new OpCompare(true, (a, b) -> a >= b), HexPattern.fromAngles("ee", HexDir.SOUTH_EAST))); + public static final ActionRegistryEntry LESS_EQ = make("less_eq", + new ActionRegistryEntry(new OpCompare(true, (a, b) -> a <= b), HexPattern.fromAngles("qq", HexDir.SOUTH_WEST))); + public static final ActionRegistryEntry EQUALS = make("equals", + new ActionRegistryEntry(new OpEquality(false), HexPattern.fromAngles("ad", HexDir.EAST))); + public static final ActionRegistryEntry NOT_EQUALS = make("not_equals", + new ActionRegistryEntry(new OpEquality(true), HexPattern.fromAngles("da", HexDir.EAST))); + public static final ActionRegistryEntry NOT = make("not", + new ActionRegistryEntry(OpBoolNot.INSTANCE, HexPattern.fromAngles("dw", HexDir.NORTH_WEST))); + public static final ActionRegistryEntry BOOL_COERCE = make("bool_coerce", + new ActionRegistryEntry(OpCoerceToBool.INSTANCE, HexPattern.fromAngles("aw", HexDir.NORTH_EAST))); + public static final ActionRegistryEntry IF = make("if", + new ActionRegistryEntry(OpBoolIf.INSTANCE, HexPattern.fromAngles("awdd", HexDir.SOUTH_EAST))); + + public static final ActionRegistryEntry RANDOM = make("random", + new ActionRegistryEntry(OpRandom.INSTANCE, HexPattern.fromAngles("eqqq", HexDir.NORTH_WEST))); + + // == Advanced Math == + + public static final ActionRegistryEntry SIN = make("sin", + new ActionRegistryEntry(OpSin.INSTANCE, HexPattern.fromAngles("qqqqqaa", HexDir.SOUTH_EAST))); + public static final ActionRegistryEntry COS = make("cos", + new ActionRegistryEntry(OpCos.INSTANCE, HexPattern.fromAngles("qqqqqad", HexDir.SOUTH_EAST))); + public static final ActionRegistryEntry TAN = make("tan", + new ActionRegistryEntry(OpTan.INSTANCE, HexPattern.fromAngles("wqqqqqadq", HexDir.SOUTH_WEST))); + public static final ActionRegistryEntry ARCSIN = make("arcsin", + new ActionRegistryEntry(OpArcSin.INSTANCE, HexPattern.fromAngles("ddeeeee", HexDir.SOUTH_EAST))); + public static final ActionRegistryEntry ARCCOS = make("arccos", + new ActionRegistryEntry(OpArcCos.INSTANCE, HexPattern.fromAngles("adeeeee", HexDir.NORTH_EAST))); + public static final ActionRegistryEntry ARCTAN = make("arctan", + new ActionRegistryEntry(OpArcTan.INSTANCE, HexPattern.fromAngles("eadeeeeew", HexDir.NORTH_EAST))); + public static final ActionRegistryEntry LOGARITHM = make("logarithm", + new ActionRegistryEntry(OpLog.INSTANCE, HexPattern.fromAngles("eqaqe", HexDir.NORTH_WEST))); + public static final ActionRegistryEntry MODULO = make("modulo", + new ActionRegistryEntry(OpModulo.INSTANCE, HexPattern.fromAngles("addwaad", HexDir.NORTH_EAST))); + + // == Sets == + + public static final ActionRegistryEntry BIT$AND = make("bit/and", + new ActionRegistryEntry(OpAnd.INSTANCE, HexPattern.fromAngles("wdweaqa", HexDir.NORTH_EAST))); + public static final ActionRegistryEntry BIT$OR = make("bit/or", + new ActionRegistryEntry(OpOr.INSTANCE, HexPattern.fromAngles("waweaqa", HexDir.SOUTH_EAST))); + public static final ActionRegistryEntry BIT$XOR = make("bit/xor", + new ActionRegistryEntry(OpXor.INSTANCE, HexPattern.fromAngles("dwaeaqa", HexDir.NORTH_WEST))); + public static final ActionRegistryEntry BIT$NOT = make("bit/not", + new ActionRegistryEntry(OpNot.INSTANCE, HexPattern.fromAngles("dweaqa", HexDir.NORTH_WEST))); + public static final ActionRegistryEntry BIT$TO_SET = make("bit/to_set", + new ActionRegistryEntry(OpToSet.INSTANCE, HexPattern.fromAngles("aweaqa", HexDir.NORTH_EAST))); + + // == Spells == + + public static final ActionRegistryEntry PRINT = make("print", + new ActionRegistryObject(OpPrint.INSTANCE, HexPattern.fromAngles("de", HexDir.NORTH_EAST))); + public static final ActionRegistryEntry EXPLODE = make("explode", + new ActionRegistryObject(new OpExplode(false), HexPattern.fromAngles("aawaawaa", HexDir.EAST))); + public static final ActionRegistryEntry EXPLODE/FIRE = make("explode/fire", + new ActionRegistryObject(new OpExplode(true), HexPattern.fromAngles("ddwddwdd", HexDir.EAST))); + public static final ActionRegistryEntry ADD_MOTION = make("add_motion", + new ActionRegistryObject(OpAddMotion.INSTANCE, HexPattern.fromAngles("awqqqwaqw", HexDir.SOUTH_WEST))); + public static final ActionRegistryEntry BLINK = make("blink", + new ActionRegistryObject(OpBlink.INSTANCE, HexPattern.fromAngles("awqqqwaq", HexDir.SOUTH_WEST))); + public static final ActionRegistryEntry BREAK_BLOCK = make("break_block", + new ActionRegistryObject(OpBreakBlock.INSTANCE, HexPattern.fromAngles("qaqqqqq", HexDir.EAST))); + public static final ActionRegistryEntry PLACE_BLOCK = make("place_block", + new ActionRegistryObject(OpPlaceBlock.INSTANCE, HexPattern.fromAngles("eeeeede", HexDir.SOUTH_WEST))); + public static final ActionRegistryEntry COLORIZE = make("colorize", + new ActionRegistryObject(OpColorize.INSTANCE, HexPattern.fromAngles("awddwqawqwawq", HexDir.EAST))); + public static final ActionRegistryEntry CREATE_WATER = make("create_water", + new ActionRegistryObject(new OpCreateFluid(false, MediaConstants.DUST_UNIT, + Items.WATER_BUCKET, + Blocks.WATER_CAULDRON.defaultBlockState() + .setValue(Lnew OpCreateFluid(false, MediaConstants.DUST_UNIT, + Items.WATER_BUCKET, + Blocks.WATER_CAULDRON.defaultBlockState() + .setValue(LayeredCauldronBlock.LEVEL, LayeredCauldronBlock.MAX_FILL_LEVEL), + Fluids.WATER), ayeredCauldronBlock.LEVEL, LayeredCauldronBlock.MAX_FILL_LEVEL), + Fluids.WATER)), HexPattern.fromAngles("aqawqadaq", HexDir.SOUTH_EAST))); + public static final ActionRegistryEntry DESTROY_WATER = make("destroy_water", + new ActionRegistryObject(OpDestroyFluid.INSTANCE, HexPattern.fromAngles("dedwedade", HexDir.SOUTH_WEST))); + public static final ActionRegistryEntry IGNITE = make("ignite", + new ActionRegistryObject(OpIgnite.INSTANCE, HexPattern.fromAngles("aaqawawa", HexDir.SOUTH_EAST))); + public static final ActionRegistryEntry EXTINGUISH = make("extinguish", + new ActionRegistryObject(OpExtinguish.INSTANCE, HexPattern.fromAngles("ddedwdwd", HexDir.SOUTH_WEST))); + public static final ActionRegistryEntry CONJURE_BLOCK = make("conjure_block", + new ActionRegistryObject(OpConjureBlock(false), HexPattern.fromAngles("qqa", HexDir.NORTH_EAST))); + public static final ActionRegistryEntry CONJURE_LIGHT = make("conjure_light", + new ActionRegistryObject(new OpConjureBlock(true), HexPattern.fromAngles("qqd", HexDir.NORTH_EAST))); + public static final ActionRegistryEntry BONEMEAL = make("bonemeal", + new ActionRegistryObject(OpTneOnlyReasonAnyoneDownloadedPsi.INSTANCE, HexPattern.fromAngles("wqaqwawqaqw", HexDir.NORTH_EAST))); + public static final ActionRegistryEntry RECHARGE = make("recharge", + new ActionRegistryObject(OpRecharge.INSTANCE, HexPattern.fromAngles("qqqqqwaeaeaeaeaea", HexDir.NORTH_WEST))); + public static final ActionRegistryEntry ERASE = make("erase", + new ActionRegistryObject(new OpErase(), HexPattern.fromAngles("qdqawwaww", HexDir.EAST), modLoc("erase"))); + public static final ActionRegistryEntry EDIFY = make("edify", + new ActionRegistryObject(OpEdifySapling.INSTANCE, HexPattern.fromAngles("wqaqwd", HexDir.NORTH_EAST), modLoc("edify"))); + + public static final ActionRegistryEntry BEEP = make("beep", + new ActionRegistryObject(OpBeep.INSTANCE, HexPattern.fromAngles("adaa", HexDir.WEST))); + + public static final ActionRegistryEntry CRAFT$CYPHER = make("craft/cypher", new ActionRegistryObject( + new OpMakePackagedSpell<>(HexItems.CYPHER, MediaConstants.CRYSTAL_UNIT), + HexPattern.fromAngles("waqqqqq", HexDir.EAST))); + public static final ActionRegistryEntry CRAFT$TRINKET = make("craft/trinket", new ActionRegistryObject( + new OpMakePackagedSpell<>(HexItems.TRINKET, 5 * MediaConstants.CRYSTAL_UNIT), HexPattern.fromAngles("wwaqqqqqeaqeaeqqqeaeq", HexDir.EAST))); + public static final ActionRegistryEntry CRAFT$ARTIFACT = make("craft/artifact", new ActionRegistryObject( + new OpMakePackagedSpell<>(HexItems.ARTIFACT, 10 * MediaConstants.CRYSTAL_UNIT), + HexPattern.fromAngles("wwaqqqqqeawqwqwqwqwqwwqqeadaeqqeqqeadaeqq", HexDir.EAST))); + public static final ActionRegistryEntry CRAFT$BATTERY = make("craft/battery", new ActionRegistryObject( + OpMakeBattery.INSTANCE, HexPattern.fromAngles("aqqqaqwwaqqqqqeqaqqqawwqwqwqwqwqw", HexDir.SOUTH_WEST))); + + public static final ActionRegistryEntry POTION$WEAKNESS = make("potion/weakness", new ActionRegistryEntry( + new OpPotionEffect(MobEffects.WEAKNESS, MediaConstants.DUST_UNIT / 10, true, false, false), + HexPattern.fromAngles("qqqqqaqwawaw", HexDir.NORTH_WEST))); + public static final ActionRegistryEntry POTION$LEVITATION = make("potion/levitation", new ActionRegistryEntry( + new OpPotionEffect(MobEffects.LEVITATION, MediaConstants.DUST_UNIT / 5, false, false, false), + HexPattern.fromAngles("qqqqqawwawawd", HexDir.WEST))); + public static final ActionRegistryEntry POTION$WITHER = make("potion/wither", new ActionRegistryEntry( + new OpPotionEffect(MobEffects.WITHER, MediaConstants.DUST_UNIT, true, false, false), + HexPattern.fromAngles("qqqqqaewawawe", HexDir.SOUTH_WEST))); + public static final ActionRegistryEntry POTION$POISON = make("potion/poison", new ActionRegistryEntry( + new OpPotionEffect(MobEffects.POISON, MediaConstants.DUST_UNIT / 3, true, false, false), + HexPattern.fromAngles("qqqqqadwawaww", HexDir.SOUTH_EAST))); + public static final ActionRegistryEntry POTION$SLOWNESS = make("potion/slowness", new ActionRegistryEntry( + new OpPotionEffect(MobEffects.MOVEMENT_SLOWDOWN, MediaConstants.DUST_UNIT / 3, true, false, false), + HexPattern.fromAngles("qqqqqadwawaw", HexDir.SOUTH_EAST))); + + public static final ActionRegistryEntry POTION$REGENERATION = make("potion/regeneration", new ActionRegistryEntry( + new OpPotionEffect(new OpPotionEffect(MobEffects.REGENERATION, MediaConstants.DUST_UNIT, true, true, true), + HexPattern.fromAngles("qqqqaawawaedd", HexDir.NORTH_WEST))); + public static final ActionRegistryEntry POTION$NIGHT_VISION = make("potion/night_vision", new ActionRegistryEntry( + new OpPotionEffect(new OpPotionEffect(MobEffects.NIGHT_VISION, MediaConstants.DUST_UNIT / 5, false, true, true), + HexPattern.fromAngles("qqqaawawaeqdd", HexDir.WEST))); + public static final ActionRegistryEntry POTION$ABSORPTION = make("potion/absorption", new ActionRegistryEntry( + new OpPotionEffect(new OpPotionEffect(MobEffects.ABSORPTION, MediaConstants.DUST_UNIT, true, true, true), + HexPattern.fromAngles("qqaawawaeqqdd", HexDir.SOUTH_WEST))); + public static final ActionRegistryEntry POTION$HASTE = make("potion/haste", new ActionRegistryEntry( + new OpPotionEffect(new OpPotionEffect(MobEffects.DIG_SPEED, MediaConstants.DUST_UNIT / 3, true, true, true), + HexPattern.fromAngles("qaawawaeqqqdd", HexDir.SOUTH_EAST))); + public static final ActionRegistryEntry POTION$STRENGTH = make("potion/strength", new ActionRegistryEntry( + new OpPotionEffect(new OpPotionEffect(MobEffects.DAMAGE_BOOST, MediaConstants.DUST_UNIT / 3, true, true, true), + HexPattern.fromAngles("aawawaeqqqqdd", HexDir.EAST))); + + public static final ActionRegistryEntry SENTINEL$CREATE = make("sentinel/create", + new ActionRegistryEntry(new OpCreateSentinel(false), HexPattern.fromAngles("waeawae", HexDir.EAST))); + public static final ActionRegistryEntry SENTINEL$DESTROY = make("sentinel/destroy", + new ActionRegistryEntry(OpDestroySentinel.INSTANCE, HexPattern.fromAngles("qdwdqdw", HexDir.NORTH_EAST))); + public static final ActionRegistryEntry SENTINEL$GET_POS = make("sentinel/get_pos", + new ActionRegistryEntry(OpGetSentinelPos.INSTANCE, HexPattern.fromAngles("waeawaede", HexDir.EAST))); + public static final ActionRegistryEntry SENTINEL$WAYFIND = make("sentinel/wayfind", + new ActionRegistryEntry(OpGetSentinelWayfind.INSTANCE, HexPattern.fromAngles("waeawaedwa", HexDir.EAST))); + + public static final ActionRegistryEntry LIGHTNING = make("lightning", + new ActionRegistryEntry(OpLightning.INSTANCE, HexPattern.fromAngles("waadwawdaaweewq", HexDir.EAST))); + public static final ActionRegistryEntry FLIGHT = make("flight", + new ActionRegistryEntry(OpFlight.INSTANCE, HexPattern.fromAngles("eawwaeawawaa", HexDir.NORTH_WEST))); + public static final ActionRegistryEntry CREATE_LAVA = make("create_lava", + new ActionRegistryEntry(new OpCreateFluid(true, MediaConstants.CRYSTAL_UNIT, + Items.LAVA_BUCKET, + Blocks.LAVA_CAULDRON.defaultBlockState(), + Fluids.LAVA), HexPattern.fromAngles("eaqawqadaqd", HexDir.EAST))); + public static final ActionRegistryEntry TELEPORT = make("teleport", + new ActionRegistryEntry(OpTeleport.INSTANCE, HexPattern.fromAngles("wwwqqqwwwqqeqqwwwqqwqqdqqqqqdqq", HexDir.EAST))); + public static final ActionRegistryEntry SENTINEL$GREAT = make("sentinel/create/great", + new ActionRegistryEntry(new OpCreateSentinel(true), HexPattern.fromAngles("waeawaeqqqwqwqqwq", HexDir.EAST))); + public static final ActionRegistryEntry DISPEL_RAIN = make("dispel_rain", + new ActionRegistryEntry(new OpWeather(false), HexPattern.fromAngles("eeewwweeewwaqqddqdqd", HexDir.EAST))); + public static final ActionRegistryEntry SUMMON_RAIN = make("summon_rain", + new ActionRegistryEntry(OpWeather(true), HexPattern.fromAngles("wwweeewwweewdawdwad", HexDir.WEST))); + public static final ActionRegistryEntry BRAINSWEEP = make("brainsweep", + new ActionRegistryEntry(OpBrainsweep.INSTANCE, HexPattern.fromAngles("qeqwqwqwqwqeqaeqeaqeqaeqaqded", HexDir.NORTH_EAST))); + + public static final ActionRegistryEntry AKASHIC$READ= make("akashic/read", + new ActionRegistryEntry(OpAkashicRead.INSTANCE, HexPattern.fromAngles("qqqwqqqqqaq", HexDir.WEST)); + public static final ActionRegistryEntry AKASHIC$WRITE= make("akashic/write", + new ActionRegistryEntry(OpAkashicWrite.INSTANCE, HexPattern.fromAngles("eeeweeeeede", HexDir.EAST)); + + // == Meta stuff == + + // Intro/Retro/Consideration are now special-form-likes and aren't even ops. + // TODO should there be a registry for these too + + // http://www.toroidalsnark.net/mkss3-pix/CalderheadJMM2014.pdf + // eval being a space filling curve feels apt doesn't it + public static final ActionRegistryEntry (HexPattern.fromAngles("deaqq", HexDir.SOUTH_EAST), modLoc("eval"), + OpEval.INSTANCE); + public static final ActionRegistryEntry (HexPattern.fromAngles("aqdee", HexDir.SOUTH_WEST), modLoc("halt"), + OpHalt.INSTANCE); + + public static final ActionRegistryEntry (HexPattern.fromAngles("aqqqqq", HexDir.EAST), modLoc("read"), + OpRead.INSTANCE); + public static final ActionRegistryEntry (HexPattern.fromAngles("wawqwqwqwqwqw", HexDir.EAST), + modLoc("read/entity"), OpTheCoolerRead.INSTANCE); + public static final ActionRegistryEntry (HexPattern.fromAngles("deeeee", HexDir.EAST), modLoc("write"), + OpWrite.INSTANCE); + public static final ActionRegistryEntry (HexPattern.fromAngles("wdwewewewewew", HexDir.EAST), + modLoc("write/entity"), OpTheCoolerWrite.INSTANCE); + public static final ActionRegistryEntry (HexPattern.fromAngles("aqqqqqe", HexDir.EAST), modLoc("readable"), + OpReadable.INSTANCE); + public static final ActionRegistryEntry (HexPattern.fromAngles("wawqwqwqwqwqwew", HexDir.EAST), + modLoc("readable/entity"), OpTheCoolerReadable.INSTANCE); + public static final ActionRegistryEntry (HexPattern.fromAngles("deeeeeq", HexDir.EAST), modLoc("writable"), + OpWritable.INSTANCE); + public static final ActionRegistryEntry (HexPattern.fromAngles("wdwewewewewewqw", HexDir.EAST), + modLoc("writable/entity"), OpTheCoolerWritable.INSTANCE); + + // lorge boyes + + + public static final ActionRegistryEntry (HexPattern.fromAngles("qeewdweddw", HexDir.NORTH_EAST), + modLoc("read/local"), OpPeekLocal.INSTANCE); + public static final ActionRegistryEntry (HexPattern.fromAngles("eqqwawqaaw", HexDir.NORTH_WEST), + modLoc("write/local"), OpPushLocal.INSTANCE); + + // == Consts == + + public static final ActionRegistryEntry (HexPattern.fromAngles("d", HexDir.EAST), modLoc("const/null"), + Action.makeConstantOp(new NullIota())); + + public static final ActionRegistryEntry (HexPattern.fromAngles("aqae", HexDir.SOUTH_EAST), modLoc("const/true"), + Action.makeConstantOp(new BooleanIota(true))); + public static final ActionRegistryEntry (HexPattern.fromAngles("dedq", HexDir.NORTH_EAST), modLoc("const/false"), + Action.makeConstantOp(new BooleanIota(false))); + + public static final ActionRegistryEntry (HexPattern.fromAngles("qqqqqea", HexDir.NORTH_WEST), modLoc("const/vec/px"), + Action.makeConstantOp(new Vec3Iota(new Vec3(1.0, 0.0, 0.0)))); + public static final ActionRegistryEntry (HexPattern.fromAngles("qqqqqew", HexDir.NORTH_WEST), modLoc("const/vec/py"), + Action.makeConstantOp(new Vec3Iota(new Vec3(0.0, 1.0, 0.0)))); + public static final ActionRegistryEntry (HexPattern.fromAngles("qqqqqed", HexDir.NORTH_WEST), modLoc("const/vec/pz"), + Action.makeConstantOp(new Vec3Iota(new Vec3(0.0, 0.0, 1.0)))); + public static final ActionRegistryEntry (HexPattern.fromAngles("eeeeeqa", HexDir.SOUTH_WEST), modLoc("const/vec/nx"), + Action.makeConstantOp(new Vec3Iota(new Vec3(-1.0, 0.0, 0.0)))); + public static final ActionRegistryEntry (HexPattern.fromAngles("eeeeeqw", HexDir.SOUTH_WEST), modLoc("const/vec/ny"), + Action.makeConstantOp(new Vec3Iota(new Vec3(0.0, -1.0, 0.0)))); + public static final ActionRegistryEntry (HexPattern.fromAngles("eeeeeqd", HexDir.SOUTH_WEST), modLoc("const/vec/nz"), + Action.makeConstantOp(new Vec3Iota(new Vec3(0.0, 0.0, -1.0)))); + // Yep, this is what I spend the "plain hexagon" pattern on. + public static final ActionRegistryEntry (HexPattern.fromAngles("qqqqq", HexDir.NORTH_WEST), modLoc("const/vec/0"), + Action.makeConstantOp(new Vec3Iota(new Vec3(0.0, 0.0, 0.0)))); + + public static final ActionRegistryEntry (HexPattern.fromAngles("qdwdq", HexDir.NORTH_EAST), modLoc("const/double/pi"), + Action.makeConstantOp(new DoubleIota(Math.PI))); + public static final ActionRegistryEntry (HexPattern.fromAngles("eawae", HexDir.NORTH_WEST), modLoc("const/double/tau"), + Action.makeConstantOp(new DoubleIota(HexUtils.TAU))); + + // e + public static final ActionRegistryEntry (HexPattern.fromAngles("aaq", HexDir.EAST), modLoc("const/double/e"), + Action.makeConstantOp(new DoubleIota(Math.E))); + + // == Entities == + + public static final ActionRegistryEntry (HexPattern.fromAngles("qqqqqdaqa", HexDir.SOUTH_EAST), modLoc("get_entity"), + new OpGetEntityAt(e -> true)); + public static final ActionRegistryEntry (HexPattern.fromAngles("qqqqqdaqaawa", HexDir.SOUTH_EAST), + modLoc("get_entity/animal"), + new OpGetEntityAt(OpGetEntitiesBy::isAnimal)); + public static final ActionRegistryEntry (HexPattern.fromAngles("qqqqqdaqaawq", HexDir.SOUTH_EAST), + modLoc("get_entity/monster"), + new OpGetEntityAt(OpGetEntitiesBy::isMonster)); + public static final ActionRegistryEntry (HexPattern.fromAngles("qqqqqdaqaaww", HexDir.SOUTH_EAST), + modLoc("get_entity/item"), + new OpGetEntityAt(OpGetEntitiesBy::isItem)); + public static final ActionRegistryEntry (HexPattern.fromAngles("qqqqqdaqaawe", HexDir.SOUTH_EAST), + modLoc("get_entity/player"), + new OpGetEntityAt(OpGetEntitiesBy::isPlayer)); + public static final ActionRegistryEntry (HexPattern.fromAngles("qqqqqdaqaawd", HexDir.SOUTH_EAST), + modLoc("get_entity/living"), + new OpGetEntityAt(OpGetEntitiesBy::isLiving)); + + public static final ActionRegistryEntry (HexPattern.fromAngles("qqqqqwded", HexDir.SOUTH_EAST), modLoc("zone_entity"), + new OpGetEntitiesBy(e -> true, false)); + public static final ActionRegistryEntry (HexPattern.fromAngles("qqqqqwdeddwa", HexDir.SOUTH_EAST), + modLoc("zone_entity/animal"), + new OpGetEntitiesBy(OpGetEntitiesBy::isAnimal, false)); + public static final ActionRegistryEntry (HexPattern.fromAngles("eeeeewaqaawa", HexDir.NORTH_EAST), + modLoc("zone_entity/not_animal"), + new OpGetEntitiesBy(OpGetEntitiesBy::isAnimal, true)); + public static final ActionRegistryEntry (HexPattern.fromAngles("qqqqqwdeddwq", HexDir.SOUTH_EAST), + modLoc("zone_entity/monster"), + new OpGetEntitiesBy(OpGetEntitiesBy::isMonster, false)); + public static final ActionRegistryEntry (HexPattern.fromAngles("eeeeewaqaawq", HexDir.NORTH_EAST), + modLoc("zone_entity/not_monster"), + new OpGetEntitiesBy(OpGetEntitiesBy::isMonster, true)); + public static final ActionRegistryEntry (HexPattern.fromAngles("qqqqqwdeddww", HexDir.SOUTH_EAST), + modLoc("zone_entity/item"), + new OpGetEntitiesBy(OpGetEntitiesBy::isItem, false)); + public static final ActionRegistryEntry (HexPattern.fromAngles("eeeeewaqaaww", HexDir.NORTH_EAST), + modLoc("zone_entity/not_item"), + new OpGetEntitiesBy(OpGetEntitiesBy::isItem, true)); + public static final ActionRegistryEntry (HexPattern.fromAngles("qqqqqwdeddwe", HexDir.SOUTH_EAST), + modLoc("zone_entity/player"), + new OpGetEntitiesBy(OpGetEntitiesBy::isPlayer, false)); + public static final ActionRegistryEntry (HexPattern.fromAngles("eeeeewaqaawe", HexDir.NORTH_EAST), + modLoc("zone_entity/not_player"), + new OpGetEntitiesBy(OpGetEntitiesBy::isPlayer, true)); + public static final ActionRegistryEntry (HexPattern.fromAngles("qqqqqwdeddwd", HexDir.SOUTH_EAST), + modLoc("zone_entity/living"), + new OpGetEntitiesBy(OpGetEntitiesBy::isLiving, false)); + public static final ActionRegistryEntry (HexPattern.fromAngles("eeeeewaqaawd", HexDir.NORTH_EAST), + modLoc("zone_entity/not_living"), + new OpGetEntitiesBy(OpGetEntitiesBy::isLiving, true)); + + // == Lists == + + public static final ActionRegistryEntry (HexPattern.fromAngles("edqde", HexDir.SOUTH_WEST), modLoc("append"), + OpAppend.INSTANCE); + public static final ActionRegistryEntry (HexPattern.fromAngles("qaeaq", HexDir.NORTH_WEST), modLoc("concat"), + OpConcat.INSTANCE); + public static final ActionRegistryEntry (HexPattern.fromAngles("deeed", HexDir.NORTH_WEST), modLoc("index"), + OpIndex.INSTANCE); + public static final ActionRegistryEntry (HexPattern.fromAngles("dadad", HexDir.NORTH_EAST), modLoc("for_each"), + OpForEach.INSTANCE); + public static final ActionRegistryEntry (HexPattern.fromAngles("aqaeaq", HexDir.EAST), modLoc("list_size"), + OpListSize.INSTANCE); + public static final ActionRegistryEntry (HexPattern.fromAngles("adeeed", HexDir.EAST), modLoc("singleton"), + OpSingleton.INSTANCE); + public static final ActionRegistryEntry (HexPattern.fromAngles("qqaeaae", HexDir.NORTH_EAST), modLoc("empty_list"), + OpEmptyList.INSTANCE); + public static final ActionRegistryEntry (HexPattern.fromAngles("qqqaede", HexDir.EAST), modLoc("reverse_list"), + OpReverski.INSTANCE); + public static final ActionRegistryEntry (HexPattern.fromAngles("ewdqdwe", HexDir.SOUTH_WEST), modLoc("last_n_list"), + OpLastNToList.INSTANCE); + public static final ActionRegistryEntry (HexPattern.fromAngles("qwaeawq", HexDir.NORTH_WEST), modLoc("splat"), + OpSplat.INSTANCE); + public static final ActionRegistryEntry (HexPattern.fromAngles("dedqde", HexDir.EAST), modLoc("index_of"), + OpIndexOf.INSTANCE); + public static final ActionRegistryEntry (HexPattern.fromAngles("edqdewaqa", HexDir.SOUTH_WEST), modLoc("list_remove"), + OpRemove.INSTANCE); + public static final ActionRegistryEntry (HexPattern.fromAngles("qaeaqwded", HexDir.NORTH_WEST), modLoc("slice"), + OpSlice.INSTANCE); + public static final ActionRegistryEntry (HexPattern.fromAngles("wqaeaqw", HexDir.NORTH_WEST), + modLoc("modify_in_place"), + OpModifyInPlace.INSTANCE); + public static final ActionRegistryEntry (HexPattern.fromAngles("ddewedd", HexDir.SOUTH_EAST), modLoc("construct"), + OpCons.INSTANCE); + public static final ActionRegistryEntry (HexPattern.fromAngles("aaqwqaa", HexDir.SOUTH_WEST), modLoc("deconstruct"), + OpUnCons.INSTANCE); private static ActionRegistryEntry make(String name, ActionRegistryEntry are) { var old = ACTION_MAP.put(modLoc(name), are); @@ -75,24 +512,8 @@ public class HexActionsAndHandlers { // I guess this means the client will have a big empty map for patterns public static void registerPatterns() { try { - // In general: - // - CCW is the normal or construction version - // - CW is the special or destruction version // == Getters == - PatternRegistry.mapPattern(HexPattern.fromAngles("qaq", HexDir.NORTH_EAST), modLoc("get_caster"), - OpGetCaster.INSTANCE); - PatternRegistry.mapPattern(HexPattern.fromAngles("aa", HexDir.EAST), modLoc("entity_pos/eye"), - new OpEntityPos(false)); - PatternRegistry.mapPattern(HexPattern.fromAngles("dd", HexDir.NORTH_EAST), modLoc("entity_pos/foot"), - new OpEntityPos(true)); - PatternRegistry.mapPattern(HexPattern.fromAngles("wa", HexDir.EAST), modLoc("get_entity_look"), - OpEntityLook.INSTANCE); - PatternRegistry.mapPattern(HexPattern.fromAngles("awq", HexDir.NORTH_EAST), modLoc("get_entity_height"), - OpEntityHeight.INSTANCE); - PatternRegistry.mapPattern(HexPattern.fromAngles("wq", HexDir.EAST), modLoc("get_entity_velocity"), - OpEntityVelocity.INSTANCE); - PatternRegistry.mapPattern(HexPattern.fromAngles("wqaawdd", HexDir.EAST), modLoc("raycast"), OpBlockRaycast.INSTANCE); PatternRegistry.mapPattern(HexPattern.fromAngles("weddwaa", HexDir.EAST), modLoc("raycast/axis"), From 7748cf7387a1c19777d61d1a09b70cd7a370c761 Mon Sep 17 00:00:00 2001 From: "petrak@" Date: Fri, 30 Dec 2022 17:00:52 -0500 Subject: [PATCH 34/95] that sucked --- .../api/spell/ActionRegistryEntry.java | 4 +- .../casting/operators/spells/OpErase.kt | 6 +- .../hexcasting/common/lib/hex/HexActions.java | 553 +++++++++ .../common/lib/hex/HexActionsAndHandlers.java | 1017 ----------------- .../hexcasting/fabric/FabricHexInitializer.kt | 4 +- .../hexcasting/forge/ForgeHexInitializer.java | 4 +- 6 files changed, 562 insertions(+), 1026 deletions(-) create mode 100644 Common/src/main/java/at/petrak/hexcasting/common/lib/hex/HexActions.java delete mode 100644 Common/src/main/java/at/petrak/hexcasting/common/lib/hex/HexActionsAndHandlers.java diff --git a/Common/src/main/java/at/petrak/hexcasting/api/spell/ActionRegistryEntry.java b/Common/src/main/java/at/petrak/hexcasting/api/spell/ActionRegistryEntry.java index f8d77343..2b540857 100644 --- a/Common/src/main/java/at/petrak/hexcasting/api/spell/ActionRegistryEntry.java +++ b/Common/src/main/java/at/petrak/hexcasting/api/spell/ActionRegistryEntry.java @@ -5,10 +5,10 @@ import at.petrak.hexcasting.api.spell.math.HexPattern; /** * A bit of wrapper information around an action to go in the registry. * - * @param action The action itself * @param prototype The pattern associated with this action. The start dir acts as the "canonical" start direction * for display in the book. For per-world patterns, the angle signature is the *shape* of the pattern * but probably not the pattern itself. + * @param action The action itself */ -public record ActionRegistryEntry(Action action, HexPattern prototype) { +public record ActionRegistryEntry(HexPattern prototype, Action action) { } diff --git a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/spells/OpErase.kt b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/spells/OpErase.kt index abd540a3..b7eea8cf 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/spells/OpErase.kt +++ b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/spells/OpErase.kt @@ -1,16 +1,16 @@ package at.petrak.hexcasting.common.casting.operators.spells import at.petrak.hexcasting.api.misc.MediaConstants -import at.petrak.hexcasting.api.spell.iota.Iota 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 at.petrak.hexcasting.api.spell.mishaps.MishapBadOffhandItem import at.petrak.hexcasting.xplat.IXplatAbstractions import net.minecraft.world.item.ItemStack -class OpErase : SpellAction { +object OpErase : SpellAction { override val argc = 0 override fun execute( @@ -22,7 +22,7 @@ class OpErase : SpellAction { val datumHolder = IXplatAbstractions.INSTANCE.findDataHolder(it) (hexHolder?.hasHex() == true) || - (datumHolder?.writeIota(null, true) == true) + (datumHolder?.writeIota(null, true) == true) } val hexHolder = IXplatAbstractions.INSTANCE.findHexHolder(handStack) val datumHolder = IXplatAbstractions.INSTANCE.findDataHolder(handStack) 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 new file mode 100644 index 00000000..f3ff1ee6 --- /dev/null +++ b/Common/src/main/java/at/petrak/hexcasting/common/lib/hex/HexActions.java @@ -0,0 +1,553 @@ +package at.petrak.hexcasting.common.lib.hex; + +import at.petrak.hexcasting.api.misc.MediaConstants; +import at.petrak.hexcasting.api.spell.Action; +import at.petrak.hexcasting.api.spell.ActionRegistryEntry; +import at.petrak.hexcasting.api.spell.iota.BooleanIota; +import at.petrak.hexcasting.api.spell.iota.DoubleIota; +import at.petrak.hexcasting.api.spell.iota.NullIota; +import at.petrak.hexcasting.api.spell.iota.Vec3Iota; +import at.petrak.hexcasting.api.spell.math.HexDir; +import at.petrak.hexcasting.api.spell.math.HexPattern; +import at.petrak.hexcasting.api.utils.HexUtils; +import at.petrak.hexcasting.common.casting.operators.*; +import at.petrak.hexcasting.common.casting.operators.akashic.OpAkashicRead; +import at.petrak.hexcasting.common.casting.operators.akashic.OpAkashicWrite; +import at.petrak.hexcasting.common.casting.operators.circles.OpCircleBounds; +import at.petrak.hexcasting.common.casting.operators.circles.OpImpetusDir; +import at.petrak.hexcasting.common.casting.operators.circles.OpImpetusPos; +import at.petrak.hexcasting.common.casting.operators.eval.OpEval; +import at.petrak.hexcasting.common.casting.operators.eval.OpForEach; +import at.petrak.hexcasting.common.casting.operators.lists.*; +import at.petrak.hexcasting.common.casting.operators.local.OpPeekLocal; +import at.petrak.hexcasting.common.casting.operators.local.OpPushLocal; +import at.petrak.hexcasting.common.casting.operators.math.*; +import at.petrak.hexcasting.common.casting.operators.math.bit.*; +import at.petrak.hexcasting.common.casting.operators.math.logic.*; +import at.petrak.hexcasting.common.casting.operators.math.trig.*; +import at.petrak.hexcasting.common.casting.operators.rw.*; +import at.petrak.hexcasting.common.casting.operators.selectors.OpGetCaster; +import at.petrak.hexcasting.common.casting.operators.selectors.OpGetEntitiesBy; +import at.petrak.hexcasting.common.casting.operators.selectors.OpGetEntityAt; +import at.petrak.hexcasting.common.casting.operators.spells.*; +import at.petrak.hexcasting.common.casting.operators.spells.great.*; +import at.petrak.hexcasting.common.casting.operators.spells.sentinel.OpCreateSentinel; +import at.petrak.hexcasting.common.casting.operators.spells.sentinel.OpDestroySentinel; +import at.petrak.hexcasting.common.casting.operators.spells.sentinel.OpGetSentinelPos; +import at.petrak.hexcasting.common.casting.operators.spells.sentinel.OpGetSentinelWayfind; +import at.petrak.hexcasting.common.casting.operators.stack.*; +import at.petrak.hexcasting.common.lib.HexItems; +import at.petrak.hexcasting.xplat.IXplatAbstractions; +import net.minecraft.core.Registry; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.world.effect.MobEffects; +import net.minecraft.world.item.Items; +import net.minecraft.world.level.block.Blocks; +import net.minecraft.world.level.block.LayeredCauldronBlock; +import net.minecraft.world.level.material.Fluids; +import net.minecraft.world.phys.Vec3; + +import java.util.LinkedHashMap; +import java.util.Map; +import java.util.function.BiConsumer; + +import static at.petrak.hexcasting.api.HexAPI.modLoc; + +@SuppressWarnings("unused") +public class HexActions { + public static final Registry REGISTRY = IXplatAbstractions.INSTANCE.getActionRegistry(); + + private static final Map ACTIONS = new LinkedHashMap<>(); + + // In general: + // - CCW is the normal or construction version + // - CW is the special or destruction version + + public static final ActionRegistryEntry GET_CASTER = make("get_caster", + new ActionRegistryEntry(HexPattern.fromAngles("qaq", HexDir.NORTH_EAST), OpGetCaster.INSTANCE)); + public static final ActionRegistryEntry ENTITY_POS$EYE = make("entity_pos/eye", + new ActionRegistryEntry(HexPattern.fromAngles("aa", HexDir.EAST), new OpEntityPos(false))); + public static final ActionRegistryEntry ENTITY_POS$FOOT = make("entity_pos/foot", + new ActionRegistryEntry(HexPattern.fromAngles("dd", HexDir.NORTH_EAST), new OpEntityPos(true))); + public static final ActionRegistryEntry ENTITY_LOOK = make("get_entity_look", + new ActionRegistryEntry(HexPattern.fromAngles("wa", HexDir.EAST), OpEntityLook.INSTANCE)); + public static final ActionRegistryEntry ENTITY_HEIGHT = make("get_entity_height", + new ActionRegistryEntry(HexPattern.fromAngles("awq", HexDir.NORTH_EAST), OpEntityHeight.INSTANCE)); + public static final ActionRegistryEntry ENTITY_VELOCITY = make("get_entity_velocity", + new ActionRegistryEntry(HexPattern.fromAngles("wq", HexDir.EAST), OpEntityVelocity.INSTANCE)); + + // == Getters == + + public static final ActionRegistryEntry RAYCAST = make("raycast", + new ActionRegistryEntry(HexPattern.fromAngles("wqaawdd", HexDir.EAST), OpBlockRaycast.INSTANCE)); + public static final ActionRegistryEntry RAYCAST_AXIS = make("raycast/axis", + new ActionRegistryEntry(HexPattern.fromAngles("weddwaa", HexDir.EAST), OpBlockAxisRaycast.INSTANCE)); + public static final ActionRegistryEntry RAYCAST_ENTITY = make("raycast/entity", + new ActionRegistryEntry(HexPattern.fromAngles("weaqa", HexDir.EAST), OpEntityRaycast.INSTANCE)); + + // == spell circle getters == + + public static final ActionRegistryEntry CIRCLE$IMPETUS_POST = make("circle/impetus_pos", + new ActionRegistryEntry(HexPattern.fromAngles("eaqwqae", HexDir.SOUTH_WEST), OpImpetusPos.INSTANCE)); + public static final ActionRegistryEntry CIRCLE$IMPETUS_DIR = make("circle/impetus_dir", + new ActionRegistryEntry(HexPattern.fromAngles("eaqwqaewede", HexDir.SOUTH_WEST), OpImpetusDir.INSTANCE)); + public static final ActionRegistryEntry CIRCLE$BOUNDS$MIN = make("circle/bounds/min", + new ActionRegistryEntry(HexPattern.fromAngles("eaqwqaewdd", HexDir.SOUTH_WEST), new OpCircleBounds(false))); + public static final ActionRegistryEntry CIRCLE$BOUNDS$MAX = make("circle/bounds/max", + new ActionRegistryEntry(HexPattern.fromAngles("aqwqawaaqa", HexDir.WEST), new OpCircleBounds(true))); + + // == Modify Stack == + + public static final ActionRegistryEntry SWAP = make("swap", + new ActionRegistryEntry(HexPattern.fromAngles("aawdd", HexDir.EAST), new OpTwiddling(2, new int[]{1, 0}))); + public static final ActionRegistryEntry ROTATE = make("rotate", + new ActionRegistryEntry(HexPattern.fromAngles("aaeaa", HexDir.EAST), new OpTwiddling(3, new int[]{1, 2, 0}))); + public static final ActionRegistryEntry ROTATE_REVERSE = make("rotate_reverse", + new ActionRegistryEntry(HexPattern.fromAngles("ddqdd", + HexDir.NORTH_EAST), new OpTwiddling(3, new int[]{2, 0, 1}))); + public static final ActionRegistryEntry DUPLICATE = make("duplicate", + new ActionRegistryEntry(HexPattern.fromAngles("aadaa", HexDir.EAST), new OpTwiddling(1, new int[]{0, 0}))); + public static final ActionRegistryEntry OVER = make("over", + new ActionRegistryEntry(HexPattern.fromAngles("aaedd", HexDir.EAST), new OpTwiddling(2, new int[]{0, 1, 0}))); + public static final ActionRegistryEntry TUCK = make("tuck", + new ActionRegistryEntry(HexPattern.fromAngles("ddqaa", HexDir.EAST), new OpTwiddling(2, new int[]{1, 0, 1}))); + public static final ActionRegistryEntry TWO_DUP = make("2dup", + new ActionRegistryEntry(HexPattern.fromAngles("aadadaaw", + HexDir.EAST), new OpTwiddling(2, new int[]{0, 1, 0, 1}))); + + public static final ActionRegistryEntry STACK_LEN = make("stack_len", + new ActionRegistryEntry(HexPattern.fromAngles("qwaeawqaeaqa", HexDir.NORTH_WEST), OpStackSize.INSTANCE)); + public static final ActionRegistryEntry DUPLICATE_N = make("duplicate_n", + new ActionRegistryEntry(HexPattern.fromAngles("aadaadaa", HexDir.EAST), OpDuplicateN.INSTANCE)); + public static final ActionRegistryEntry FISHERMAN = make("fisherman", + new ActionRegistryEntry(HexPattern.fromAngles("ddad", HexDir.WEST), OpFisherman.INSTANCE)); + public static final ActionRegistryEntry FISHERMAN$COPY = make("fisherman/copy", + new ActionRegistryEntry(HexPattern.fromAngles("aada", HexDir.EAST), OpFishermanButItCopies.INSTANCE)); + public static final ActionRegistryEntry SWIZZLE = make("swizzle", + new ActionRegistryEntry(HexPattern.fromAngles("qaawdde", + HexDir.SOUTH_EAST), OpAlwinfyHasAscendedToABeingOfPureMath.INSTANCE)); + + // == Math == + + public static final ActionRegistryEntry ADD = make("add", + new ActionRegistryEntry(HexPattern.fromAngles("waaw", HexDir.NORTH_EAST), OpAdd.INSTANCE)); + public static final ActionRegistryEntry SUB = make("sub", + new ActionRegistryEntry(HexPattern.fromAngles("wddw", HexDir.NORTH_WEST), OpSub.INSTANCE)); + public static final ActionRegistryEntry MUL_DOT = make("mul_dot", + new ActionRegistryEntry(HexPattern.fromAngles("waqaw", HexDir.SOUTH_EAST), OpMulDot.INSTANCE)); + public static final ActionRegistryEntry DIV_CROSS = make("div_cross", + new ActionRegistryEntry(HexPattern.fromAngles("wdedw", HexDir.NORTH_EAST), OpDivCross.INSTANCE)); + public static final ActionRegistryEntry ABS_LEN = make("abs_len", + new ActionRegistryEntry(HexPattern.fromAngles("wqaqw", HexDir.NORTH_EAST), OpAbsLen.INSTANCE)); + public static final ActionRegistryEntry POW_PROJ = make("pow_proj", + new ActionRegistryEntry(HexPattern.fromAngles("wedew", HexDir.NORTH_WEST), OpPowProj.INSTANCE)); + public static final ActionRegistryEntry FLOOR = make("floor", + new ActionRegistryEntry(HexPattern.fromAngles("ewq", HexDir.EAST), OpFloor.INSTANCE)); + public static final ActionRegistryEntry CEIL = make("ceil", + new ActionRegistryEntry(HexPattern.fromAngles("qwe", HexDir.EAST), OpCeil.INSTANCE)); + + public static final ActionRegistryEntry CONSTRUCT_VEC = make("construct_vec", + new ActionRegistryEntry(HexPattern.fromAngles("eqqqqq", HexDir.EAST), OpConstructVec.INSTANCE)); + public static final ActionRegistryEntry DECONSTRUCT_VEC = make("deconstruct_vec", + new ActionRegistryEntry(HexPattern.fromAngles("qeeeee", HexDir.EAST), OpDeconstructVec.INSTANCE)); + public static final ActionRegistryEntry COERCE_AXIAL = make("coerce_axial", + new ActionRegistryEntry(HexPattern.fromAngles("qqqqqaww", HexDir.NORTH_WEST), OpCoerceToAxial.INSTANCE)); + + // == Logic == + + public static final ActionRegistryEntry AND = make("and", + new ActionRegistryEntry(HexPattern.fromAngles("wdw", HexDir.NORTH_EAST), OpBoolAnd.INSTANCE)); + public static final ActionRegistryEntry OR = make("or", + new ActionRegistryEntry(HexPattern.fromAngles("waw", HexDir.SOUTH_EAST), OpBoolOr.INSTANCE)); + public static final ActionRegistryEntry XOR = make("xor", + new ActionRegistryEntry(HexPattern.fromAngles("dwa", HexDir.NORTH_WEST), OpBoolXor.INSTANCE)); + public static final ActionRegistryEntry GREATER = make("greater", new ActionRegistryEntry( + HexPattern.fromAngles("e", HexDir.SOUTH_EAST), new OpCompare(false, (a, b) -> a > b) + )); + public static final ActionRegistryEntry LESS = make("less", new ActionRegistryEntry( + HexPattern.fromAngles("q", HexDir.SOUTH_WEST), new OpCompare(false, (a, b) -> a < b) + )); + public static final ActionRegistryEntry GREATER_EQ = make("greater_eq", new ActionRegistryEntry( + HexPattern.fromAngles("ee", HexDir.SOUTH_EAST), new OpCompare(true, (a, b) -> a >= b) + )); + public static final ActionRegistryEntry LESS_EQ = make("less_eq", new ActionRegistryEntry( + HexPattern.fromAngles("qq", HexDir.SOUTH_WEST), new OpCompare(true, (a, b) -> a <= b) + )); + public static final ActionRegistryEntry EQUALS = make("equals", + new ActionRegistryEntry(HexPattern.fromAngles("ad", HexDir.EAST), new OpEquality(false))); + public static final ActionRegistryEntry NOT_EQUALS = make("not_equals", + new ActionRegistryEntry(HexPattern.fromAngles("da", HexDir.EAST), new OpEquality(true))); + public static final ActionRegistryEntry NOT = make("not", + new ActionRegistryEntry(HexPattern.fromAngles("dw", HexDir.NORTH_WEST), OpBoolNot.INSTANCE)); + public static final ActionRegistryEntry BOOL_COERCE = make("bool_coerce", + new ActionRegistryEntry(HexPattern.fromAngles("aw", HexDir.NORTH_EAST), OpCoerceToBool.INSTANCE)); + public static final ActionRegistryEntry IF = make("if", + new ActionRegistryEntry(HexPattern.fromAngles("awdd", HexDir.SOUTH_EAST), OpBoolIf.INSTANCE)); + + public static final ActionRegistryEntry RANDOM = make("random", + new ActionRegistryEntry(HexPattern.fromAngles("eqqq", HexDir.NORTH_WEST), OpRandom.INSTANCE)); + + // == Advanced Math == + + public static final ActionRegistryEntry SIN = make("sin", + new ActionRegistryEntry(HexPattern.fromAngles("qqqqqaa", HexDir.SOUTH_EAST), OpSin.INSTANCE)); + public static final ActionRegistryEntry COS = make("cos", + new ActionRegistryEntry(HexPattern.fromAngles("qqqqqad", HexDir.SOUTH_EAST), OpCos.INSTANCE)); + public static final ActionRegistryEntry TAN = make("tan", + new ActionRegistryEntry(HexPattern.fromAngles("wqqqqqadq", HexDir.SOUTH_WEST), OpTan.INSTANCE)); + public static final ActionRegistryEntry ARCSIN = make("arcsin", + new ActionRegistryEntry(HexPattern.fromAngles("ddeeeee", HexDir.SOUTH_EAST), OpArcSin.INSTANCE)); + public static final ActionRegistryEntry ARCCOS = make("arccos", + new ActionRegistryEntry(HexPattern.fromAngles("adeeeee", HexDir.NORTH_EAST), OpArcCos.INSTANCE)); + public static final ActionRegistryEntry ARCTAN = make("arctan", + new ActionRegistryEntry(HexPattern.fromAngles("eadeeeeew", HexDir.NORTH_EAST), OpArcTan.INSTANCE)); + public static final ActionRegistryEntry LOGARITHM = make("logarithm", + new ActionRegistryEntry(HexPattern.fromAngles("eqaqe", HexDir.NORTH_WEST), OpLog.INSTANCE)); + public static final ActionRegistryEntry MODULO = make("modulo", + new ActionRegistryEntry(HexPattern.fromAngles("addwaad", HexDir.NORTH_EAST), OpModulo.INSTANCE)); + + // == Sets == + + public static final ActionRegistryEntry BIT$AND = make("bit/and", + new ActionRegistryEntry(HexPattern.fromAngles("wdweaqa", HexDir.NORTH_EAST), OpAnd.INSTANCE)); + public static final ActionRegistryEntry BIT$OR = make("bit/or", + new ActionRegistryEntry(HexPattern.fromAngles("waweaqa", HexDir.SOUTH_EAST), OpOr.INSTANCE)); + public static final ActionRegistryEntry BIT$XOR = make("bit/xor", + new ActionRegistryEntry(HexPattern.fromAngles("dwaeaqa", HexDir.NORTH_WEST), OpXor.INSTANCE)); + public static final ActionRegistryEntry BIT$NOT = make("bit/not", + new ActionRegistryEntry(HexPattern.fromAngles("dweaqa", HexDir.NORTH_WEST), OpNot.INSTANCE)); + public static final ActionRegistryEntry BIT$TO_SET = make("bit/to_set", + new ActionRegistryEntry(HexPattern.fromAngles("aweaqa", HexDir.NORTH_EAST), OpToSet.INSTANCE)); + + // == Spells == + + public static final ActionRegistryEntry PRINT = make("print", + new ActionRegistryEntry(HexPattern.fromAngles("de", HexDir.NORTH_EAST), OpPrint.INSTANCE)); + public static final ActionRegistryEntry EXPLODE = make("explode", + new ActionRegistryEntry(HexPattern.fromAngles("aawaawaa", HexDir.EAST), new OpExplode(false))); + public static final ActionRegistryEntry EXPLODE$FIRE = make("explode/fire", + new ActionRegistryEntry(HexPattern.fromAngles("ddwddwdd", HexDir.EAST), new OpExplode(true))); + public static final ActionRegistryEntry ADD_MOTION = make("add_motion", + new ActionRegistryEntry(HexPattern.fromAngles("awqqqwaqw", HexDir.SOUTH_WEST), OpAddMotion.INSTANCE)); + public static final ActionRegistryEntry BLINK = make("blink", + new ActionRegistryEntry(HexPattern.fromAngles("awqqqwaq", HexDir.SOUTH_WEST), OpBlink.INSTANCE)); + public static final ActionRegistryEntry BREAK_BLOCK = make("break_block", + new ActionRegistryEntry(HexPattern.fromAngles("qaqqqqq", HexDir.EAST), OpBreakBlock.INSTANCE)); + public static final ActionRegistryEntry PLACE_BLOCK = make("place_block", + new ActionRegistryEntry(HexPattern.fromAngles("eeeeede", HexDir.SOUTH_WEST), OpPlaceBlock.INSTANCE)); + 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, + MediaConstants.DUST_UNIT, + Items.WATER_BUCKET, + Blocks.WATER_CAULDRON.defaultBlockState() + .setValue(LayeredCauldronBlock.LEVEL, LayeredCauldronBlock.MAX_FILL_LEVEL), + Fluids.WATER))); + public static final ActionRegistryEntry DESTROY_WATER = make("destroy_water", + new ActionRegistryEntry(HexPattern.fromAngles("dedwedade", HexDir.SOUTH_WEST), OpDestroyFluid.INSTANCE)); + public static final ActionRegistryEntry IGNITE = make("ignite", + new ActionRegistryEntry(HexPattern.fromAngles("aaqawawa", HexDir.SOUTH_EAST), OpIgnite.INSTANCE)); + public static final ActionRegistryEntry EXTINGUISH = make("extinguish", + new ActionRegistryEntry(HexPattern.fromAngles("ddedwdwd", HexDir.SOUTH_WEST), OpExtinguish.INSTANCE)); + public static final ActionRegistryEntry CONJURE_BLOCK = make("conjure_block", + new ActionRegistryEntry(HexPattern.fromAngles("qqa", HexDir.NORTH_EAST), new OpConjureBlock(false))); + public static final ActionRegistryEntry CONJURE_LIGHT = make("conjure_light", + new ActionRegistryEntry(HexPattern.fromAngles("qqd", HexDir.NORTH_EAST), new OpConjureBlock(true))); + public static final ActionRegistryEntry BONEMEAL = make("bonemeal", + new ActionRegistryEntry(HexPattern.fromAngles("wqaqwawqaqw", + HexDir.NORTH_EAST), OpTheOnlyReasonAnyoneDownloadedPsi.INSTANCE)); + public static final ActionRegistryEntry RECHARGE = make("recharge", + new ActionRegistryEntry(HexPattern.fromAngles("qqqqqwaeaeaeaeaea", HexDir.NORTH_WEST), OpRecharge.INSTANCE)); + public static final ActionRegistryEntry ERASE = make("erase", + new ActionRegistryEntry(HexPattern.fromAngles("qdqawwaww", HexDir.EAST), OpErase.INSTANCE)); + public static final ActionRegistryEntry EDIFY = make("edify", + new ActionRegistryEntry(HexPattern.fromAngles("wqaqwd", HexDir.NORTH_EAST), OpEdifySapling.INSTANCE)); + + public static final ActionRegistryEntry BEEP = make("beep", + new ActionRegistryEntry(HexPattern.fromAngles("adaa", HexDir.WEST), OpBeep.INSTANCE)); + + public static final ActionRegistryEntry CRAFT$CYPHER = make("craft/cypher", new ActionRegistryEntry( + HexPattern.fromAngles("waqqqqq", HexDir.EAST), new OpMakePackagedSpell<>(HexItems.CYPHER, + MediaConstants.CRYSTAL_UNIT) + )); + public static final ActionRegistryEntry CRAFT$TRINKET = make("craft/trinket", new ActionRegistryEntry( + HexPattern.fromAngles( + "wwaqqqqqeaqeaeqqqeaeq", HexDir.EAST), new OpMakePackagedSpell<>(HexItems.TRINKET, + 5 * MediaConstants.CRYSTAL_UNIT))); + public static final ActionRegistryEntry CRAFT$ARTIFACT = make("craft/artifact", new ActionRegistryEntry( + HexPattern.fromAngles("wwaqqqqqeawqwqwqwqwqwwqqeadaeqqeqqeadaeqq", HexDir.EAST), + new OpMakePackagedSpell<>(HexItems.ARTIFACT, 10 * MediaConstants.CRYSTAL_UNIT) + )); + public static final ActionRegistryEntry CRAFT$BATTERY = make("craft/battery", new ActionRegistryEntry( + HexPattern.fromAngles("aqqqaqwwaqqqqqeqaqqqawwqwqwqwqwqw", HexDir.SOUTH_WEST), OpMakeBattery.INSTANCE)); + + 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) + )); + 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) + )); + 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) + )); + 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) + )); + 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) + )); + + 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) + )); + 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) + )); + 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) + )); + 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) + )); + 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) + )); + + public static final ActionRegistryEntry SENTINEL$CREATE = make("sentinel/create", + new ActionRegistryEntry(HexPattern.fromAngles("waeawae", HexDir.EAST), new OpCreateSentinel(false))); + public static final ActionRegistryEntry SENTINEL$DESTROY = make("sentinel/destroy", + new ActionRegistryEntry(HexPattern.fromAngles("qdwdqdw", HexDir.NORTH_EAST), OpDestroySentinel.INSTANCE)); + public static final ActionRegistryEntry SENTINEL$GET_POS = make("sentinel/get_pos", + new ActionRegistryEntry(HexPattern.fromAngles("waeawaede", HexDir.EAST), OpGetSentinelPos.INSTANCE)); + public static final ActionRegistryEntry SENTINEL$WAYFIND = make("sentinel/wayfind", + new ActionRegistryEntry(HexPattern.fromAngles("waeawaedwa", HexDir.EAST), OpGetSentinelWayfind.INSTANCE)); + + public static final ActionRegistryEntry LIGHTNING = make("lightning", + new ActionRegistryEntry(HexPattern.fromAngles("waadwawdaaweewq", HexDir.EAST), OpLightning.INSTANCE)); + 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, + MediaConstants.CRYSTAL_UNIT, + Items.LAVA_BUCKET, + Blocks.LAVA_CAULDRON.defaultBlockState(), + Fluids.LAVA))); + public static final ActionRegistryEntry TELEPORT = make("teleport", + new ActionRegistryEntry(HexPattern.fromAngles("wwwqqqwwwqqeqqwwwqqwqqdqqqqqdqq", + HexDir.EAST), OpTeleport.INSTANCE)); + public static final ActionRegistryEntry SENTINEL$GREAT = make("sentinel/create/great", + new ActionRegistryEntry(HexPattern.fromAngles("waeawaeqqqwqwqqwq", HexDir.EAST), new OpCreateSentinel(true))); + public static final ActionRegistryEntry DISPEL_RAIN = make("dispel_rain", + new ActionRegistryEntry(HexPattern.fromAngles("eeewwweeewwaqqddqdqd", HexDir.EAST), new OpWeather(false))); + public static final ActionRegistryEntry SUMMON_RAIN = make("summon_rain", + new ActionRegistryEntry(HexPattern.fromAngles("wwweeewwweewdawdwad", HexDir.WEST), new OpWeather(true))); + public static final ActionRegistryEntry BRAINSWEEP = make("brainsweep", + new ActionRegistryEntry(HexPattern.fromAngles("qeqwqwqwqwqeqaeqeaqeqaeqaqded", + HexDir.NORTH_EAST), OpBrainsweep.INSTANCE)); + + public static final ActionRegistryEntry AKASHIC$READ = make("akashic/read", + new ActionRegistryEntry(HexPattern.fromAngles("qqqwqqqqqaq", HexDir.WEST), OpAkashicRead.INSTANCE)); + public static final ActionRegistryEntry AKASHIC$WRITE = make("akashic/write", + new ActionRegistryEntry(HexPattern.fromAngles("eeeweeeeede", HexDir.EAST), OpAkashicWrite.INSTANCE)); + + // == Meta stuff == + + // Intro/Retro/Consideration are now special-form-likes and aren't even ops. + // TODO should there be a registry for these too + + // http://www.toroidalsnark.net/mkss3-pix/CalderheadJMM2014.pdf + // eval being a space filling curve feels apt doesn't it + public static final ActionRegistryEntry EVAL = make("eval", + new ActionRegistryEntry(HexPattern.fromAngles("deaqq", HexDir.SOUTH_EAST), OpEval.INSTANCE)); + // TODO: install Iris' gambit + + public static final ActionRegistryEntry READ = make("read", + new ActionRegistryEntry(HexPattern.fromAngles("aqqqqq", HexDir.EAST), OpRead.INSTANCE)); + public static final ActionRegistryEntry READ$ENTITY = make("read/entity", + new ActionRegistryEntry(HexPattern.fromAngles("wawqwqwqwqwqw", HexDir.EAST), OpTheCoolerRead.INSTANCE)); + public static final ActionRegistryEntry WRITE = make("write", + new ActionRegistryEntry(HexPattern.fromAngles("deeeee", HexDir.EAST), OpWrite.INSTANCE)); + public static final ActionRegistryEntry WRITE$ENTITY = make("write/entity", + new ActionRegistryEntry(HexPattern.fromAngles("wdwewewewewew", HexDir.EAST), OpTheCoolerWrite.INSTANCE)); + public static final ActionRegistryEntry READABLE = make("readable", + new ActionRegistryEntry(HexPattern.fromAngles("aqqqqqe", HexDir.EAST), OpReadable.INSTANCE)); + public static final ActionRegistryEntry READABLE$ENTITY = make("readable/entity", + new ActionRegistryEntry(HexPattern.fromAngles("wawqwqwqwqwqwew", HexDir.EAST), OpTheCoolerReadable.INSTANCE)); + public static final ActionRegistryEntry WRITABLE = make("writable", + new ActionRegistryEntry(HexPattern.fromAngles("deeeeeq", HexDir.EAST), OpWritable.INSTANCE)); + public static final ActionRegistryEntry WRITABLE$ENTITY = make("writable/entity", + new ActionRegistryEntry(HexPattern.fromAngles("wdwewewewewewqw", HexDir.EAST), OpTheCoolerWritable.INSTANCE)); + + public static final ActionRegistryEntry READ$LOCAL = make("read/local", + new ActionRegistryEntry(HexPattern.fromAngles("qeewdweddw", HexDir.NORTH_EAST), OpPeekLocal.INSTANCE)); + public static final ActionRegistryEntry WRITE$LOCAL = make("write/local", + new ActionRegistryEntry(HexPattern.fromAngles("eqqwawqaaw", HexDir.NORTH_WEST), OpPushLocal.INSTANCE)); + + // == Consts == + + public static final ActionRegistryEntry CONST$NULL = make("const/null", + new ActionRegistryEntry(HexPattern.fromAngles("d", HexDir.EAST), Action.makeConstantOp(new NullIota()))); + + public static final ActionRegistryEntry CONST$TRUE = make("const/true", + new ActionRegistryEntry(HexPattern.fromAngles("aqae", + HexDir.SOUTH_EAST), Action.makeConstantOp(new BooleanIota(true)))); + public static final ActionRegistryEntry CONST$FALSE = make("const/false", + new ActionRegistryEntry(HexPattern.fromAngles("dedq", + HexDir.NORTH_EAST), Action.makeConstantOp(new BooleanIota(false)))); + + public static final ActionRegistryEntry CONST$VEC$PX = make("const/vec/px", + new ActionRegistryEntry(HexPattern.fromAngles( + "qqqqqea", HexDir.NORTH_WEST), Action.makeConstantOp(new Vec3Iota(new Vec3(1.0, 0.0, 0.0))))); + public static final ActionRegistryEntry CONST$VEC$PY = make("const/vec/py", + new ActionRegistryEntry(HexPattern.fromAngles( + "qqqqqew", HexDir.NORTH_WEST), Action.makeConstantOp(new Vec3Iota(new Vec3(0.0, 1.0, 0.0))))); + public static final ActionRegistryEntry CONST$VEC$PZ = make("const/vec/pz", + new ActionRegistryEntry(HexPattern.fromAngles( + "qqqqqed", HexDir.NORTH_WEST), Action.makeConstantOp(new Vec3Iota(new Vec3(0.0, 0.0, 1.0))))); + public static final ActionRegistryEntry CONST$VEC$NX = make("const/vec/nx", + new ActionRegistryEntry(HexPattern.fromAngles( + "eeeeeqa", HexDir.SOUTH_WEST), Action.makeConstantOp(new Vec3Iota(new Vec3(-1.0, 0.0, 0.0))))); + public static final ActionRegistryEntry CONST$VEC$NY = make("const/vec/ny", + new ActionRegistryEntry(HexPattern.fromAngles( + "eeeeeqw", HexDir.SOUTH_WEST), Action.makeConstantOp(new Vec3Iota(new Vec3(0.0, -1.0, 0.0))))); + public static final ActionRegistryEntry CONST$VEC$NZ = make("const/vec/nz", + new ActionRegistryEntry(HexPattern.fromAngles( + "eeeeeqd", HexDir.SOUTH_WEST), Action.makeConstantOp(new Vec3Iota(new Vec3(0.0, 0.0, -1.0))))); + // Yep, this is what I spend the "plain hexagon" pattern on. + public static final ActionRegistryEntry CONST$VEC$0 = make("const/vec/0", + new ActionRegistryEntry(HexPattern.fromAngles( + "qqqqq", HexDir.NORTH_WEST), Action.makeConstantOp(new Vec3Iota(new Vec3(0.0, 0.0, 0.0))))); + + public static final ActionRegistryEntry CONST$DOUBLE$PI = make("const/double/pi", + new ActionRegistryEntry(HexPattern.fromAngles("qdwdq", + HexDir.NORTH_EAST), Action.makeConstantOp(new DoubleIota(Math.PI)))); + public static final ActionRegistryEntry CONST$DOUBLE$TAU = make("const/double/tau", + new ActionRegistryEntry(HexPattern.fromAngles("eawae", + HexDir.NORTH_WEST), Action.makeConstantOp(new DoubleIota(HexUtils.TAU)))); + public static final ActionRegistryEntry CONST$E = make("const/double/e", + new ActionRegistryEntry(HexPattern.fromAngles("aaq", + HexDir.EAST), Action.makeConstantOp(new DoubleIota(Math.E)))); + + // == Entities == + + public static final ActionRegistryEntry GET_ENTITY = make("get_entity", + new ActionRegistryEntry(HexPattern.fromAngles("qqqqqdaqa", HexDir.SOUTH_EAST), new OpGetEntityAt(e -> true))); + public static final ActionRegistryEntry GET_ENTITY$ANIMAL = make("get_entity/animal", + new ActionRegistryEntry(HexPattern.fromAngles("qqqqqdaqaawa", + HexDir.SOUTH_EAST), new OpGetEntityAt(OpGetEntitiesBy::isAnimal))); + public static final ActionRegistryEntry GET_ENTITY$MONSTER = make("get_entity/monster", + new ActionRegistryEntry(HexPattern.fromAngles("qqqqqdaqaawq", + HexDir.SOUTH_EAST), new OpGetEntityAt(OpGetEntitiesBy::isMonster))); + public static final ActionRegistryEntry GET_ENTITY$ITEM = make("get_entity/item", + new ActionRegistryEntry(HexPattern.fromAngles("qqqqqdaqaaww", + HexDir.SOUTH_EAST), new OpGetEntityAt(OpGetEntitiesBy::isItem))); + public static final ActionRegistryEntry GET_ENTITY$PLAYER = make("get_entity/player", + new ActionRegistryEntry(HexPattern.fromAngles("qqqqqdaqaawe", + HexDir.SOUTH_EAST), new OpGetEntityAt(OpGetEntitiesBy::isPlayer))); + public static final ActionRegistryEntry GET_ENTITY$LIVING = make("get_entity/living", + new ActionRegistryEntry(HexPattern.fromAngles("qqqqqdaqaawd", + HexDir.SOUTH_EAST), new OpGetEntityAt(OpGetEntitiesBy::isLiving))); + + public static final ActionRegistryEntry ZONE_ENTITY = make("zone_entity", new ActionRegistryEntry( + HexPattern.fromAngles("qqqqqwded", HexDir.SOUTH_EAST), new OpGetEntitiesBy(e -> true, false) + )); + public static final ActionRegistryEntry ZONE_ENTITY$ANIMAL = make("zone_entity/animal", new ActionRegistryEntry( + HexPattern.fromAngles("qqqqqwdeddwa", HexDir.SOUTH_EAST), new OpGetEntitiesBy(OpGetEntitiesBy::isAnimal, false) + )); + public static final ActionRegistryEntry ZONE_ENTITY$NOT_ANIMAL = make("zone_entity/not_animal", + new ActionRegistryEntry( + HexPattern.fromAngles("eeeeewaqaawa", HexDir.NORTH_EAST), new OpGetEntitiesBy(OpGetEntitiesBy::isAnimal, + true) + )); + public static final ActionRegistryEntry ZONE_ENTITY$MONSTER = make("zone_entity/monster", new ActionRegistryEntry( + HexPattern.fromAngles("qqqqqwdeddwq", HexDir.SOUTH_EAST), new OpGetEntitiesBy(OpGetEntitiesBy::isMonster, false) + )); + public static final ActionRegistryEntry ZONE_ENTITY$NOT_MONSTER = make("zone_entity/not_monster", + new ActionRegistryEntry( + HexPattern.fromAngles("eeeeewaqaawq", HexDir.NORTH_EAST), new OpGetEntitiesBy(OpGetEntitiesBy::isMonster, + true) + )); + public static final ActionRegistryEntry ZONE_ENTITY$ITEM = make("zone_entity/item", new ActionRegistryEntry( + HexPattern.fromAngles("qqqqqwdeddww", HexDir.SOUTH_EAST), new OpGetEntitiesBy(OpGetEntitiesBy::isItem, false) + )); + public static final ActionRegistryEntry ZONE_ENTITY$NOT_ITEM = make("zone_entity/not_item", new ActionRegistryEntry( + HexPattern.fromAngles("eeeeewaqaaww", HexDir.NORTH_EAST), new OpGetEntitiesBy(OpGetEntitiesBy::isItem, true) + )); + public static final ActionRegistryEntry ZONE_ENTITY$PLAYER = make("zone_entity/player", new ActionRegistryEntry( + HexPattern.fromAngles("qqqqqwdeddwe", HexDir.SOUTH_EAST), new OpGetEntitiesBy(OpGetEntitiesBy::isPlayer, false) + )); + public static final ActionRegistryEntry ZONE_ENTITY$NOT_PLAYER = make("zone_entity/not_player", + new ActionRegistryEntry( + HexPattern.fromAngles("eeeeewaqaawe", HexDir.NORTH_EAST), new OpGetEntitiesBy(OpGetEntitiesBy::isPlayer, + true) + )); + public static final ActionRegistryEntry ZONE_ENTITY$LIVING = make("zone_entity/living", new ActionRegistryEntry( + HexPattern.fromAngles("qqqqqwdeddwd", HexDir.SOUTH_EAST), new OpGetEntitiesBy(OpGetEntitiesBy::isLiving, false) + )); + public static final ActionRegistryEntry ZONE_ENTITY$NOT_LIVING = make("zone_entity/not_living", + new ActionRegistryEntry( + HexPattern.fromAngles("eeeeewaqaawd", HexDir.NORTH_EAST), new OpGetEntitiesBy(OpGetEntitiesBy::isLiving, + true) + )); + + // == Lists == + + public static final ActionRegistryEntry APPEND = make("append", + new ActionRegistryEntry(HexPattern.fromAngles("edqde", HexDir.SOUTH_WEST), OpAppend.INSTANCE)); + public static final ActionRegistryEntry CONCAT = make("concat", + new ActionRegistryEntry(HexPattern.fromAngles("qaeaq", HexDir.NORTH_WEST), OpConcat.INSTANCE)); + public static final ActionRegistryEntry INDEX = make("index", + new ActionRegistryEntry(HexPattern.fromAngles("deeed", HexDir.NORTH_WEST), OpIndex.INSTANCE)); + public static final ActionRegistryEntry FOR_EACH = make("for_each", + new ActionRegistryEntry(HexPattern.fromAngles("dadad", HexDir.NORTH_EAST), OpForEach.INSTANCE)); + public static final ActionRegistryEntry LIST_SIZE = make("list_size", + new ActionRegistryEntry(HexPattern.fromAngles("aqaeaq", HexDir.EAST), OpListSize.INSTANCE)); + public static final ActionRegistryEntry SINGLETON = make("singleton", + new ActionRegistryEntry(HexPattern.fromAngles("adeeed", HexDir.EAST), OpSingleton.INSTANCE)); + public static final ActionRegistryEntry EMPTY_LIST = make("empty_list", + new ActionRegistryEntry(HexPattern.fromAngles("qqaeaae", HexDir.NORTH_EAST), OpEmptyList.INSTANCE)); + public static final ActionRegistryEntry REVERSE_LIST = make("reverse_list", + new ActionRegistryEntry(HexPattern.fromAngles("qqqaede", HexDir.EAST), OpReverski.INSTANCE)); + public static final ActionRegistryEntry LAST_N_LIST = make("last_n_list", + new ActionRegistryEntry(HexPattern.fromAngles("ewdqdwe", HexDir.SOUTH_WEST), OpLastNToList.INSTANCE)); + public static final ActionRegistryEntry SPLAT = make("splat", + new ActionRegistryEntry(HexPattern.fromAngles("qwaeawq", HexDir.NORTH_WEST), OpSplat.INSTANCE)); + public static final ActionRegistryEntry INDEX_OF = make("index_of", + new ActionRegistryEntry(HexPattern.fromAngles("dedqde", HexDir.EAST), OpIndexOf.INSTANCE)); + public static final ActionRegistryEntry LIST_REMOVE = make("list_remove", + new ActionRegistryEntry(HexPattern.fromAngles("edqdewaqa", HexDir.SOUTH_WEST), OpRemove.INSTANCE)); + public static final ActionRegistryEntry SLICE = make("slice", + new ActionRegistryEntry(HexPattern.fromAngles("qaeaqwded", HexDir.NORTH_WEST), OpSlice.INSTANCE)); + public static final ActionRegistryEntry MODIFY_IN_PLACE = make("modify_in_place", + new ActionRegistryEntry(HexPattern.fromAngles("wqaeaqw", HexDir.NORTH_WEST), OpModifyInPlace.INSTANCE)); + public static final ActionRegistryEntry CONSTRUCT = make("construct", + new ActionRegistryEntry(HexPattern.fromAngles("ddewedd", HexDir.SOUTH_EAST), OpCons.INSTANCE)); + public static final ActionRegistryEntry DECONSTRUCT = make("deconstruct", + new ActionRegistryEntry(HexPattern.fromAngles("aaqwqaa", HexDir.SOUTH_WEST), OpUnCons.INSTANCE)); + + private static ActionRegistryEntry make(String name, ActionRegistryEntry are) { + var old = ACTIONS.put(modLoc(name), are); + if (old != null) { + throw new IllegalArgumentException("Typo? Duplicate id " + name); + } + return are; + } + + public static void register() { + BiConsumer r = (type, id) -> Registry.register(REGISTRY, id, type); + for (var e : ACTIONS.entrySet()) { + r.accept(e.getValue(), e.getKey()); + } + } +} diff --git a/Common/src/main/java/at/petrak/hexcasting/common/lib/hex/HexActionsAndHandlers.java b/Common/src/main/java/at/petrak/hexcasting/common/lib/hex/HexActionsAndHandlers.java deleted file mode 100644 index a926bb93..00000000 --- a/Common/src/main/java/at/petrak/hexcasting/common/lib/hex/HexActionsAndHandlers.java +++ /dev/null @@ -1,1017 +0,0 @@ -package at.petrak.hexcasting.common.lib.hex; - -import at.petrak.hexcasting.api.PatternRegistry; -import at.petrak.hexcasting.api.misc.MediaConstants; -import at.petrak.hexcasting.api.spell.Action; -import at.petrak.hexcasting.api.spell.ActionRegistryEntry; -import at.petrak.hexcasting.api.spell.iota.BooleanIota; -import at.petrak.hexcasting.api.spell.iota.DoubleIota; -import at.petrak.hexcasting.api.spell.iota.NullIota; -import at.petrak.hexcasting.api.spell.iota.Vec3Iota; -import at.petrak.hexcasting.api.spell.math.HexAngle; -import at.petrak.hexcasting.api.spell.math.HexDir; -import at.petrak.hexcasting.api.spell.math.HexPattern; -import at.petrak.hexcasting.api.utils.HexUtils; -import at.petrak.hexcasting.common.casting.operators.*; -import at.petrak.hexcasting.common.casting.operators.akashic.OpAkashicRead; -import at.petrak.hexcasting.common.casting.operators.akashic.OpAkashicWrite; -import at.petrak.hexcasting.common.casting.operators.circles.OpCircleBounds; -import at.petrak.hexcasting.common.casting.operators.circles.OpImpetusDir; -import at.petrak.hexcasting.common.casting.operators.circles.OpImpetusPos; -import at.petrak.hexcasting.common.casting.operators.eval.OpEval; -import at.petrak.hexcasting.common.casting.operators.eval.OpForEach; -import at.petrak.hexcasting.common.casting.operators.eval.OpHalt; -import at.petrak.hexcasting.common.casting.operators.lists.*; -import at.petrak.hexcasting.common.casting.operators.local.OpPeekLocal; -import at.petrak.hexcasting.common.casting.operators.local.OpPushLocal; -import at.petrak.hexcasting.common.casting.operators.math.*; -import at.petrak.hexcasting.common.casting.operators.math.bit.*; -import at.petrak.hexcasting.common.casting.operators.math.logic.*; -import at.petrak.hexcasting.common.casting.operators.math.trig.*; -import at.petrak.hexcasting.common.casting.operators.rw.*; -import at.petrak.hexcasting.common.casting.operators.selectors.OpGetCaster; -import at.petrak.hexcasting.common.casting.operators.selectors.OpGetEntitiesBy; -import at.petrak.hexcasting.common.casting.operators.selectors.OpGetEntityAt; -import at.petrak.hexcasting.common.casting.operators.spells.*; -import at.petrak.hexcasting.common.casting.operators.spells.great.*; -import at.petrak.hexcasting.common.casting.operators.spells.sentinel.OpCreateSentinel; -import at.petrak.hexcasting.common.casting.operators.spells.sentinel.OpDestroySentinel; -import at.petrak.hexcasting.common.casting.operators.spells.sentinel.OpGetSentinelPos; -import at.petrak.hexcasting.common.casting.operators.spells.sentinel.OpGetSentinelWayfind; -import at.petrak.hexcasting.common.casting.operators.stack.*; -import at.petrak.hexcasting.common.lib.HexItems; -import at.petrak.hexcasting.xplat.IXplatAbstractions; -import it.unimi.dsi.fastutil.booleans.BooleanArrayList; -import net.minecraft.core.Registry; -import net.minecraft.resources.ResourceLocation; -import net.minecraft.world.effect.MobEffects; -import net.minecraft.world.item.Items; -import net.minecraft.world.level.block.Blocks; -import net.minecraft.world.level.block.LayeredCauldronBlock; -import net.minecraft.world.level.material.Fluids; -import net.minecraft.world.phys.Vec3; - -import java.util.LinkedHashMap; -import java.util.Map; - -import static at.petrak.hexcasting.api.HexAPI.modLoc; - -public class HexActionsAndHandlers { - public static final Registry ACTIONS = IXplatAbstractions.INSTANCE.getActionRegistry(); - - private static final Map ACTION_MAP = new LinkedHashMap<>(); - - // In general: - // - CCW is the normal or construction version - // - CW is the special or destruction version - - public static final ActionRegistryEntry GET_CASTER = make("get_caster", - new ActionRegistryEntry(OpGetCaster.INSTANCE, HexPattern.fromAngles("qaq", HexDir.NORTH_EAST))); - public static final ActionRegistryEntry OpEntityPos = make("entity_pos/eye", - new ActionRegistryEntry(new OpEntityPos(false), HexPattern.fromAngles("aa", HexDir.EAST)); - public static final ActionRegistryEntry OpEntityPos = make("entity_pos/foot", - new ActionRegistryEntry(new OpEntityPos(true), HexPattern.fromAngles("dd", HexDir.NORTH_EAST)); - public static final ActionRegistryEntry OpEntityLook = make("get_entity_look", - new ActionRegistryEntry(OpEntityLook.INSTANCE, HexPattern.fromAngles("wa", HexDir.EAST)); - public static final ActionRegistryEntry OpEntityHeight = make("get_entity_height", - new ActionRegistryEntry(OpEntityHeight.INSTANCE, HexPattern.fromAngles("awq", HexDir.NORTH_EAST)); - public static final ActionRegistryEntry OpEntityVelocity = make("get_entity_velocity", - - // == Getters == - - public static final ActionRegistryEntry RAYCAST = make("raycast", - new ActionRegistryEntry(OpBlockRaycast.INSTANCE, HexPattern.fromAngles("wqaawdd", HexDir.EAST))); - public static final ActionRegistryEntry RAYCAST_AXIS = make("raycast/axis", - new ActionRegistryEntry(OpBlockAxisRaycast.INSTANCE, HexPattern.fromAngles("weddwaa", HexDir.EAST))); - public static final ActionRegistryEntry = RAYCAST_ENTITY = make("raycast/entity", - new ActionRegistryEntry(OpEntityRaycast.INSTANCE, HexPattern.fromAngles("weaqa", HexDir.EAST))); - - // == spell circle getters == - - public static final ActionRegistryEntry CIRCLE$IMPETUS_POST = make("circle/impetus_pos", - new ActionRegistryEntry(OpImpetusPos.INSTANCE, HexPattern.fromAngles("eaqwqae", HexDir.SOUTH_WEST))); - public static final ActionRegistryEntry CIRCLE$IMPETUS_DIR = make("circle/impetus_dir", - new ActionRegistryEntry(OpImpetusDir.INSTANCE, HexPattern.fromAngles("eaqwqaewede", HexDir.SOUTH_WEST))); - public static final ActionRegistryEntry CIRCLE$BOUNDS$MIN = make ("circle/bounds/min", - new ActionRegistryEntry(new OpCircleBounds(false), HexPattern.fromAngles("eaqwqaewdd", HexDir.SOUTH_WEST))); - public static final ActionRegistryEntry CIRCLE$BOUNDS$MAX = make("circle/bounds/max", - new ActionRegistryEntry(new OpCircleBounds(true), HexPattern.fromAngles("aqwqawaaqa", HexDir.WEST))); - - // == Modify Stack == - - public static final ActionRegistryEntry SWAP = make("swap", - new ActionRegistryEntry(new OpTwiddling(2, new int[]{1, 0}), HexPattern.fromAngles("aawdd", HexDir.EAST))); - public static final ActionRegistryEntry ROTATE = make("rotate", - new ActionRegistryEntry(new OpTwiddling(3, new int[]{1, 2, 0}), HexPattern.fromAngles("aaeaa", HexDir.EAST))); - public static final ActionRegistryEntry ROTATE_REVERSE = make("rotate_reverse", - new ActionRegistryEntry(new OpTwiddling(3, new int[]{2, 0, 1}), HexPattern.fromAngles("ddqdd", HexDir.NORTH_EAST))); - public static final ActionRegistryEntry DUPLICATE = make("duplicate", - new ActionRegistryEntry(new OpTwiddling(1, new int[]{0, 0}), HexPattern.fromAngles("aadaa", HexDir.EAST))); - public static final ActionRegistryEntry OVER = make("over", - new ActionRegistryEntry(new OpTwiddling(2, new int[]{0, 1, 0}), HexPattern.fromAngles("aaedd", HexDir.EAST))); - public static final ActionRegistryEntry TUCK = make("tuck", - new ActionRegistryEntry(new OpTwiddling(2, new int[]{1, 0, 1}), HexPattern.fromAngles("ddqaa", HexDir.EAST))); - public static final ActionRegistryEntry 2DUP = make("2dup", - new ActionRegistryEntry(new OpTwiddling(2, new int[]{0, 1, 0, 1}), HexPattern.fromAngles("aadadaaw", HexDir.EAST))); - - public static final ActionRegistryEntry STACK_LEN = make("stack_len", - new ActionRegistryEntry(OpStackSize.INSTANCE, HexPattern.fromAngles("qwaeawqaeaqa", HexDir.NORTH_WEST))); - public static final ActionRegistryEntry DUPLICATE_N = make("duplicate_n", - new ActionRegistryEntry(OpDuplicateN.INSTANCE, HexPattern.fromAngles("aadaadaa", HexDir.EAST))); - public static final ActionRegistryEntry FISHERMAN = make("fisherman", - new ActionRegistryEntry(OpFisherman.INSTANCE, HexPattern.fromAngles("ddad", HexDir.WEST))); - public static final ActionRegistryEntry FISHERMAN$COPY = make("fisherman/copy", - new ActionRegistryEntry(OpFishermanButItCopies.INSTANCE, HexPattern.fromAngles("aada", HexDir.EAST))); - public static final ActionRegistryEntry SWIZZLE = make("swizzle", - new ActionRegistryEntry(OpAlwinfyHasAscendedToABeingOfPureMath.INSTANCE, HexPattern.fromAngles("qaawdde", HexDir.SOUTH_EAST))); - - // == Math == - - public static final ActionRegistryEntry ADD = make("add", - new ActionRegistryEntry(OpAdd.INSTANCE, HexPattern.fromAngles("waaw", HexDir.NORTH_EAST))); - public static final ActionRegistryEntry SUB = make("sub", - new ActionRegistryEntry(OpSub.INSTANCE, HexPattern.fromAngles("wddw", HexDir.NORTH_WEST))); - public static final ActionRegistryEntry MUL_DOT = make("mul_dot", - new ActionRegistryEntry(OpMulDot.INSTANCE, HexPattern.fromAngles("waqaw", HexDir.SOUTH_EAST))); - public static final ActionRegistryEntry DIV_CROSS = make("div_cross", - new ActionRegistryEntry(OpDivCross.INSTANCE, HexPattern.fromAngles("wdedw", HexDir.NORTH_EAST))); - public static final ActionRegistryEntry ABS_LEN = make("abs_len", - new ActionRegistryEntry(OpAbsLen.INSTANCE, HexPattern.fromAngles("wqaqw", HexDir.NORTH_EAST))); - public static final ActionRegistryEntry POW_PROJ = make("pow_proj", - new ActionRegistryEntry(OpPowProj.INSTANCE, HexPattern.fromAngles("wedew", HexDir.NORTH_WEST))); - public static final ActionRegistryEntry FLOOR = make("floor", - new ActionRegistryEntry(OpFloor.INSTANCE, HexPattern.fromAngles("ewq", HexDir.EAST))); - public static final ActionRegistryEntry CEIL = make("ceil", - new ActionRegistryEntry(OpCeil.INSTANCE, HexPattern.fromAngles("qwe", HexDir.EAST))); - - public static final ActionRegistryEntry CONSTRUCT_VEC = make("construct_vec", - new ActionRegistryEntry(OpConstructVec.INSTANCE, HexPattern.fromAngles("eqqqqq", HexDir.EAST))); - public static final ActionRegistryEntry DECONSTRUCT_VEC = make("deconstruct_vec", - new ActionRegistryEntry(OpDeconstructVec.INSTANCE, HexPattern.fromAngles("qeeeee", HexDir.EAST))); - public static final ActionRegistryEntry COERCE_AXIAL = make("coerce_axial", - new ActionRegistryEntry(OpCoerceToAxial.INSTANCE, HexPattern.fromAngles("qqqqqaww", HexDir.NORTH_WEST))); - - // == Logic == - - public static final ActionRegistryEntry AND = make("and", - new ActionRegistryEntry(OpBoolAnd.INSTANCE, HexPattern.fromAngles("wdw", HexDir.NORTH_EAST)); - public static final ActionRegistryEntry OR = make("or", - new ActionRegistryEntry(OpBoolOr.INSTANCE, HexPattern.fromAngles("waw", HexDir.SOUTH_EAST)); - public static final ActionRegistryEntry XOR = make("xor", - new ActionRegistryEntry(OpBoolXor.INSTANCE, HexPattern.fromAngles("dwa", HexDir.NORTH_WEST)); - public static final ActionRegistryEntry GREATER = make("greater", - new ActionRegistryEntry(new OpCompare(false, (a, b) -> a > b), HexPattern.fromAngles("e", HexDir.SOUTH_EAST))); - public static final ActionRegistryEntry LESS = make("less", - new ActionRegistryEntry(new OpCompare(false, (a, b) -> a < b), HexPattern.fromAngles("q", HexDir.SOUTH_WEST))); - public static final ActionRegistryEntry GREATER_EQ = make("greater_eq", - new ActionRegistryEntry(new OpCompare(true, (a, b) -> a >= b), HexPattern.fromAngles("ee", HexDir.SOUTH_EAST))); - public static final ActionRegistryEntry LESS_EQ = make("less_eq", - new ActionRegistryEntry(new OpCompare(true, (a, b) -> a <= b), HexPattern.fromAngles("qq", HexDir.SOUTH_WEST))); - public static final ActionRegistryEntry EQUALS = make("equals", - new ActionRegistryEntry(new OpEquality(false), HexPattern.fromAngles("ad", HexDir.EAST))); - public static final ActionRegistryEntry NOT_EQUALS = make("not_equals", - new ActionRegistryEntry(new OpEquality(true), HexPattern.fromAngles("da", HexDir.EAST))); - public static final ActionRegistryEntry NOT = make("not", - new ActionRegistryEntry(OpBoolNot.INSTANCE, HexPattern.fromAngles("dw", HexDir.NORTH_WEST))); - public static final ActionRegistryEntry BOOL_COERCE = make("bool_coerce", - new ActionRegistryEntry(OpCoerceToBool.INSTANCE, HexPattern.fromAngles("aw", HexDir.NORTH_EAST))); - public static final ActionRegistryEntry IF = make("if", - new ActionRegistryEntry(OpBoolIf.INSTANCE, HexPattern.fromAngles("awdd", HexDir.SOUTH_EAST))); - - public static final ActionRegistryEntry RANDOM = make("random", - new ActionRegistryEntry(OpRandom.INSTANCE, HexPattern.fromAngles("eqqq", HexDir.NORTH_WEST))); - - // == Advanced Math == - - public static final ActionRegistryEntry SIN = make("sin", - new ActionRegistryEntry(OpSin.INSTANCE, HexPattern.fromAngles("qqqqqaa", HexDir.SOUTH_EAST))); - public static final ActionRegistryEntry COS = make("cos", - new ActionRegistryEntry(OpCos.INSTANCE, HexPattern.fromAngles("qqqqqad", HexDir.SOUTH_EAST))); - public static final ActionRegistryEntry TAN = make("tan", - new ActionRegistryEntry(OpTan.INSTANCE, HexPattern.fromAngles("wqqqqqadq", HexDir.SOUTH_WEST))); - public static final ActionRegistryEntry ARCSIN = make("arcsin", - new ActionRegistryEntry(OpArcSin.INSTANCE, HexPattern.fromAngles("ddeeeee", HexDir.SOUTH_EAST))); - public static final ActionRegistryEntry ARCCOS = make("arccos", - new ActionRegistryEntry(OpArcCos.INSTANCE, HexPattern.fromAngles("adeeeee", HexDir.NORTH_EAST))); - public static final ActionRegistryEntry ARCTAN = make("arctan", - new ActionRegistryEntry(OpArcTan.INSTANCE, HexPattern.fromAngles("eadeeeeew", HexDir.NORTH_EAST))); - public static final ActionRegistryEntry LOGARITHM = make("logarithm", - new ActionRegistryEntry(OpLog.INSTANCE, HexPattern.fromAngles("eqaqe", HexDir.NORTH_WEST))); - public static final ActionRegistryEntry MODULO = make("modulo", - new ActionRegistryEntry(OpModulo.INSTANCE, HexPattern.fromAngles("addwaad", HexDir.NORTH_EAST))); - - // == Sets == - - public static final ActionRegistryEntry BIT$AND = make("bit/and", - new ActionRegistryEntry(OpAnd.INSTANCE, HexPattern.fromAngles("wdweaqa", HexDir.NORTH_EAST))); - public static final ActionRegistryEntry BIT$OR = make("bit/or", - new ActionRegistryEntry(OpOr.INSTANCE, HexPattern.fromAngles("waweaqa", HexDir.SOUTH_EAST))); - public static final ActionRegistryEntry BIT$XOR = make("bit/xor", - new ActionRegistryEntry(OpXor.INSTANCE, HexPattern.fromAngles("dwaeaqa", HexDir.NORTH_WEST))); - public static final ActionRegistryEntry BIT$NOT = make("bit/not", - new ActionRegistryEntry(OpNot.INSTANCE, HexPattern.fromAngles("dweaqa", HexDir.NORTH_WEST))); - public static final ActionRegistryEntry BIT$TO_SET = make("bit/to_set", - new ActionRegistryEntry(OpToSet.INSTANCE, HexPattern.fromAngles("aweaqa", HexDir.NORTH_EAST))); - - // == Spells == - - public static final ActionRegistryEntry PRINT = make("print", - new ActionRegistryObject(OpPrint.INSTANCE, HexPattern.fromAngles("de", HexDir.NORTH_EAST))); - public static final ActionRegistryEntry EXPLODE = make("explode", - new ActionRegistryObject(new OpExplode(false), HexPattern.fromAngles("aawaawaa", HexDir.EAST))); - public static final ActionRegistryEntry EXPLODE/FIRE = make("explode/fire", - new ActionRegistryObject(new OpExplode(true), HexPattern.fromAngles("ddwddwdd", HexDir.EAST))); - public static final ActionRegistryEntry ADD_MOTION = make("add_motion", - new ActionRegistryObject(OpAddMotion.INSTANCE, HexPattern.fromAngles("awqqqwaqw", HexDir.SOUTH_WEST))); - public static final ActionRegistryEntry BLINK = make("blink", - new ActionRegistryObject(OpBlink.INSTANCE, HexPattern.fromAngles("awqqqwaq", HexDir.SOUTH_WEST))); - public static final ActionRegistryEntry BREAK_BLOCK = make("break_block", - new ActionRegistryObject(OpBreakBlock.INSTANCE, HexPattern.fromAngles("qaqqqqq", HexDir.EAST))); - public static final ActionRegistryEntry PLACE_BLOCK = make("place_block", - new ActionRegistryObject(OpPlaceBlock.INSTANCE, HexPattern.fromAngles("eeeeede", HexDir.SOUTH_WEST))); - public static final ActionRegistryEntry COLORIZE = make("colorize", - new ActionRegistryObject(OpColorize.INSTANCE, HexPattern.fromAngles("awddwqawqwawq", HexDir.EAST))); - public static final ActionRegistryEntry CREATE_WATER = make("create_water", - new ActionRegistryObject(new OpCreateFluid(false, MediaConstants.DUST_UNIT, - Items.WATER_BUCKET, - Blocks.WATER_CAULDRON.defaultBlockState() - .setValue(Lnew OpCreateFluid(false, MediaConstants.DUST_UNIT, - Items.WATER_BUCKET, - Blocks.WATER_CAULDRON.defaultBlockState() - .setValue(LayeredCauldronBlock.LEVEL, LayeredCauldronBlock.MAX_FILL_LEVEL), - Fluids.WATER), ayeredCauldronBlock.LEVEL, LayeredCauldronBlock.MAX_FILL_LEVEL), - Fluids.WATER)), HexPattern.fromAngles("aqawqadaq", HexDir.SOUTH_EAST))); - public static final ActionRegistryEntry DESTROY_WATER = make("destroy_water", - new ActionRegistryObject(OpDestroyFluid.INSTANCE, HexPattern.fromAngles("dedwedade", HexDir.SOUTH_WEST))); - public static final ActionRegistryEntry IGNITE = make("ignite", - new ActionRegistryObject(OpIgnite.INSTANCE, HexPattern.fromAngles("aaqawawa", HexDir.SOUTH_EAST))); - public static final ActionRegistryEntry EXTINGUISH = make("extinguish", - new ActionRegistryObject(OpExtinguish.INSTANCE, HexPattern.fromAngles("ddedwdwd", HexDir.SOUTH_WEST))); - public static final ActionRegistryEntry CONJURE_BLOCK = make("conjure_block", - new ActionRegistryObject(OpConjureBlock(false), HexPattern.fromAngles("qqa", HexDir.NORTH_EAST))); - public static final ActionRegistryEntry CONJURE_LIGHT = make("conjure_light", - new ActionRegistryObject(new OpConjureBlock(true), HexPattern.fromAngles("qqd", HexDir.NORTH_EAST))); - public static final ActionRegistryEntry BONEMEAL = make("bonemeal", - new ActionRegistryObject(OpTneOnlyReasonAnyoneDownloadedPsi.INSTANCE, HexPattern.fromAngles("wqaqwawqaqw", HexDir.NORTH_EAST))); - public static final ActionRegistryEntry RECHARGE = make("recharge", - new ActionRegistryObject(OpRecharge.INSTANCE, HexPattern.fromAngles("qqqqqwaeaeaeaeaea", HexDir.NORTH_WEST))); - public static final ActionRegistryEntry ERASE = make("erase", - new ActionRegistryObject(new OpErase(), HexPattern.fromAngles("qdqawwaww", HexDir.EAST), modLoc("erase"))); - public static final ActionRegistryEntry EDIFY = make("edify", - new ActionRegistryObject(OpEdifySapling.INSTANCE, HexPattern.fromAngles("wqaqwd", HexDir.NORTH_EAST), modLoc("edify"))); - - public static final ActionRegistryEntry BEEP = make("beep", - new ActionRegistryObject(OpBeep.INSTANCE, HexPattern.fromAngles("adaa", HexDir.WEST))); - - public static final ActionRegistryEntry CRAFT$CYPHER = make("craft/cypher", new ActionRegistryObject( - new OpMakePackagedSpell<>(HexItems.CYPHER, MediaConstants.CRYSTAL_UNIT), - HexPattern.fromAngles("waqqqqq", HexDir.EAST))); - public static final ActionRegistryEntry CRAFT$TRINKET = make("craft/trinket", new ActionRegistryObject( - new OpMakePackagedSpell<>(HexItems.TRINKET, 5 * MediaConstants.CRYSTAL_UNIT), HexPattern.fromAngles("wwaqqqqqeaqeaeqqqeaeq", HexDir.EAST))); - public static final ActionRegistryEntry CRAFT$ARTIFACT = make("craft/artifact", new ActionRegistryObject( - new OpMakePackagedSpell<>(HexItems.ARTIFACT, 10 * MediaConstants.CRYSTAL_UNIT), - HexPattern.fromAngles("wwaqqqqqeawqwqwqwqwqwwqqeadaeqqeqqeadaeqq", HexDir.EAST))); - public static final ActionRegistryEntry CRAFT$BATTERY = make("craft/battery", new ActionRegistryObject( - OpMakeBattery.INSTANCE, HexPattern.fromAngles("aqqqaqwwaqqqqqeqaqqqawwqwqwqwqwqw", HexDir.SOUTH_WEST))); - - public static final ActionRegistryEntry POTION$WEAKNESS = make("potion/weakness", new ActionRegistryEntry( - new OpPotionEffect(MobEffects.WEAKNESS, MediaConstants.DUST_UNIT / 10, true, false, false), - HexPattern.fromAngles("qqqqqaqwawaw", HexDir.NORTH_WEST))); - public static final ActionRegistryEntry POTION$LEVITATION = make("potion/levitation", new ActionRegistryEntry( - new OpPotionEffect(MobEffects.LEVITATION, MediaConstants.DUST_UNIT / 5, false, false, false), - HexPattern.fromAngles("qqqqqawwawawd", HexDir.WEST))); - public static final ActionRegistryEntry POTION$WITHER = make("potion/wither", new ActionRegistryEntry( - new OpPotionEffect(MobEffects.WITHER, MediaConstants.DUST_UNIT, true, false, false), - HexPattern.fromAngles("qqqqqaewawawe", HexDir.SOUTH_WEST))); - public static final ActionRegistryEntry POTION$POISON = make("potion/poison", new ActionRegistryEntry( - new OpPotionEffect(MobEffects.POISON, MediaConstants.DUST_UNIT / 3, true, false, false), - HexPattern.fromAngles("qqqqqadwawaww", HexDir.SOUTH_EAST))); - public static final ActionRegistryEntry POTION$SLOWNESS = make("potion/slowness", new ActionRegistryEntry( - new OpPotionEffect(MobEffects.MOVEMENT_SLOWDOWN, MediaConstants.DUST_UNIT / 3, true, false, false), - HexPattern.fromAngles("qqqqqadwawaw", HexDir.SOUTH_EAST))); - - public static final ActionRegistryEntry POTION$REGENERATION = make("potion/regeneration", new ActionRegistryEntry( - new OpPotionEffect(new OpPotionEffect(MobEffects.REGENERATION, MediaConstants.DUST_UNIT, true, true, true), - HexPattern.fromAngles("qqqqaawawaedd", HexDir.NORTH_WEST))); - public static final ActionRegistryEntry POTION$NIGHT_VISION = make("potion/night_vision", new ActionRegistryEntry( - new OpPotionEffect(new OpPotionEffect(MobEffects.NIGHT_VISION, MediaConstants.DUST_UNIT / 5, false, true, true), - HexPattern.fromAngles("qqqaawawaeqdd", HexDir.WEST))); - public static final ActionRegistryEntry POTION$ABSORPTION = make("potion/absorption", new ActionRegistryEntry( - new OpPotionEffect(new OpPotionEffect(MobEffects.ABSORPTION, MediaConstants.DUST_UNIT, true, true, true), - HexPattern.fromAngles("qqaawawaeqqdd", HexDir.SOUTH_WEST))); - public static final ActionRegistryEntry POTION$HASTE = make("potion/haste", new ActionRegistryEntry( - new OpPotionEffect(new OpPotionEffect(MobEffects.DIG_SPEED, MediaConstants.DUST_UNIT / 3, true, true, true), - HexPattern.fromAngles("qaawawaeqqqdd", HexDir.SOUTH_EAST))); - public static final ActionRegistryEntry POTION$STRENGTH = make("potion/strength", new ActionRegistryEntry( - new OpPotionEffect(new OpPotionEffect(MobEffects.DAMAGE_BOOST, MediaConstants.DUST_UNIT / 3, true, true, true), - HexPattern.fromAngles("aawawaeqqqqdd", HexDir.EAST))); - - public static final ActionRegistryEntry SENTINEL$CREATE = make("sentinel/create", - new ActionRegistryEntry(new OpCreateSentinel(false), HexPattern.fromAngles("waeawae", HexDir.EAST))); - public static final ActionRegistryEntry SENTINEL$DESTROY = make("sentinel/destroy", - new ActionRegistryEntry(OpDestroySentinel.INSTANCE, HexPattern.fromAngles("qdwdqdw", HexDir.NORTH_EAST))); - public static final ActionRegistryEntry SENTINEL$GET_POS = make("sentinel/get_pos", - new ActionRegistryEntry(OpGetSentinelPos.INSTANCE, HexPattern.fromAngles("waeawaede", HexDir.EAST))); - public static final ActionRegistryEntry SENTINEL$WAYFIND = make("sentinel/wayfind", - new ActionRegistryEntry(OpGetSentinelWayfind.INSTANCE, HexPattern.fromAngles("waeawaedwa", HexDir.EAST))); - - public static final ActionRegistryEntry LIGHTNING = make("lightning", - new ActionRegistryEntry(OpLightning.INSTANCE, HexPattern.fromAngles("waadwawdaaweewq", HexDir.EAST))); - public static final ActionRegistryEntry FLIGHT = make("flight", - new ActionRegistryEntry(OpFlight.INSTANCE, HexPattern.fromAngles("eawwaeawawaa", HexDir.NORTH_WEST))); - public static final ActionRegistryEntry CREATE_LAVA = make("create_lava", - new ActionRegistryEntry(new OpCreateFluid(true, MediaConstants.CRYSTAL_UNIT, - Items.LAVA_BUCKET, - Blocks.LAVA_CAULDRON.defaultBlockState(), - Fluids.LAVA), HexPattern.fromAngles("eaqawqadaqd", HexDir.EAST))); - public static final ActionRegistryEntry TELEPORT = make("teleport", - new ActionRegistryEntry(OpTeleport.INSTANCE, HexPattern.fromAngles("wwwqqqwwwqqeqqwwwqqwqqdqqqqqdqq", HexDir.EAST))); - public static final ActionRegistryEntry SENTINEL$GREAT = make("sentinel/create/great", - new ActionRegistryEntry(new OpCreateSentinel(true), HexPattern.fromAngles("waeawaeqqqwqwqqwq", HexDir.EAST))); - public static final ActionRegistryEntry DISPEL_RAIN = make("dispel_rain", - new ActionRegistryEntry(new OpWeather(false), HexPattern.fromAngles("eeewwweeewwaqqddqdqd", HexDir.EAST))); - public static final ActionRegistryEntry SUMMON_RAIN = make("summon_rain", - new ActionRegistryEntry(OpWeather(true), HexPattern.fromAngles("wwweeewwweewdawdwad", HexDir.WEST))); - public static final ActionRegistryEntry BRAINSWEEP = make("brainsweep", - new ActionRegistryEntry(OpBrainsweep.INSTANCE, HexPattern.fromAngles("qeqwqwqwqwqeqaeqeaqeqaeqaqded", HexDir.NORTH_EAST))); - - public static final ActionRegistryEntry AKASHIC$READ= make("akashic/read", - new ActionRegistryEntry(OpAkashicRead.INSTANCE, HexPattern.fromAngles("qqqwqqqqqaq", HexDir.WEST)); - public static final ActionRegistryEntry AKASHIC$WRITE= make("akashic/write", - new ActionRegistryEntry(OpAkashicWrite.INSTANCE, HexPattern.fromAngles("eeeweeeeede", HexDir.EAST)); - - // == Meta stuff == - - // Intro/Retro/Consideration are now special-form-likes and aren't even ops. - // TODO should there be a registry for these too - - // http://www.toroidalsnark.net/mkss3-pix/CalderheadJMM2014.pdf - // eval being a space filling curve feels apt doesn't it - public static final ActionRegistryEntry (HexPattern.fromAngles("deaqq", HexDir.SOUTH_EAST), modLoc("eval"), - OpEval.INSTANCE); - public static final ActionRegistryEntry (HexPattern.fromAngles("aqdee", HexDir.SOUTH_WEST), modLoc("halt"), - OpHalt.INSTANCE); - - public static final ActionRegistryEntry (HexPattern.fromAngles("aqqqqq", HexDir.EAST), modLoc("read"), - OpRead.INSTANCE); - public static final ActionRegistryEntry (HexPattern.fromAngles("wawqwqwqwqwqw", HexDir.EAST), - modLoc("read/entity"), OpTheCoolerRead.INSTANCE); - public static final ActionRegistryEntry (HexPattern.fromAngles("deeeee", HexDir.EAST), modLoc("write"), - OpWrite.INSTANCE); - public static final ActionRegistryEntry (HexPattern.fromAngles("wdwewewewewew", HexDir.EAST), - modLoc("write/entity"), OpTheCoolerWrite.INSTANCE); - public static final ActionRegistryEntry (HexPattern.fromAngles("aqqqqqe", HexDir.EAST), modLoc("readable"), - OpReadable.INSTANCE); - public static final ActionRegistryEntry (HexPattern.fromAngles("wawqwqwqwqwqwew", HexDir.EAST), - modLoc("readable/entity"), OpTheCoolerReadable.INSTANCE); - public static final ActionRegistryEntry (HexPattern.fromAngles("deeeeeq", HexDir.EAST), modLoc("writable"), - OpWritable.INSTANCE); - public static final ActionRegistryEntry (HexPattern.fromAngles("wdwewewewewewqw", HexDir.EAST), - modLoc("writable/entity"), OpTheCoolerWritable.INSTANCE); - - // lorge boyes - - - public static final ActionRegistryEntry (HexPattern.fromAngles("qeewdweddw", HexDir.NORTH_EAST), - modLoc("read/local"), OpPeekLocal.INSTANCE); - public static final ActionRegistryEntry (HexPattern.fromAngles("eqqwawqaaw", HexDir.NORTH_WEST), - modLoc("write/local"), OpPushLocal.INSTANCE); - - // == Consts == - - public static final ActionRegistryEntry (HexPattern.fromAngles("d", HexDir.EAST), modLoc("const/null"), - Action.makeConstantOp(new NullIota())); - - public static final ActionRegistryEntry (HexPattern.fromAngles("aqae", HexDir.SOUTH_EAST), modLoc("const/true"), - Action.makeConstantOp(new BooleanIota(true))); - public static final ActionRegistryEntry (HexPattern.fromAngles("dedq", HexDir.NORTH_EAST), modLoc("const/false"), - Action.makeConstantOp(new BooleanIota(false))); - - public static final ActionRegistryEntry (HexPattern.fromAngles("qqqqqea", HexDir.NORTH_WEST), modLoc("const/vec/px"), - Action.makeConstantOp(new Vec3Iota(new Vec3(1.0, 0.0, 0.0)))); - public static final ActionRegistryEntry (HexPattern.fromAngles("qqqqqew", HexDir.NORTH_WEST), modLoc("const/vec/py"), - Action.makeConstantOp(new Vec3Iota(new Vec3(0.0, 1.0, 0.0)))); - public static final ActionRegistryEntry (HexPattern.fromAngles("qqqqqed", HexDir.NORTH_WEST), modLoc("const/vec/pz"), - Action.makeConstantOp(new Vec3Iota(new Vec3(0.0, 0.0, 1.0)))); - public static final ActionRegistryEntry (HexPattern.fromAngles("eeeeeqa", HexDir.SOUTH_WEST), modLoc("const/vec/nx"), - Action.makeConstantOp(new Vec3Iota(new Vec3(-1.0, 0.0, 0.0)))); - public static final ActionRegistryEntry (HexPattern.fromAngles("eeeeeqw", HexDir.SOUTH_WEST), modLoc("const/vec/ny"), - Action.makeConstantOp(new Vec3Iota(new Vec3(0.0, -1.0, 0.0)))); - public static final ActionRegistryEntry (HexPattern.fromAngles("eeeeeqd", HexDir.SOUTH_WEST), modLoc("const/vec/nz"), - Action.makeConstantOp(new Vec3Iota(new Vec3(0.0, 0.0, -1.0)))); - // Yep, this is what I spend the "plain hexagon" pattern on. - public static final ActionRegistryEntry (HexPattern.fromAngles("qqqqq", HexDir.NORTH_WEST), modLoc("const/vec/0"), - Action.makeConstantOp(new Vec3Iota(new Vec3(0.0, 0.0, 0.0)))); - - public static final ActionRegistryEntry (HexPattern.fromAngles("qdwdq", HexDir.NORTH_EAST), modLoc("const/double/pi"), - Action.makeConstantOp(new DoubleIota(Math.PI))); - public static final ActionRegistryEntry (HexPattern.fromAngles("eawae", HexDir.NORTH_WEST), modLoc("const/double/tau"), - Action.makeConstantOp(new DoubleIota(HexUtils.TAU))); - - // e - public static final ActionRegistryEntry (HexPattern.fromAngles("aaq", HexDir.EAST), modLoc("const/double/e"), - Action.makeConstantOp(new DoubleIota(Math.E))); - - // == Entities == - - public static final ActionRegistryEntry (HexPattern.fromAngles("qqqqqdaqa", HexDir.SOUTH_EAST), modLoc("get_entity"), - new OpGetEntityAt(e -> true)); - public static final ActionRegistryEntry (HexPattern.fromAngles("qqqqqdaqaawa", HexDir.SOUTH_EAST), - modLoc("get_entity/animal"), - new OpGetEntityAt(OpGetEntitiesBy::isAnimal)); - public static final ActionRegistryEntry (HexPattern.fromAngles("qqqqqdaqaawq", HexDir.SOUTH_EAST), - modLoc("get_entity/monster"), - new OpGetEntityAt(OpGetEntitiesBy::isMonster)); - public static final ActionRegistryEntry (HexPattern.fromAngles("qqqqqdaqaaww", HexDir.SOUTH_EAST), - modLoc("get_entity/item"), - new OpGetEntityAt(OpGetEntitiesBy::isItem)); - public static final ActionRegistryEntry (HexPattern.fromAngles("qqqqqdaqaawe", HexDir.SOUTH_EAST), - modLoc("get_entity/player"), - new OpGetEntityAt(OpGetEntitiesBy::isPlayer)); - public static final ActionRegistryEntry (HexPattern.fromAngles("qqqqqdaqaawd", HexDir.SOUTH_EAST), - modLoc("get_entity/living"), - new OpGetEntityAt(OpGetEntitiesBy::isLiving)); - - public static final ActionRegistryEntry (HexPattern.fromAngles("qqqqqwded", HexDir.SOUTH_EAST), modLoc("zone_entity"), - new OpGetEntitiesBy(e -> true, false)); - public static final ActionRegistryEntry (HexPattern.fromAngles("qqqqqwdeddwa", HexDir.SOUTH_EAST), - modLoc("zone_entity/animal"), - new OpGetEntitiesBy(OpGetEntitiesBy::isAnimal, false)); - public static final ActionRegistryEntry (HexPattern.fromAngles("eeeeewaqaawa", HexDir.NORTH_EAST), - modLoc("zone_entity/not_animal"), - new OpGetEntitiesBy(OpGetEntitiesBy::isAnimal, true)); - public static final ActionRegistryEntry (HexPattern.fromAngles("qqqqqwdeddwq", HexDir.SOUTH_EAST), - modLoc("zone_entity/monster"), - new OpGetEntitiesBy(OpGetEntitiesBy::isMonster, false)); - public static final ActionRegistryEntry (HexPattern.fromAngles("eeeeewaqaawq", HexDir.NORTH_EAST), - modLoc("zone_entity/not_monster"), - new OpGetEntitiesBy(OpGetEntitiesBy::isMonster, true)); - public static final ActionRegistryEntry (HexPattern.fromAngles("qqqqqwdeddww", HexDir.SOUTH_EAST), - modLoc("zone_entity/item"), - new OpGetEntitiesBy(OpGetEntitiesBy::isItem, false)); - public static final ActionRegistryEntry (HexPattern.fromAngles("eeeeewaqaaww", HexDir.NORTH_EAST), - modLoc("zone_entity/not_item"), - new OpGetEntitiesBy(OpGetEntitiesBy::isItem, true)); - public static final ActionRegistryEntry (HexPattern.fromAngles("qqqqqwdeddwe", HexDir.SOUTH_EAST), - modLoc("zone_entity/player"), - new OpGetEntitiesBy(OpGetEntitiesBy::isPlayer, false)); - public static final ActionRegistryEntry (HexPattern.fromAngles("eeeeewaqaawe", HexDir.NORTH_EAST), - modLoc("zone_entity/not_player"), - new OpGetEntitiesBy(OpGetEntitiesBy::isPlayer, true)); - public static final ActionRegistryEntry (HexPattern.fromAngles("qqqqqwdeddwd", HexDir.SOUTH_EAST), - modLoc("zone_entity/living"), - new OpGetEntitiesBy(OpGetEntitiesBy::isLiving, false)); - public static final ActionRegistryEntry (HexPattern.fromAngles("eeeeewaqaawd", HexDir.NORTH_EAST), - modLoc("zone_entity/not_living"), - new OpGetEntitiesBy(OpGetEntitiesBy::isLiving, true)); - - // == Lists == - - public static final ActionRegistryEntry (HexPattern.fromAngles("edqde", HexDir.SOUTH_WEST), modLoc("append"), - OpAppend.INSTANCE); - public static final ActionRegistryEntry (HexPattern.fromAngles("qaeaq", HexDir.NORTH_WEST), modLoc("concat"), - OpConcat.INSTANCE); - public static final ActionRegistryEntry (HexPattern.fromAngles("deeed", HexDir.NORTH_WEST), modLoc("index"), - OpIndex.INSTANCE); - public static final ActionRegistryEntry (HexPattern.fromAngles("dadad", HexDir.NORTH_EAST), modLoc("for_each"), - OpForEach.INSTANCE); - public static final ActionRegistryEntry (HexPattern.fromAngles("aqaeaq", HexDir.EAST), modLoc("list_size"), - OpListSize.INSTANCE); - public static final ActionRegistryEntry (HexPattern.fromAngles("adeeed", HexDir.EAST), modLoc("singleton"), - OpSingleton.INSTANCE); - public static final ActionRegistryEntry (HexPattern.fromAngles("qqaeaae", HexDir.NORTH_EAST), modLoc("empty_list"), - OpEmptyList.INSTANCE); - public static final ActionRegistryEntry (HexPattern.fromAngles("qqqaede", HexDir.EAST), modLoc("reverse_list"), - OpReverski.INSTANCE); - public static final ActionRegistryEntry (HexPattern.fromAngles("ewdqdwe", HexDir.SOUTH_WEST), modLoc("last_n_list"), - OpLastNToList.INSTANCE); - public static final ActionRegistryEntry (HexPattern.fromAngles("qwaeawq", HexDir.NORTH_WEST), modLoc("splat"), - OpSplat.INSTANCE); - public static final ActionRegistryEntry (HexPattern.fromAngles("dedqde", HexDir.EAST), modLoc("index_of"), - OpIndexOf.INSTANCE); - public static final ActionRegistryEntry (HexPattern.fromAngles("edqdewaqa", HexDir.SOUTH_WEST), modLoc("list_remove"), - OpRemove.INSTANCE); - public static final ActionRegistryEntry (HexPattern.fromAngles("qaeaqwded", HexDir.NORTH_WEST), modLoc("slice"), - OpSlice.INSTANCE); - public static final ActionRegistryEntry (HexPattern.fromAngles("wqaeaqw", HexDir.NORTH_WEST), - modLoc("modify_in_place"), - OpModifyInPlace.INSTANCE); - public static final ActionRegistryEntry (HexPattern.fromAngles("ddewedd", HexDir.SOUTH_EAST), modLoc("construct"), - OpCons.INSTANCE); - public static final ActionRegistryEntry (HexPattern.fromAngles("aaqwqaa", HexDir.SOUTH_WEST), modLoc("deconstruct"), - OpUnCons.INSTANCE); - - private static ActionRegistryEntry make(String name, ActionRegistryEntry are) { - var old = ACTION_MAP.put(modLoc(name), are); - if (old != null) { - throw new IllegalArgumentException("Typo? Duplicate id " + name); - } - return are; - } - - // I guess this means the client will have a big empty map for patterns - public static void registerPatterns() { - try { - // == Getters == - - PatternRegistry.mapPattern(HexPattern.fromAngles("wqaawdd", HexDir.EAST), modLoc("raycast"), - OpBlockRaycast.INSTANCE); - PatternRegistry.mapPattern(HexPattern.fromAngles("weddwaa", HexDir.EAST), modLoc("raycast/axis"), - OpBlockAxisRaycast.INSTANCE); - PatternRegistry.mapPattern(HexPattern.fromAngles("weaqa", HexDir.EAST), modLoc("raycast/entity"), - OpEntityRaycast.INSTANCE); - - // == spell circle getters == - - PatternRegistry.mapPattern(HexPattern.fromAngles("eaqwqae", HexDir.SOUTH_WEST), - modLoc("circle/impetus_pos"), OpImpetusPos.INSTANCE); - PatternRegistry.mapPattern(HexPattern.fromAngles("eaqwqaewede", HexDir.SOUTH_WEST), - modLoc("circle/impetus_dir"), OpImpetusDir.INSTANCE); - PatternRegistry.mapPattern(HexPattern.fromAngles("eaqwqaewdd", HexDir.SOUTH_WEST), - modLoc("circle/bounds/min"), new OpCircleBounds(false)); - PatternRegistry.mapPattern(HexPattern.fromAngles("aqwqawaaqa", HexDir.WEST), - modLoc("circle/bounds/max"), new OpCircleBounds(true)); - - // == Modify Stack == - - PatternRegistry.mapPattern(HexPattern.fromAngles("aawdd", HexDir.EAST), modLoc("swap"), - new OpTwiddling(2, new int[]{1, 0})); - PatternRegistry.mapPattern(HexPattern.fromAngles("aaeaa", HexDir.EAST), modLoc("rotate"), - new OpTwiddling(3, new int[]{1, 2, 0})); - PatternRegistry.mapPattern(HexPattern.fromAngles("ddqdd", HexDir.NORTH_EAST), modLoc("rotate_reverse"), - new OpTwiddling(3, new int[]{2, 0, 1})); - PatternRegistry.mapPattern(HexPattern.fromAngles("aadaa", HexDir.EAST), modLoc("duplicate"), - new OpTwiddling(1, new int[]{0, 0})); - PatternRegistry.mapPattern(HexPattern.fromAngles("aaedd", HexDir.EAST), modLoc("over"), - new OpTwiddling(2, new int[]{0, 1, 0})); - PatternRegistry.mapPattern(HexPattern.fromAngles("ddqaa", HexDir.EAST), modLoc("tuck"), - new OpTwiddling(2, new int[]{1, 0, 1})); - PatternRegistry.mapPattern(HexPattern.fromAngles("aadadaaw", HexDir.EAST), modLoc("2dup"), - new OpTwiddling(2, new int[]{0, 1, 0, 1})); - - PatternRegistry.mapPattern(HexPattern.fromAngles("qwaeawqaeaqa", HexDir.NORTH_WEST), modLoc("stack_len"), - OpStackSize.INSTANCE); - PatternRegistry.mapPattern(HexPattern.fromAngles("aadaadaa", HexDir.EAST), modLoc("duplicate_n"), - OpDuplicateN.INSTANCE); - PatternRegistry.mapPattern(HexPattern.fromAngles("ddad", HexDir.WEST), modLoc("fisherman"), - OpFisherman.INSTANCE); - PatternRegistry.mapPattern(HexPattern.fromAngles("aada", HexDir.EAST), modLoc("fisherman/copy"), - OpFishermanButItCopies.INSTANCE); - PatternRegistry.mapPattern(HexPattern.fromAngles("qaawdde", HexDir.SOUTH_EAST), modLoc("swizzle"), - OpAlwinfyHasAscendedToABeingOfPureMath.INSTANCE); - - // == Math == - - PatternRegistry.mapPattern(HexPattern.fromAngles("waaw", HexDir.NORTH_EAST), modLoc("add"), - OpAdd.INSTANCE); - PatternRegistry.mapPattern(HexPattern.fromAngles("wddw", HexDir.NORTH_WEST), modLoc("sub"), - OpSub.INSTANCE); - PatternRegistry.mapPattern(HexPattern.fromAngles("waqaw", HexDir.SOUTH_EAST), modLoc("mul_dot"), - OpMulDot.INSTANCE); - PatternRegistry.mapPattern(HexPattern.fromAngles("wdedw", HexDir.NORTH_EAST), modLoc("div_cross"), - OpDivCross.INSTANCE); - PatternRegistry.mapPattern(HexPattern.fromAngles("wqaqw", HexDir.NORTH_EAST), modLoc("abs_len"), - OpAbsLen.INSTANCE); - PatternRegistry.mapPattern(HexPattern.fromAngles("wedew", HexDir.NORTH_WEST), modLoc("pow_proj"), - OpPowProj.INSTANCE); - PatternRegistry.mapPattern(HexPattern.fromAngles("ewq", HexDir.EAST), modLoc("floor"), - OpFloor.INSTANCE); - PatternRegistry.mapPattern(HexPattern.fromAngles("qwe", HexDir.EAST), modLoc("ceil"), - OpCeil.INSTANCE); - - PatternRegistry.mapPattern(HexPattern.fromAngles("eqqqqq", HexDir.EAST), modLoc("construct_vec"), - OpConstructVec.INSTANCE); - PatternRegistry.mapPattern(HexPattern.fromAngles("qeeeee", HexDir.EAST), modLoc("deconstruct_vec"), - OpDeconstructVec.INSTANCE); - PatternRegistry.mapPattern(HexPattern.fromAngles("qqqqqaww", HexDir.NORTH_WEST), modLoc("coerce_axial"), - OpCoerceToAxial.INSTANCE); - - // == Logic == - - PatternRegistry.mapPattern(HexPattern.fromAngles("wdw", HexDir.NORTH_EAST), modLoc("and"), - OpBoolAnd.INSTANCE); - PatternRegistry.mapPattern(HexPattern.fromAngles("waw", HexDir.SOUTH_EAST), modLoc("or"), - OpBoolOr.INSTANCE); - PatternRegistry.mapPattern(HexPattern.fromAngles("dwa", HexDir.NORTH_WEST), modLoc("xor"), - OpBoolXor.INSTANCE); - PatternRegistry.mapPattern(HexPattern.fromAngles("e", HexDir.SOUTH_EAST), modLoc("greater"), - new OpCompare(false, (a, b) -> a > b)); - PatternRegistry.mapPattern(HexPattern.fromAngles("q", HexDir.SOUTH_WEST), modLoc("less"), - new OpCompare(false, (a, b) -> a < b)); - PatternRegistry.mapPattern(HexPattern.fromAngles("ee", HexDir.SOUTH_EAST), modLoc("greater_eq"), - new OpCompare(true, (a, b) -> a >= b)); - PatternRegistry.mapPattern(HexPattern.fromAngles("qq", HexDir.SOUTH_WEST), modLoc("less_eq"), - new OpCompare(true, (a, b) -> a <= b)); - PatternRegistry.mapPattern(HexPattern.fromAngles("ad", HexDir.EAST), modLoc("equals"), - new OpEquality(false)); - PatternRegistry.mapPattern(HexPattern.fromAngles("da", HexDir.EAST), modLoc("not_equals"), - new OpEquality(true)); - PatternRegistry.mapPattern(HexPattern.fromAngles("dw", HexDir.NORTH_WEST), modLoc("not"), - OpBoolNot.INSTANCE); - PatternRegistry.mapPattern(HexPattern.fromAngles("aw", HexDir.NORTH_EAST), modLoc("bool_coerce"), - OpCoerceToBool.INSTANCE); - PatternRegistry.mapPattern(HexPattern.fromAngles("awdd", HexDir.SOUTH_EAST), modLoc("if"), - OpBoolIf.INSTANCE); - - PatternRegistry.mapPattern(HexPattern.fromAngles("eqqq", HexDir.NORTH_WEST), modLoc("random"), - OpRandom.INSTANCE); - - // == Advanced Math == - - PatternRegistry.mapPattern(HexPattern.fromAngles("qqqqqaa", HexDir.SOUTH_EAST), modLoc("sin"), - OpSin.INSTANCE); - PatternRegistry.mapPattern(HexPattern.fromAngles("qqqqqad", HexDir.SOUTH_EAST), modLoc("cos"), - OpCos.INSTANCE); - PatternRegistry.mapPattern(HexPattern.fromAngles("wqqqqqadq", HexDir.SOUTH_WEST), modLoc("tan"), - OpTan.INSTANCE); - PatternRegistry.mapPattern(HexPattern.fromAngles("ddeeeee", HexDir.SOUTH_EAST), modLoc("arcsin"), - OpArcSin.INSTANCE); - PatternRegistry.mapPattern(HexPattern.fromAngles("adeeeee", HexDir.NORTH_EAST), modLoc("arccos"), - OpArcCos.INSTANCE); - PatternRegistry.mapPattern(HexPattern.fromAngles("eadeeeeew", HexDir.NORTH_EAST), modLoc("arctan"), - OpArcTan.INSTANCE); - - PatternRegistry.mapPattern(HexPattern.fromAngles("eqaqe", HexDir.NORTH_WEST), modLoc("logarithm"), - OpLog.INSTANCE); - PatternRegistry.mapPattern(HexPattern.fromAngles("addwaad", HexDir.NORTH_EAST), modLoc("modulo"), - OpModulo.INSTANCE); - - // == Sets == - - PatternRegistry.mapPattern(HexPattern.fromAngles("wdweaqa", HexDir.NORTH_EAST), modLoc("and_bit"), - OpAnd.INSTANCE); - PatternRegistry.mapPattern(HexPattern.fromAngles("waweaqa", HexDir.SOUTH_EAST), modLoc("or_bit"), - OpOr.INSTANCE); - PatternRegistry.mapPattern(HexPattern.fromAngles("dwaeaqa", HexDir.NORTH_WEST), modLoc("xor_bit"), - OpXor.INSTANCE); - PatternRegistry.mapPattern(HexPattern.fromAngles("dweaqa", HexDir.NORTH_WEST), modLoc("not_bit"), - OpNot.INSTANCE); - PatternRegistry.mapPattern(HexPattern.fromAngles("aweaqa", HexDir.NORTH_EAST), modLoc("to_set"), - OpToSet.INSTANCE); - - // == Spells == - - PatternRegistry.mapPattern(HexPattern.fromAngles("de", HexDir.NORTH_EAST), modLoc("print"), - OpPrint.INSTANCE); - PatternRegistry.mapPattern(HexPattern.fromAngles("aawaawaa", HexDir.EAST), modLoc("explode"), - new OpExplode(false)); - PatternRegistry.mapPattern(HexPattern.fromAngles("ddwddwdd", HexDir.EAST), modLoc("explode/fire"), - new OpExplode(true)); - PatternRegistry.mapPattern(HexPattern.fromAngles("awqqqwaqw", HexDir.SOUTH_WEST), modLoc("add_motion"), - OpAddMotion.INSTANCE); - PatternRegistry.mapPattern(HexPattern.fromAngles("awqqqwaq", HexDir.SOUTH_WEST), modLoc("blink"), - OpBlink.INSTANCE); - PatternRegistry.mapPattern(HexPattern.fromAngles("qaqqqqq", HexDir.EAST), modLoc("break_block"), - OpBreakBlock.INSTANCE); - PatternRegistry.mapPattern(HexPattern.fromAngles("eeeeede", HexDir.SOUTH_WEST), modLoc("place_block"), - OpPlaceBlock.INSTANCE); - PatternRegistry.mapPattern(HexPattern.fromAngles("awddwqawqwawq", HexDir.EAST), - modLoc("colorize"), - OpColorize.INSTANCE); - PatternRegistry.mapPattern(HexPattern.fromAngles("aqawqadaq", HexDir.SOUTH_EAST), modLoc("create_water"), - new OpCreateFluid(false, MediaConstants.DUST_UNIT, - Items.WATER_BUCKET, - Blocks.WATER_CAULDRON.defaultBlockState() - .setValue(LayeredCauldronBlock.LEVEL, LayeredCauldronBlock.MAX_FILL_LEVEL), - Fluids.WATER)); - PatternRegistry.mapPattern(HexPattern.fromAngles("dedwedade", HexDir.SOUTH_WEST), - modLoc("destroy_water"), - OpDestroyFluid.INSTANCE); - PatternRegistry.mapPattern(HexPattern.fromAngles("aaqawawa", HexDir.SOUTH_EAST), modLoc("ignite"), - OpIgnite.INSTANCE); - PatternRegistry.mapPattern(HexPattern.fromAngles("ddedwdwd", HexDir.SOUTH_WEST), modLoc("extinguish"), - OpExtinguish.INSTANCE); - PatternRegistry.mapPattern(HexPattern.fromAngles("qqa", HexDir.NORTH_EAST), modLoc("conjure_block"), - new OpConjureBlock(false)); - PatternRegistry.mapPattern(HexPattern.fromAngles("qqd", HexDir.NORTH_EAST), modLoc("conjure_light"), - new OpConjureBlock(true)); - PatternRegistry.mapPattern(HexPattern.fromAngles("wqaqwawqaqw", HexDir.NORTH_EAST), modLoc("bonemeal"), - OpTheOnlyReasonAnyoneDownloadedPsi.INSTANCE); - PatternRegistry.mapPattern(HexPattern.fromAngles("qqqqqwaeaeaeaeaea", HexDir.NORTH_WEST), - modLoc("recharge"), - OpRecharge.INSTANCE); - PatternRegistry.mapPattern(HexPattern.fromAngles("qdqawwaww", HexDir.EAST), modLoc("erase"), - new OpErase()); - PatternRegistry.mapPattern(HexPattern.fromAngles("wqaqwd", HexDir.NORTH_EAST), modLoc("edify"), - OpEdifySapling.INSTANCE); - - PatternRegistry.mapPattern(HexPattern.fromAngles("adaa", HexDir.WEST), modLoc("beep"), - OpBeep.INSTANCE); - - PatternRegistry.mapPattern(HexPattern.fromAngles("waqqqqq", HexDir.EAST), modLoc("craft/cypher"), - new OpMakePackagedSpell<>(HexItems.CYPHER, MediaConstants.CRYSTAL_UNIT)); - PatternRegistry.mapPattern(HexPattern.fromAngles("wwaqqqqqeaqeaeqqqeaeq", HexDir.EAST), - modLoc("craft/trinket"), - new OpMakePackagedSpell<>(HexItems.TRINKET, 5 * MediaConstants.CRYSTAL_UNIT)); - PatternRegistry.mapPattern( - HexPattern.fromAngles("wwaqqqqqeawqwqwqwqwqwwqqeadaeqqeqqeadaeqq", HexDir.EAST), - modLoc("craft/artifact"), - new OpMakePackagedSpell<>(HexItems.ARTIFACT, 10 * MediaConstants.CRYSTAL_UNIT)); - PatternRegistry.mapPattern( - HexPattern.fromAngles("aqqqaqwwaqqqqqeqaqqqawwqwqwqwqwqw", HexDir.SOUTH_WEST), - modLoc("craft/battery"), - OpMakeBattery.INSTANCE, - true); - - PatternRegistry.mapPattern(HexPattern.fromAngles("qqqqqaqwawaw", HexDir.NORTH_WEST), - modLoc("potion/weakness"), - new OpPotionEffect(MobEffects.WEAKNESS, MediaConstants.DUST_UNIT / 10, true, false, false)); - PatternRegistry.mapPattern(HexPattern.fromAngles("qqqqqawwawawd", HexDir.WEST), - modLoc("potion/levitation"), - new OpPotionEffect(MobEffects.LEVITATION, MediaConstants.DUST_UNIT / 5, false, false, false)); - PatternRegistry.mapPattern(HexPattern.fromAngles("qqqqqaewawawe", HexDir.SOUTH_WEST), - modLoc("potion/wither"), - new OpPotionEffect(MobEffects.WITHER, MediaConstants.DUST_UNIT, true, false, false)); - PatternRegistry.mapPattern(HexPattern.fromAngles("qqqqqadwawaww", HexDir.SOUTH_EAST), - modLoc("potion/poison"), - new OpPotionEffect(MobEffects.POISON, MediaConstants.DUST_UNIT / 3, true, false, false)); - PatternRegistry.mapPattern(HexPattern.fromAngles("qqqqqadwawaw", HexDir.SOUTH_EAST), - modLoc("potion/slowness"), - new OpPotionEffect(MobEffects.MOVEMENT_SLOWDOWN, MediaConstants.DUST_UNIT / 3, true, false, false)); - - PatternRegistry.mapPattern(HexPattern.fromAngles("qqqqaawawaedd", HexDir.NORTH_WEST), - modLoc("potion/regeneration"), - new OpPotionEffect(MobEffects.REGENERATION, MediaConstants.DUST_UNIT, true, true, true), true); - PatternRegistry.mapPattern(HexPattern.fromAngles("qqqaawawaeqdd", HexDir.WEST), - modLoc("potion/night_vision"), - new OpPotionEffect(MobEffects.NIGHT_VISION, MediaConstants.DUST_UNIT / 5, false, true, true), true); - PatternRegistry.mapPattern(HexPattern.fromAngles("qqaawawaeqqdd", HexDir.SOUTH_WEST), - modLoc("potion/absorption"), - new OpPotionEffect(MobEffects.ABSORPTION, MediaConstants.DUST_UNIT, true, true, true), true); - PatternRegistry.mapPattern(HexPattern.fromAngles("qaawawaeqqqdd", HexDir.SOUTH_EAST), - modLoc("potion/haste"), - new OpPotionEffect(MobEffects.DIG_SPEED, MediaConstants.DUST_UNIT / 3, true, true, true), true); - PatternRegistry.mapPattern(HexPattern.fromAngles("aawawaeqqqqdd", HexDir.EAST), - modLoc("potion/strength"), - new OpPotionEffect(MobEffects.DAMAGE_BOOST, MediaConstants.DUST_UNIT / 3, true, true, true), true); - - PatternRegistry.mapPattern(HexPattern.fromAngles("waeawae", HexDir.EAST), - modLoc("sentinel/create"), - new OpCreateSentinel(false)); - PatternRegistry.mapPattern(HexPattern.fromAngles("qdwdqdw", HexDir.NORTH_EAST), - modLoc("sentinel/destroy"), - OpDestroySentinel.INSTANCE); - PatternRegistry.mapPattern(HexPattern.fromAngles("waeawaede", HexDir.EAST), - modLoc("sentinel/get_pos"), - OpGetSentinelPos.INSTANCE); - PatternRegistry.mapPattern(HexPattern.fromAngles("waeawaedwa", HexDir.EAST), - modLoc("sentinel/wayfind"), - OpGetSentinelWayfind.INSTANCE); - - PatternRegistry.mapPattern(HexPattern.fromAngles("waadwawdaaweewq", HexDir.EAST), - modLoc("lightning"), OpLightning.INSTANCE, true); - PatternRegistry.mapPattern(HexPattern.fromAngles("eawwaeawawaa", HexDir.NORTH_WEST), - modLoc("flight"), OpFlight.INSTANCE, true); - PatternRegistry.mapPattern(HexPattern.fromAngles("eaqawqadaqd", HexDir.EAST), - modLoc("create_lava"), new OpCreateFluid(true, MediaConstants.CRYSTAL_UNIT, - Items.LAVA_BUCKET, - Blocks.LAVA_CAULDRON.defaultBlockState(), - Fluids.LAVA), true); - PatternRegistry.mapPattern( - HexPattern.fromAngles("wwwqqqwwwqqeqqwwwqqwqqdqqqqqdqq", HexDir.EAST), - modLoc("teleport"), OpTeleport.INSTANCE, true); - PatternRegistry.mapPattern(HexPattern.fromAngles("waeawaeqqqwqwqqwq", HexDir.EAST), - modLoc("sentinel/create/great"), - new OpCreateSentinel(true), true); - PatternRegistry.mapPattern(HexPattern.fromAngles("eeewwweeewwaqqddqdqd", HexDir.EAST), - modLoc("dispel_rain"), - new OpWeather(false), true); - PatternRegistry.mapPattern(HexPattern.fromAngles("wwweeewwweewdawdwad", HexDir.WEST), - modLoc("summon_rain"), - new OpWeather(true), true); - PatternRegistry.mapPattern(HexPattern.fromAngles("qeqwqwqwqwqeqaeqeaqeqaeqaqded", HexDir.NORTH_EAST), - modLoc("brainsweep"), - OpBrainsweep.INSTANCE, true); - - PatternRegistry.mapPattern(HexPattern.fromAngles("qqqwqqqqqaq", HexDir.WEST), modLoc("akashic/read"), - OpAkashicRead.INSTANCE); - PatternRegistry.mapPattern(HexPattern.fromAngles("eeeweeeeede", HexDir.EAST), modLoc("akashic/write"), - OpAkashicWrite.INSTANCE); - - // == Meta stuff == - - // Intro/Retro/Consideration are now special-form-likes and aren't even ops. - // TODO should there be a registry for these too - - // http://www.toroidalsnark.net/mkss3-pix/CalderheadJMM2014.pdf - // eval being a space filling curve feels apt doesn't it - PatternRegistry.mapPattern(HexPattern.fromAngles("deaqq", HexDir.SOUTH_EAST), modLoc("eval"), - OpEval.INSTANCE); - PatternRegistry.mapPattern(HexPattern.fromAngles("aqdee", HexDir.SOUTH_WEST), modLoc("halt"), - OpHalt.INSTANCE); - - PatternRegistry.mapPattern(HexPattern.fromAngles("aqqqqq", HexDir.EAST), modLoc("read"), - OpRead.INSTANCE); - PatternRegistry.mapPattern(HexPattern.fromAngles("wawqwqwqwqwqw", HexDir.EAST), - modLoc("read/entity"), OpTheCoolerRead.INSTANCE); - PatternRegistry.mapPattern(HexPattern.fromAngles("deeeee", HexDir.EAST), modLoc("write"), - OpWrite.INSTANCE); - PatternRegistry.mapPattern(HexPattern.fromAngles("wdwewewewewew", HexDir.EAST), - modLoc("write/entity"), OpTheCoolerWrite.INSTANCE); - PatternRegistry.mapPattern(HexPattern.fromAngles("aqqqqqe", HexDir.EAST), modLoc("readable"), - OpReadable.INSTANCE); - PatternRegistry.mapPattern(HexPattern.fromAngles("wawqwqwqwqwqwew", HexDir.EAST), - modLoc("readable/entity"), OpTheCoolerReadable.INSTANCE); - PatternRegistry.mapPattern(HexPattern.fromAngles("deeeeeq", HexDir.EAST), modLoc("writable"), - OpWritable.INSTANCE); - PatternRegistry.mapPattern(HexPattern.fromAngles("wdwewewewewewqw", HexDir.EAST), - modLoc("writable/entity"), OpTheCoolerWritable.INSTANCE); - - // lorge boyes - - - PatternRegistry.mapPattern(HexPattern.fromAngles("qeewdweddw", HexDir.NORTH_EAST), - modLoc("read/local"), OpPeekLocal.INSTANCE); - PatternRegistry.mapPattern(HexPattern.fromAngles("eqqwawqaaw", HexDir.NORTH_WEST), - modLoc("write/local"), OpPushLocal.INSTANCE); - - // == Consts == - - PatternRegistry.mapPattern(HexPattern.fromAngles("d", HexDir.EAST), modLoc("const/null"), - Action.makeConstantOp(new NullIota())); - - PatternRegistry.mapPattern(HexPattern.fromAngles("aqae", HexDir.SOUTH_EAST), modLoc("const/true"), - Action.makeConstantOp(new BooleanIota(true))); - PatternRegistry.mapPattern(HexPattern.fromAngles("dedq", HexDir.NORTH_EAST), modLoc("const/false"), - Action.makeConstantOp(new BooleanIota(false))); - - PatternRegistry.mapPattern(HexPattern.fromAngles("qqqqqea", HexDir.NORTH_WEST), modLoc("const/vec/px"), - Action.makeConstantOp(new Vec3Iota(new Vec3(1.0, 0.0, 0.0)))); - PatternRegistry.mapPattern(HexPattern.fromAngles("qqqqqew", HexDir.NORTH_WEST), modLoc("const/vec/py"), - Action.makeConstantOp(new Vec3Iota(new Vec3(0.0, 1.0, 0.0)))); - PatternRegistry.mapPattern(HexPattern.fromAngles("qqqqqed", HexDir.NORTH_WEST), modLoc("const/vec/pz"), - Action.makeConstantOp(new Vec3Iota(new Vec3(0.0, 0.0, 1.0)))); - PatternRegistry.mapPattern(HexPattern.fromAngles("eeeeeqa", HexDir.SOUTH_WEST), modLoc("const/vec/nx"), - Action.makeConstantOp(new Vec3Iota(new Vec3(-1.0, 0.0, 0.0)))); - PatternRegistry.mapPattern(HexPattern.fromAngles("eeeeeqw", HexDir.SOUTH_WEST), modLoc("const/vec/ny"), - Action.makeConstantOp(new Vec3Iota(new Vec3(0.0, -1.0, 0.0)))); - PatternRegistry.mapPattern(HexPattern.fromAngles("eeeeeqd", HexDir.SOUTH_WEST), modLoc("const/vec/nz"), - Action.makeConstantOp(new Vec3Iota(new Vec3(0.0, 0.0, -1.0)))); - // Yep, this is what I spend the "plain hexagon" pattern on. - PatternRegistry.mapPattern(HexPattern.fromAngles("qqqqq", HexDir.NORTH_WEST), modLoc("const/vec/0"), - Action.makeConstantOp(new Vec3Iota(new Vec3(0.0, 0.0, 0.0)))); - - PatternRegistry.mapPattern(HexPattern.fromAngles("qdwdq", HexDir.NORTH_EAST), modLoc("const/double/pi"), - Action.makeConstantOp(new DoubleIota(Math.PI))); - PatternRegistry.mapPattern(HexPattern.fromAngles("eawae", HexDir.NORTH_WEST), modLoc("const/double/tau"), - Action.makeConstantOp(new DoubleIota(HexUtils.TAU))); - - // e - PatternRegistry.mapPattern(HexPattern.fromAngles("aaq", HexDir.EAST), modLoc("const/double/e"), - Action.makeConstantOp(new DoubleIota(Math.E))); - - // == Entities == - - PatternRegistry.mapPattern(HexPattern.fromAngles("qqqqqdaqa", HexDir.SOUTH_EAST), modLoc("get_entity"), - new OpGetEntityAt(e -> true)); - PatternRegistry.mapPattern(HexPattern.fromAngles("qqqqqdaqaawa", HexDir.SOUTH_EAST), - modLoc("get_entity/animal"), - new OpGetEntityAt(OpGetEntitiesBy::isAnimal)); - PatternRegistry.mapPattern(HexPattern.fromAngles("qqqqqdaqaawq", HexDir.SOUTH_EAST), - modLoc("get_entity/monster"), - new OpGetEntityAt(OpGetEntitiesBy::isMonster)); - PatternRegistry.mapPattern(HexPattern.fromAngles("qqqqqdaqaaww", HexDir.SOUTH_EAST), - modLoc("get_entity/item"), - new OpGetEntityAt(OpGetEntitiesBy::isItem)); - PatternRegistry.mapPattern(HexPattern.fromAngles("qqqqqdaqaawe", HexDir.SOUTH_EAST), - modLoc("get_entity/player"), - new OpGetEntityAt(OpGetEntitiesBy::isPlayer)); - PatternRegistry.mapPattern(HexPattern.fromAngles("qqqqqdaqaawd", HexDir.SOUTH_EAST), - modLoc("get_entity/living"), - new OpGetEntityAt(OpGetEntitiesBy::isLiving)); - - PatternRegistry.mapPattern(HexPattern.fromAngles("qqqqqwded", HexDir.SOUTH_EAST), modLoc("zone_entity"), - new OpGetEntitiesBy(e -> true, false)); - PatternRegistry.mapPattern(HexPattern.fromAngles("qqqqqwdeddwa", HexDir.SOUTH_EAST), - modLoc("zone_entity/animal"), - new OpGetEntitiesBy(OpGetEntitiesBy::isAnimal, false)); - PatternRegistry.mapPattern(HexPattern.fromAngles("eeeeewaqaawa", HexDir.NORTH_EAST), - modLoc("zone_entity/not_animal"), - new OpGetEntitiesBy(OpGetEntitiesBy::isAnimal, true)); - PatternRegistry.mapPattern(HexPattern.fromAngles("qqqqqwdeddwq", HexDir.SOUTH_EAST), - modLoc("zone_entity/monster"), - new OpGetEntitiesBy(OpGetEntitiesBy::isMonster, false)); - PatternRegistry.mapPattern(HexPattern.fromAngles("eeeeewaqaawq", HexDir.NORTH_EAST), - modLoc("zone_entity/not_monster"), - new OpGetEntitiesBy(OpGetEntitiesBy::isMonster, true)); - PatternRegistry.mapPattern(HexPattern.fromAngles("qqqqqwdeddww", HexDir.SOUTH_EAST), - modLoc("zone_entity/item"), - new OpGetEntitiesBy(OpGetEntitiesBy::isItem, false)); - PatternRegistry.mapPattern(HexPattern.fromAngles("eeeeewaqaaww", HexDir.NORTH_EAST), - modLoc("zone_entity/not_item"), - new OpGetEntitiesBy(OpGetEntitiesBy::isItem, true)); - PatternRegistry.mapPattern(HexPattern.fromAngles("qqqqqwdeddwe", HexDir.SOUTH_EAST), - modLoc("zone_entity/player"), - new OpGetEntitiesBy(OpGetEntitiesBy::isPlayer, false)); - PatternRegistry.mapPattern(HexPattern.fromAngles("eeeeewaqaawe", HexDir.NORTH_EAST), - modLoc("zone_entity/not_player"), - new OpGetEntitiesBy(OpGetEntitiesBy::isPlayer, true)); - PatternRegistry.mapPattern(HexPattern.fromAngles("qqqqqwdeddwd", HexDir.SOUTH_EAST), - modLoc("zone_entity/living"), - new OpGetEntitiesBy(OpGetEntitiesBy::isLiving, false)); - PatternRegistry.mapPattern(HexPattern.fromAngles("eeeeewaqaawd", HexDir.NORTH_EAST), - modLoc("zone_entity/not_living"), - new OpGetEntitiesBy(OpGetEntitiesBy::isLiving, true)); - - // == Lists == - - PatternRegistry.mapPattern(HexPattern.fromAngles("edqde", HexDir.SOUTH_WEST), modLoc("append"), - OpAppend.INSTANCE); - PatternRegistry.mapPattern(HexPattern.fromAngles("qaeaq", HexDir.NORTH_WEST), modLoc("concat"), - OpConcat.INSTANCE); - PatternRegistry.mapPattern(HexPattern.fromAngles("deeed", HexDir.NORTH_WEST), modLoc("index"), - OpIndex.INSTANCE); - PatternRegistry.mapPattern(HexPattern.fromAngles("dadad", HexDir.NORTH_EAST), modLoc("for_each"), - OpForEach.INSTANCE); - PatternRegistry.mapPattern(HexPattern.fromAngles("aqaeaq", HexDir.EAST), modLoc("list_size"), - OpListSize.INSTANCE); - PatternRegistry.mapPattern(HexPattern.fromAngles("adeeed", HexDir.EAST), modLoc("singleton"), - OpSingleton.INSTANCE); - PatternRegistry.mapPattern(HexPattern.fromAngles("qqaeaae", HexDir.NORTH_EAST), modLoc("empty_list"), - OpEmptyList.INSTANCE); - PatternRegistry.mapPattern(HexPattern.fromAngles("qqqaede", HexDir.EAST), modLoc("reverse_list"), - OpReverski.INSTANCE); - PatternRegistry.mapPattern(HexPattern.fromAngles("ewdqdwe", HexDir.SOUTH_WEST), modLoc("last_n_list"), - OpLastNToList.INSTANCE); - PatternRegistry.mapPattern(HexPattern.fromAngles("qwaeawq", HexDir.NORTH_WEST), modLoc("splat"), - OpSplat.INSTANCE); - PatternRegistry.mapPattern(HexPattern.fromAngles("dedqde", HexDir.EAST), modLoc("index_of"), - OpIndexOf.INSTANCE); - PatternRegistry.mapPattern(HexPattern.fromAngles("edqdewaqa", HexDir.SOUTH_WEST), modLoc("list_remove"), - OpRemove.INSTANCE); - PatternRegistry.mapPattern(HexPattern.fromAngles("qaeaqwded", HexDir.NORTH_WEST), modLoc("slice"), - OpSlice.INSTANCE); - PatternRegistry.mapPattern(HexPattern.fromAngles("wqaeaqw", HexDir.NORTH_WEST), - modLoc("modify_in_place"), - OpModifyInPlace.INSTANCE); - PatternRegistry.mapPattern(HexPattern.fromAngles("ddewedd", HexDir.SOUTH_EAST), modLoc("construct"), - OpCons.INSTANCE); - PatternRegistry.mapPattern(HexPattern.fromAngles("aaqwqaa", HexDir.SOUTH_WEST), modLoc("deconstruct"), - OpUnCons.INSTANCE); - - } catch (PatternRegistry.RegisterPatternException exn) { - exn.printStackTrace(); - } - - // Add zilde->number - PatternRegistry.addSpecialHandler(modLoc("number"), pat -> { - var sig = pat.anglesSignature(); - if (sig.startsWith("aqaa") || sig.startsWith("dedd")) { - var negate = sig.startsWith("dedd"); - var accumulator = 0.0; - for (char ch : sig.substring(4).toCharArray()) { - if (ch == 'w') { - accumulator += 1; - } else if (ch == 'q') { - accumulator += 5; - } else if (ch == 'e') { - accumulator += 10; - } else if (ch == 'a') { - accumulator *= 2; - } else if (ch == 'd') { - accumulator /= 2; - } - } - if (negate) { - accumulator = -accumulator; - } - return Action.makeConstantOp(accumulator, modLoc("number")); - } else { - return null; - } - }); - - PatternRegistry.addSpecialHandler(modLoc("mask"), pat -> { - var directions = pat.directions(); - - HexDir flatDir = pat.getStartDir(); - if (!pat.getAngles().isEmpty() && pat.getAngles().get(0) == HexAngle.LEFT_BACK) { - flatDir = directions.get(0).rotatedBy(HexAngle.LEFT); - } - - var mask = new BooleanArrayList(); - for (int i = 0; i < directions.size(); i++) { - // Angle with respect to the *start direction* - var angle = directions.get(i).angleFrom(flatDir); - if (angle == HexAngle.FORWARD) { - mask.add(true); - continue; - } - if (i >= directions.size() - 1) { - // then we're out of angles! - return null; - } - var angle2 = directions.get(i + 1).angleFrom(flatDir); - if (angle == HexAngle.RIGHT && angle2 == HexAngle.LEFT) { - mask.add(false); - i++; - continue; - } - - return null; - } - - return new OpMask(mask, modLoc("mask")); - }); - } -} diff --git a/Fabric/src/main/java/at/petrak/hexcasting/fabric/FabricHexInitializer.kt b/Fabric/src/main/java/at/petrak/hexcasting/fabric/FabricHexInitializer.kt index 392684f0..e0db1d75 100644 --- a/Fabric/src/main/java/at/petrak/hexcasting/fabric/FabricHexInitializer.kt +++ b/Fabric/src/main/java/at/petrak/hexcasting/fabric/FabricHexInitializer.kt @@ -11,7 +11,7 @@ import at.petrak.hexcasting.common.entities.HexEntities import at.petrak.hexcasting.common.items.ItemJewelerHammer import at.petrak.hexcasting.common.items.ItemLens import at.petrak.hexcasting.common.lib.* -import at.petrak.hexcasting.common.lib.hex.HexActionsAndHandlers +import at.petrak.hexcasting.common.lib.hex.HexActions import at.petrak.hexcasting.common.lib.hex.HexEvalSounds import at.petrak.hexcasting.common.lib.hex.HexIotaTypes import at.petrak.hexcasting.common.loot.HexLootHandler @@ -54,7 +54,7 @@ object FabricHexInitializer : ModInitializer { PatternResLocArgument::class.java, SingletonArgumentInfo.contextFree { PatternResLocArgument.id() } ) - HexActionsAndHandlers.registerPatterns() + HexActions.registerPatterns() HexAdvancementTriggers.registerTriggers() HexComposting.setup() HexStrippables.init() diff --git a/Forge/src/main/java/at/petrak/hexcasting/forge/ForgeHexInitializer.java b/Forge/src/main/java/at/petrak/hexcasting/forge/ForgeHexInitializer.java index f8644c5b..748ffcc3 100644 --- a/Forge/src/main/java/at/petrak/hexcasting/forge/ForgeHexInitializer.java +++ b/Forge/src/main/java/at/petrak/hexcasting/forge/ForgeHexInitializer.java @@ -12,7 +12,7 @@ import at.petrak.hexcasting.common.entities.HexEntities; import at.petrak.hexcasting.common.items.ItemJewelerHammer; import at.petrak.hexcasting.common.items.ItemLens; import at.petrak.hexcasting.common.lib.*; -import at.petrak.hexcasting.common.lib.hex.HexActionsAndHandlers; +import at.petrak.hexcasting.common.lib.hex.HexActions; import at.petrak.hexcasting.common.lib.hex.HexEvalSounds; import at.petrak.hexcasting.common.lib.hex.HexIotaTypes; import at.petrak.hexcasting.common.loot.HexLootHandler; @@ -133,7 +133,7 @@ public class ForgeHexInitializer { ForgePacketHandler.init(); HexComposting.setup(); HexStrippables.init(); - HexActionsAndHandlers.registerPatterns(); + HexActions.registerPatterns(); // Forge does not strictly require TreeGrowers to initialize during early game stages, unlike Fabric // and Quilt. // However, all launcher panic if the same resource is registered twice. But do need blocks and From 5d8b7a61eb44395ba3799000a691d50427e37c20 Mon Sep 17 00:00:00 2001 From: "petrak@" Date: Fri, 20 Jan 2023 13:27:35 -0600 Subject: [PATCH 35/95] this does not compile even a little bit but i'm pushing so i'm not anxious having code on my HD --- .../main/java/at/petrak/hexcasting/README.md | 8 +- .../java/at/petrak/hexcasting/api/HexAPI.java | 25 ++ .../hexcasting/api/PatternRegistry.java | 324 ------------------ .../petrak/hexcasting/api/SpecialHandler.java | 17 - .../hexcasting/api/addldata/ADHexHolder.java | 2 +- .../hexcasting/api/addldata/ADIotaHolder.java | 2 +- .../ItemDelegatingEntityIotaHolder.java | 2 +- .../block/circle/BlockAbstractImpetus.java | 2 +- .../block/circle/BlockCircleComponent.java | 2 +- .../circle/BlockEntityAbstractImpetus.java | 10 +- .../api/{spell => casting}/Action.kt | 26 +- .../ActionRegistryEntry.java | 4 +- .../{spell => casting}/ConstMediaAction.kt | 12 +- .../api/{spell => casting}/OperationResult.kt | 8 +- .../api/{spell => casting}/OperatorUtils.kt | 10 +- .../api/{spell => casting}/ParticleSpray.kt | 2 +- .../api/casting/PatternShapeMatch.java | 56 +++ .../hexcasting/api/casting/RenderedSpell.kt | 7 + .../api/casting/SpecialHandler.java | 40 +++ .../api/{spell => casting}/SpellAction.kt | 12 +- .../api/{spell => casting}/SpellList.kt | 4 +- .../eval}/CastingContext.kt | 10 +- .../eval}/CastingHarness.kt | 199 +++++------ .../eval}/ControllerInfo.kt | 2 +- .../eval}/ResolvedPattern.kt | 6 +- .../eval}/ResolvedPatternType.kt | 2 +- .../eval}/SpecialPatterns.java | 6 +- .../eval}/SpellCircleContext.kt | 2 +- .../eval}/sideeffects/EvalSound.java | 2 +- .../eval}/sideeffects/OperatorSideEffect.kt | 12 +- .../eval/vm}/ContinuationFrame.kt | 10 +- .../eval => casting/eval/vm}/FrameEvaluate.kt | 10 +- .../eval/vm}/FrameFinishEval.kt | 8 +- .../eval => casting/eval/vm}/FrameForEach.kt | 12 +- .../eval/vm}/FunctionalData.kt | 4 +- .../eval/vm}/SpellContinuation.kt | 2 +- .../{spell => casting}/iota/BooleanIota.java | 2 +- .../{spell => casting}/iota/DoubleIota.java | 2 +- .../{spell => casting}/iota/EntityIota.java | 2 +- .../{spell => casting}/iota/GarbageIota.java | 2 +- .../api/{spell => casting}/iota/Iota.java | 2 +- .../api/{spell => casting}/iota/IotaType.java | 2 +- .../api/{spell => casting}/iota/ListIota.java | 4 +- .../api/{spell => casting}/iota/NullIota.java | 2 +- .../{spell => casting}/iota/PatternIota.java | 4 +- .../api/{spell => casting}/iota/Vec3Iota.java | 2 +- .../math/EulerPathFinder.kt | 2 +- .../api/{spell => casting}/math/HexAngle.kt | 2 +- .../api/{spell => casting}/math/HexCoord.kt | 2 +- .../api/{spell => casting}/math/HexDir.kt | 2 +- .../api/{spell => casting}/math/HexPattern.kt | 2 +- .../api/{spell => casting}/mishaps/Mishap.kt | 32 +- .../mishaps/MishapAlreadyBrainswept.kt | 8 +- .../mishaps/MishapBadBlock.kt | 8 +- .../mishaps/MishapBadBrainsweep.kt | 8 +- .../mishaps/MishapBadEntity.kt | 8 +- .../mishaps/MishapBadItem.kt | 10 +- .../mishaps/MishapBadOffhandItem.kt | 10 +- .../mishaps/MishapDisallowedSpell.kt | 10 +- .../mishaps/MishapDivideByZero.kt | 12 +- .../mishaps/MishapEntityTooFarAway.kt | 8 +- .../{spell => casting}/mishaps/MishapError.kt | 8 +- .../mishaps/MishapEvalTooDeep.kt | 6 +- .../mishaps/MishapImmuneEntity.kt | 8 +- .../mishaps/MishapInvalidIota.kt | 10 +- .../mishaps/MishapInvalidPattern.kt | 10 +- .../mishaps/MishapInvalidSpellDatumType.kt | 6 +- .../mishaps/MishapLocationInWrongDimension.kt | 10 +- .../mishaps/MishapLocationTooFarAway.kt | 10 +- .../mishaps/MishapNoAkashicRecord.kt | 6 +- .../mishaps/MishapNoSpellCircle.kt | 8 +- .../mishaps/MishapNotEnoughArgs.kt | 12 +- .../mishaps/MishapOthersName.kt | 10 +- .../mishaps/MishapShameOnYou.kt | 6 +- .../mishaps/MishapTooManyCloseParens.kt | 8 +- .../mishaps/MishapUnescapedValue.kt | 6 +- .../hexcasting/api/item/HexHolderItem.java | 2 +- .../hexcasting/api/item/IotaHolderItem.java | 4 +- .../api/misc/DiscoveryHandlers.java | 4 +- .../at/petrak/hexcasting/api/mod/HexTags.java | 2 +- .../hexcasting/api/spell/RenderedSpell.kt | 7 - .../petrak/hexcasting/api/utils/HexUtils.kt | 6 +- .../api/utils/PatternNameHelper.java | 37 +- .../client/PatternShapeMatcher.java | 4 + .../at/petrak/hexcasting/client/RenderLib.kt | 2 +- .../BlockEntityAkashicBookshelfRenderer.java | 2 +- .../hexcasting/client/gui/GuiSpellcasting.kt | 14 +- .../client/gui/PatternTooltipComponent.java | 2 +- .../blocks/akashic/BlockAkashicBookshelf.java | 2 +- .../blocks/akashic/BlockAkashicRecord.java | 4 +- .../akashic/BlockEntityAkashicBookshelf.java | 4 +- .../blocks/circles/BlockEmptyImpetus.java | 2 +- .../blocks/circles/BlockEntitySlate.java | 2 +- .../common/blocks/circles/BlockSlate.java | 4 +- .../directrix/BlockEmptyDirectrix.java | 2 +- .../directrix/BlockRedstoneDirectrix.java | 2 +- .../impetuses/BlockStoredPlayerImpetus.java | 2 +- .../casting/PatternRegistryManifest.java | 200 +++++++++++ .../casting/operators/OpBlockAxisRaycast.kt | 14 +- .../casting/operators/OpBlockRaycast.kt | 14 +- .../casting/operators/OpEntityHeight.kt | 10 +- .../common/casting/operators/OpEntityLook.kt | 10 +- .../common/casting/operators/OpEntityPos.kt | 10 +- .../casting/operators/OpEntityRaycast.kt | 14 +- .../casting/operators/OpEntityVelocity.kt | 10 +- .../operators/akashic/OpAkashicRead.kt | 14 +- .../operators/akashic/OpAkashicWrite.kt | 12 +- .../operators/circles/OpCircleBounds.kt | 10 +- .../casting/operators/circles/OpImpetusDir.kt | 10 +- .../casting/operators/circles/OpImpetusPos.kt | 10 +- .../common/casting/operators/eval/OpEval.kt | 22 +- .../casting/operators/eval/OpEvalDelay.kt | 10 +- .../casting/operators/eval/OpForEach.kt | 16 +- .../common/casting/operators/eval/OpHalt.kt | 10 +- .../casting/operators/lists/OpAppend.kt | 10 +- .../casting/operators/lists/OpConcat.kt | 10 +- .../common/casting/operators/lists/OpCons.kt | 12 +- .../casting/operators/lists/OpEmptyList.kt | 8 +- .../common/casting/operators/lists/OpIndex.kt | 12 +- .../casting/operators/lists/OpIndexOf.kt | 10 +- .../casting/operators/lists/OpLastNToList.kt | 16 +- .../casting/operators/lists/OpListSize.kt | 10 +- .../operators/lists/OpModifyInPlace.kt | 6 +- .../casting/operators/lists/OpRemove.kt | 12 +- .../casting/operators/lists/OpReverski.kt | 10 +- .../casting/operators/lists/OpSingleton.kt | 8 +- .../common/casting/operators/lists/OpSlice.kt | 12 +- .../common/casting/operators/lists/OpSplat.kt | 8 +- .../casting/operators/lists/OpUnCons.kt | 12 +- .../casting/operators/local/OpPeekLocal.kt | 12 +- .../casting/operators/local/OpPushLocal.kt | 12 +- .../common/casting/operators/math/OpAbsLen.kt | 10 +- .../common/casting/operators/math/OpAdd.kt | 10 +- .../common/casting/operators/math/OpCeil.kt | 10 +- .../casting/operators/math/OpCoerceToAxial.kt | 10 +- .../casting/operators/math/OpConstructVec.kt | 10 +- .../operators/math/OpDeconstructVec.kt | 10 +- .../casting/operators/math/OpDivCross.kt | 12 +- .../common/casting/operators/math/OpFloor.kt | 10 +- .../common/casting/operators/math/OpLog.kt | 12 +- .../common/casting/operators/math/OpModulo.kt | 12 +- .../common/casting/operators/math/OpMulDot.kt | 10 +- .../casting/operators/math/OpNumberLiteral.kt | 23 ++ .../casting/operators/math/OpPowProj.kt | 12 +- .../common/casting/operators/math/OpRandom.kt | 8 +- .../common/casting/operators/math/OpSub.kt | 10 +- .../math/SpecialHandlerNumberLiteral.kt | 81 +++++ .../casting/operators/math/bit/OpAnd.kt | 6 +- .../casting/operators/math/bit/OpNot.kt | 10 +- .../common/casting/operators/math/bit/OpOr.kt | 6 +- .../casting/operators/math/bit/OpToSet.kt | 10 +- .../casting/operators/math/bit/OpXor.kt | 6 +- .../casting/operators/math/logic/OpBoolAnd.kt | 10 +- .../casting/operators/math/logic/OpBoolIf.kt | 8 +- .../casting/operators/math/logic/OpBoolNot.kt | 10 +- .../casting/operators/math/logic/OpBoolOr.kt | 10 +- .../casting/operators/math/logic/OpBoolXor.kt | 10 +- .../operators/math/logic/OpCoerceToBool.kt | 8 +- .../casting/operators/math/logic/OpCompare.kt | 12 +- .../operators/math/logic/OpEquality.kt | 8 +- .../casting/operators/math/trig/OpArcCos.kt | 10 +- .../casting/operators/math/trig/OpArcSin.kt | 10 +- .../casting/operators/math/trig/OpArcTan.kt | 10 +- .../casting/operators/math/trig/OpArcTan2.kt | 10 +- .../casting/operators/math/trig/OpCos.kt | 10 +- .../casting/operators/math/trig/OpSin.kt | 10 +- .../casting/operators/math/trig/OpTan.kt | 14 +- .../common/casting/operators/rw/OpRead.kt | 8 +- .../common/casting/operators/rw/OpReadable.kt | 8 +- .../casting/operators/rw/OpTheCoolerRead.kt | 10 +- .../operators/rw/OpTheCoolerReadable.kt | 10 +- .../operators/rw/OpTheCoolerWritable.kt | 12 +- .../casting/operators/rw/OpTheCoolerWrite.kt | 16 +- .../common/casting/operators/rw/OpWritable.kt | 10 +- .../common/casting/operators/rw/OpWrite.kt | 14 +- .../operators/selectors/OpGetCaster.kt | 8 +- .../operators/selectors/OpGetEntitiesBy.kt | 14 +- .../operators/selectors/OpGetEntityAt.kt | 10 +- .../casting/operators/spells/OpAddMotion.kt | 6 +- .../common/casting/operators/spells/OpBeep.kt | 6 +- .../casting/operators/spells/OpBlink.kt | 10 +- .../casting/operators/spells/OpBreakBlock.kt | 12 +- .../casting/operators/spells/OpColorize.kt | 12 +- .../operators/spells/OpConjureBlock.kt | 14 +- .../casting/operators/spells/OpCreateFluid.kt | 12 +- .../operators/spells/OpDestroyFluid.kt | 12 +- .../operators/spells/OpEdifySapling.kt | 14 +- .../casting/operators/spells/OpErase.kt | 12 +- .../casting/operators/spells/OpExplode.kt | 6 +- .../casting/operators/spells/OpExtinguish.kt | 12 +- .../casting/operators/spells/OpIgnite.kt | 12 +- .../casting/operators/spells/OpMakeBattery.kt | 16 +- .../operators/spells/OpMakePackagedSpell.kt | 12 +- .../casting/operators/spells/OpPlaceBlock.kt | 14 +- .../operators/spells/OpPotionEffect.kt | 6 +- .../casting/operators/spells/OpPrint.kt | 16 +- .../casting/operators/spells/OpRecharge.kt | 16 +- .../OpTheOnlyReasonAnyoneDownloadedPsi.kt | 12 +- .../operators/spells/great/OpBrainsweep.kt | 10 +- .../operators/spells/great/OpFlight.kt | 6 +- .../operators/spells/great/OpLightning.kt | 12 +- .../operators/spells/great/OpTeleport.kt | 10 +- .../operators/spells/great/OpWeather.kt | 10 +- .../spells/sentinel/OpCreateSentinel.kt | 12 +- .../spells/sentinel/OpDestroySentinel.kt | 12 +- .../spells/sentinel/OpGetSentinelPos.kt | 12 +- .../spells/sentinel/OpGetSentinelWayfind.kt | 14 +- .../OpAlwinfyHasAscendedToABeingOfPureMath.kt | 14 +- .../casting/operators/stack/OpBitMask.kt | 14 +- .../casting/operators/stack/OpDuplicateN.kt | 10 +- .../casting/operators/stack/OpFisherman.kt | 16 +- .../operators/stack/OpFishermanButItCopies.kt | 14 +- .../common/casting/operators/stack/OpMask.kt | 12 +- .../casting/operators/stack/OpStackSize.kt | 12 +- .../casting/operators/stack/OpTwiddling.kt | 6 +- .../operators/stack/SpecialHandlerMask.kt | 84 +++++ .../common/command/ListPatternsCommand.java | 10 +- .../common/command/PatternResLocArgument.java | 8 +- .../common/command/RecalcPatternsCommand.java | 5 +- .../common/entities/EntityWallScroll.java | 2 +- .../hexcasting/common/impl/HexAPIImpl.java | 6 + .../hexcasting/common/items/ItemAbacus.java | 4 +- .../hexcasting/common/items/ItemFocus.java | 4 +- .../hexcasting/common/items/ItemScroll.java | 6 +- .../hexcasting/common/items/ItemSlate.java | 6 +- .../common/items/ItemSpellbook.java | 4 +- .../common/items/magic/ItemPackagedHex.java | 6 +- .../hexcasting/common/lib/hex/HexActions.java | 16 +- .../common/lib/hex/HexEvalSounds.java | 2 +- .../common/lib/hex/HexIotaTypes.java | 2 +- .../common/lib/hex/HexSpecialHandlers.java | 42 +++ .../common/loot/PatternScrollFunc.java | 6 +- .../common/misc/PatternTooltip.java | 2 +- .../common/network/MsgCastParticleAck.java | 2 +- .../common/network/MsgNewSpellPatternAck.java | 4 +- .../common/network/MsgNewSpellPatternSyn.java | 12 +- .../common/network/MsgOpenSpellGuiAck.java | 2 +- .../patchouli/AbstractPatternComponent.java | 4 +- .../patchouli/LookupPatternComponent.java | 8 +- .../patchouli/ManualPatternComponent.java | 6 +- .../hexcasting/interop/pehkui/OpGetScale.kt | 10 +- .../hexcasting/interop/pehkui/OpSetScale.kt | 6 +- .../interop/pehkui/PehkuiInterop.java | 12 +- .../interop/utils/PatternDrawingUtil.java | 4 +- .../interop/utils/PatternEntry.java | 4 +- .../hexcasting/xplat/IXplatAbstractions.java | 14 +- .../assets/hexcasting/lang/en_us.json | 284 +++++++-------- Common/src/test/java/EulerPathFinderTest.kt | 6 +- .../fabric/FabricHexClientInitializer.kt | 15 +- .../hexcasting/fabric/FabricHexInitializer.kt | 12 +- .../hexcasting/fabric/cc/CCHarness.java | 4 +- .../hexcasting/fabric/cc/CCPatterns.java | 2 +- .../fabric/cc/HexCardinalComponents.java | 2 +- .../fabric/cc/adimpl/CCEntityIotaHolder.java | 2 +- .../fabric/cc/adimpl/CCHexHolder.java | 2 +- .../fabric/cc/adimpl/CCItemIotaHolder.java | 2 +- .../interop/emi/PatternRendererEMI.java | 6 +- .../interop/gravity/GravityApiInterop.java | 12 +- .../fabric/interop/gravity/OpChangeGravity.kt | 6 +- .../fabric/interop/gravity/OpGetGravity.kt | 10 +- .../fabric/xplat/FabricXplatImpl.java | 19 +- .../forge/ForgeHexClientInitializer.java | 11 +- .../hexcasting/forge/ForgeHexInitializer.java | 15 +- .../forge/cap/ForgeCapabilityHandler.java | 2 +- .../forge/cap/adimpl/CapEntityIotaHolder.java | 2 +- .../forge/cap/adimpl/CapItemHexHolder.java | 2 +- .../forge/cap/adimpl/CapItemIotaHolder.java | 2 +- .../forge/cap/adimpl/CapStaticIotaHolder.java | 2 +- .../forge/interop/jei/PatternDrawable.java | 6 +- .../forge/recipe/ForgeUnsealedIngredient.java | 2 +- .../forge/xplat/ForgeXplatImpl.java | 19 +- 271 files changed, 1900 insertions(+), 1656 deletions(-) delete mode 100644 Common/src/main/java/at/petrak/hexcasting/api/PatternRegistry.java delete mode 100644 Common/src/main/java/at/petrak/hexcasting/api/SpecialHandler.java rename Common/src/main/java/at/petrak/hexcasting/api/{spell => casting}/Action.kt (72%) rename Common/src/main/java/at/petrak/hexcasting/api/{spell => casting}/ActionRegistryEntry.java (83%) rename Common/src/main/java/at/petrak/hexcasting/api/{spell => casting}/ConstMediaAction.kt (70%) rename Common/src/main/java/at/petrak/hexcasting/api/{spell => casting}/OperationResult.kt (50%) rename Common/src/main/java/at/petrak/hexcasting/api/{spell => casting}/OperatorUtils.kt (97%) rename Common/src/main/java/at/petrak/hexcasting/api/{spell => casting}/ParticleSpray.kt (95%) create mode 100644 Common/src/main/java/at/petrak/hexcasting/api/casting/PatternShapeMatch.java create mode 100644 Common/src/main/java/at/petrak/hexcasting/api/casting/RenderedSpell.kt create mode 100644 Common/src/main/java/at/petrak/hexcasting/api/casting/SpecialHandler.java rename Common/src/main/java/at/petrak/hexcasting/api/{spell => casting}/SpellAction.kt (81%) rename Common/src/main/java/at/petrak/hexcasting/api/{spell => casting}/SpellList.kt (96%) rename Common/src/main/java/at/petrak/hexcasting/api/{spell/casting => casting/eval}/CastingContext.kt (96%) rename Common/src/main/java/at/petrak/hexcasting/api/{spell/casting => casting/eval}/CastingHarness.kt (83%) rename Common/src/main/java/at/petrak/hexcasting/api/{spell/casting => casting/eval}/ControllerInfo.kt (87%) rename Common/src/main/java/at/petrak/hexcasting/api/{spell/casting => casting/eval}/ResolvedPattern.kt (84%) rename Common/src/main/java/at/petrak/hexcasting/api/{spell/casting => casting/eval}/ResolvedPatternType.kt (91%) rename Common/src/main/java/at/petrak/hexcasting/api/{spell/casting => casting/eval}/SpecialPatterns.java (66%) rename Common/src/main/java/at/petrak/hexcasting/api/{spell/casting => casting/eval}/SpellCircleContext.kt (97%) rename Common/src/main/java/at/petrak/hexcasting/api/{spell/casting => casting/eval}/sideeffects/EvalSound.java (90%) rename Common/src/main/java/at/petrak/hexcasting/api/{spell/casting => casting/eval}/sideeffects/OperatorSideEffect.kt (90%) rename Common/src/main/java/at/petrak/hexcasting/api/{spell/casting/eval => casting/eval/vm}/ContinuationFrame.kt (91%) rename Common/src/main/java/at/petrak/hexcasting/api/{spell/casting/eval => casting/eval/vm}/FrameEvaluate.kt (87%) rename Common/src/main/java/at/petrak/hexcasting/api/{spell/casting/eval => casting/eval/vm}/FrameFinishEval.kt (82%) rename Common/src/main/java/at/petrak/hexcasting/api/{spell/casting/eval => casting/eval/vm}/FrameForEach.kt (90%) rename Common/src/main/java/at/petrak/hexcasting/api/{spell/casting/eval => casting/eval/vm}/FunctionalData.kt (71%) rename Common/src/main/java/at/petrak/hexcasting/api/{spell/casting/eval => casting/eval/vm}/SpellContinuation.kt (86%) rename Common/src/main/java/at/petrak/hexcasting/api/{spell => casting}/iota/BooleanIota.java (97%) rename Common/src/main/java/at/petrak/hexcasting/api/{spell => casting}/iota/DoubleIota.java (97%) rename Common/src/main/java/at/petrak/hexcasting/api/{spell => casting}/iota/EntityIota.java (98%) rename Common/src/main/java/at/petrak/hexcasting/api/{spell => casting}/iota/GarbageIota.java (97%) rename Common/src/main/java/at/petrak/hexcasting/api/{spell => casting}/iota/Iota.java (96%) rename Common/src/main/java/at/petrak/hexcasting/api/{spell => casting}/iota/IotaType.java (96%) rename Common/src/main/java/at/petrak/hexcasting/api/{spell => casting}/iota/ListIota.java (97%) rename Common/src/main/java/at/petrak/hexcasting/api/{spell => casting}/iota/NullIota.java (97%) rename Common/src/main/java/at/petrak/hexcasting/api/{spell => casting}/iota/PatternIota.java (95%) rename Common/src/main/java/at/petrak/hexcasting/api/{spell => casting}/iota/Vec3Iota.java (98%) rename Common/src/main/java/at/petrak/hexcasting/api/{spell => casting}/math/EulerPathFinder.kt (98%) rename Common/src/main/java/at/petrak/hexcasting/api/{spell => casting}/math/HexAngle.kt (82%) rename Common/src/main/java/at/petrak/hexcasting/api/{spell => casting}/math/HexCoord.kt (97%) rename Common/src/main/java/at/petrak/hexcasting/api/{spell => casting}/math/HexDir.kt (95%) rename Common/src/main/java/at/petrak/hexcasting/api/{spell => casting}/math/HexPattern.kt (99%) rename Common/src/main/java/at/petrak/hexcasting/api/{spell => casting}/mishaps/Mishap.kt (82%) rename Common/src/main/java/at/petrak/hexcasting/api/{spell => casting}/mishaps/MishapAlreadyBrainswept.kt (78%) rename Common/src/main/java/at/petrak/hexcasting/api/{spell => casting}/mishaps/MishapBadBlock.kt (85%) rename Common/src/main/java/at/petrak/hexcasting/api/{spell => casting}/mishaps/MishapBadBrainsweep.kt (81%) rename Common/src/main/java/at/petrak/hexcasting/api/{spell => casting}/mishaps/MishapBadEntity.kt (81%) rename Common/src/main/java/at/petrak/hexcasting/api/{spell => casting}/mishaps/MishapBadItem.kt (75%) rename Common/src/main/java/at/petrak/hexcasting/api/{spell => casting}/mishaps/MishapBadOffhandItem.kt (76%) rename Common/src/main/java/at/petrak/hexcasting/api/{spell => casting}/mishaps/MishapDisallowedSpell.kt (67%) rename Common/src/main/java/at/petrak/hexcasting/api/{spell => casting}/mishaps/MishapDivideByZero.kt (88%) rename Common/src/main/java/at/petrak/hexcasting/api/{spell => casting}/mishaps/MishapEntityTooFarAway.kt (73%) rename Common/src/main/java/at/petrak/hexcasting/api/{spell => casting}/mishaps/MishapError.kt (67%) rename Common/src/main/java/at/petrak/hexcasting/api/{spell => casting}/mishaps/MishapEvalTooDeep.kt (75%) rename Common/src/main/java/at/petrak/hexcasting/api/{spell => casting}/mishaps/MishapImmuneEntity.kt (69%) rename Common/src/main/java/at/petrak/hexcasting/api/{spell => casting}/mishaps/MishapInvalidIota.kt (82%) rename Common/src/main/java/at/petrak/hexcasting/api/{spell => casting}/mishaps/MishapInvalidPattern.kt (67%) rename Common/src/main/java/at/petrak/hexcasting/api/{spell => casting}/mishaps/MishapInvalidSpellDatumType.kt (79%) rename Common/src/main/java/at/petrak/hexcasting/api/{spell => casting}/mishaps/MishapLocationInWrongDimension.kt (69%) rename Common/src/main/java/at/petrak/hexcasting/api/{spell => casting}/mishaps/MishapLocationTooFarAway.kt (67%) rename Common/src/main/java/at/petrak/hexcasting/api/{spell => casting}/mishaps/MishapNoAkashicRecord.kt (78%) rename Common/src/main/java/at/petrak/hexcasting/api/{spell => casting}/mishaps/MishapNoSpellCircle.kt (84%) rename Common/src/main/java/at/petrak/hexcasting/api/{spell => casting}/mishaps/MishapNotEnoughArgs.kt (61%) rename Common/src/main/java/at/petrak/hexcasting/api/{spell => casting}/mishaps/MishapOthersName.kt (87%) rename Common/src/main/java/at/petrak/hexcasting/api/{spell => casting}/mishaps/MishapShameOnYou.kt (78%) rename Common/src/main/java/at/petrak/hexcasting/api/{spell => casting}/mishaps/MishapTooManyCloseParens.kt (72%) rename Common/src/main/java/at/petrak/hexcasting/api/{spell => casting}/mishaps/MishapUnescapedValue.kt (87%) delete mode 100644 Common/src/main/java/at/petrak/hexcasting/api/spell/RenderedSpell.kt create mode 100644 Common/src/main/java/at/petrak/hexcasting/client/PatternShapeMatcher.java create mode 100644 Common/src/main/java/at/petrak/hexcasting/common/casting/PatternRegistryManifest.java create mode 100644 Common/src/main/java/at/petrak/hexcasting/common/casting/operators/math/OpNumberLiteral.kt create mode 100644 Common/src/main/java/at/petrak/hexcasting/common/casting/operators/math/SpecialHandlerNumberLiteral.kt create mode 100644 Common/src/main/java/at/petrak/hexcasting/common/casting/operators/stack/SpecialHandlerMask.kt create mode 100644 Common/src/main/java/at/petrak/hexcasting/common/impl/HexAPIImpl.java create mode 100644 Common/src/main/java/at/petrak/hexcasting/common/lib/hex/HexSpecialHandlers.java diff --git a/Common/src/main/java/at/petrak/hexcasting/README.md b/Common/src/main/java/at/petrak/hexcasting/README.md index 5eb52a0c..8dd3a12c 100644 --- a/Common/src/main/java/at/petrak/hexcasting/README.md +++ b/Common/src/main/java/at/petrak/hexcasting/README.md @@ -2,8 +2,8 @@ Hello, intrepid Github reader! The "flavor text" words for things in this mod and the internal names are different. (Sorry.) -- A "Hex" is a `Cast`, cast through a [`CastingHarness`](api/spell/casting/CastingHarness.kt) -- A "Pattern" is a [`HexPattern`](api/spell/math/HexPattern.kt) -- An "Action" is an [`Operator`](api/spell/Action.kt) -- An action that pushes a spell is a [`Spell`](api/spell/SpellAction.kt) +- A "Hex" is a `Cast`, cast through a [`CastingHarness`](api/casting/eval/CastingHarness.kt) +- A "Pattern" is a [`HexPattern`](api/casting/math/HexPattern.kt) +- An "Action" is an [`Operator`](api/casting/Action.kt) +- An action that pushes a spell is a [`Spell`](api/casting/SpellAction.kt) diff --git a/Common/src/main/java/at/petrak/hexcasting/api/HexAPI.java b/Common/src/main/java/at/petrak/hexcasting/api/HexAPI.java index e22627dc..b3722477 100644 --- a/Common/src/main/java/at/petrak/hexcasting/api/HexAPI.java +++ b/Common/src/main/java/at/petrak/hexcasting/api/HexAPI.java @@ -1,6 +1,11 @@ package at.petrak.hexcasting.api; +import at.petrak.hexcasting.api.casting.ActionRegistryEntry; +import at.petrak.hexcasting.api.casting.SpecialHandler; import com.google.common.base.Suppliers; +import net.minecraft.ChatFormatting; +import net.minecraft.network.chat.Component; +import net.minecraft.resources.ResourceKey; import net.minecraft.resources.ResourceLocation; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; @@ -22,6 +27,26 @@ public interface HexAPI { } }); + /** + * Return the localization key for the given action. + *

+ * Note we're allowed to have action resource keys on the client, just no actual actions. + *

+ * Special handlers should be calling {@link SpecialHandler#getName()} + */ + default String getActionI18nKey(ResourceKey action) { + return "hexcasting.spell.%s".formatted(action.location()); + } + + default String getActionI18nKey(ResourceLocation action) { + return "hexcasting.spell.%s".formatted(action.toString()); + } + + default Component getActionI18(ResourceLocation key, boolean isGreat) { + return Component.translatable(getActionI18nKey(key)) + .withStyle(isGreat ? ChatFormatting.GOLD : ChatFormatting.LIGHT_PURPLE); + } + static HexAPI instance() { return INSTANCE.get(); } diff --git a/Common/src/main/java/at/petrak/hexcasting/api/PatternRegistry.java b/Common/src/main/java/at/petrak/hexcasting/api/PatternRegistry.java deleted file mode 100644 index b11489a3..00000000 --- a/Common/src/main/java/at/petrak/hexcasting/api/PatternRegistry.java +++ /dev/null @@ -1,324 +0,0 @@ -package at.petrak.hexcasting.api; - -import at.petrak.hexcasting.api.spell.Action; -import at.petrak.hexcasting.api.spell.math.EulerPathFinder; -import at.petrak.hexcasting.api.spell.math.HexDir; -import at.petrak.hexcasting.api.spell.math.HexPattern; -import at.petrak.hexcasting.api.spell.mishaps.MishapInvalidPattern; -import com.mojang.datafixers.util.Pair; -import net.minecraft.nbt.CompoundTag; -import net.minecraft.resources.ResourceLocation; -import net.minecraft.server.level.ServerLevel; -import net.minecraft.world.level.saveddata.SavedData; -import org.jetbrains.annotations.Nullable; - -import java.util.HashMap; -import java.util.HashSet; -import java.util.Map; -import java.util.Set; -import java.util.concurrent.ConcurrentHashMap; -import java.util.concurrent.ConcurrentLinkedDeque; -import java.util.concurrent.ConcurrentMap; -import java.util.stream.Collectors; - -public class PatternRegistry { - private static final ConcurrentMap actionLookup = new ConcurrentHashMap<>(); - private static final ConcurrentMap keyLookup = new ConcurrentHashMap<>(); - private static final ConcurrentLinkedDeque specialHandlers = new ConcurrentLinkedDeque<>(); - - // Map signatures to the "preferred" direction they start in and their operator ID. - private static final ConcurrentMap regularPatternLookup = - new ConcurrentHashMap<>(); - - private static final ConcurrentMap perWorldPatternLookup = - new ConcurrentHashMap<>(); - - public static void mapPattern(HexPattern pattern, ResourceLocation id, - Action action) throws RegisterPatternException { - mapPattern(pattern, id, action, false); - } - - /** - * Associate a given angle signature with a SpellOperator. - */ - public static void mapPattern(HexPattern pattern, ResourceLocation id, Action action, - boolean isPerWorld) throws RegisterPatternException { - if (actionLookup.containsKey(id)) { - throw new RegisterPatternException("The operator with id `%s` was already registered to: %s", id, - actionLookup.get(id)); - } - - actionLookup.put(id, action); - keyLookup.put(action, id); - if (isPerWorld) { - perWorldPatternLookup.put(id, new PerWorldEntry(pattern, id)); - } else { - regularPatternLookup.put(pattern.anglesSignature(), new RegularEntry(pattern.getStartDir(), id)); - } - } - - - /** - * Add a special handler, to take an arbitrary pattern and return whatever kind of operator you like. - */ - public static void addSpecialHandler(SpecialHandlerEntry handler) { - specialHandlers.add(handler); - } - - /** - * Add a special handler, to take an arbitrary pattern and return whatever kind of operator you like. - */ - public static void addSpecialHandler(ResourceLocation id, SpecialHandler handler) { - addSpecialHandler(new SpecialHandlerEntry(id, handler)); - } - - /** - * Internal use only. - */ - public static Action matchPattern(HexPattern pat, ServerLevel overworld) throws MishapInvalidPattern { - return matchPatternAndID(pat, overworld).getFirst(); - } - - /** - * Internal use only. - */ - public static Pair matchPatternAndID(HexPattern pat, - ServerLevel overworld) throws MishapInvalidPattern { - // Pipeline: - // patterns are registered here every time the game boots - // when we try to look - for (var handler : specialHandlers) { - var op = handler.handler.handlePattern(pat); - if (op != null) { - return new Pair<>(op, handler.id); - } - } - - // Is it global? - var sig = pat.anglesSignature(); - if (regularPatternLookup.containsKey(sig)) { - var it = regularPatternLookup.get(sig); - if (!actionLookup.containsKey(it.opId)) { - throw new MishapInvalidPattern(); - } - var op = actionLookup.get(it.opId); - return new Pair<>(op, it.opId); - } - - // Look it up in the world? - var ds = overworld.getDataStorage(); - Save perWorldPatterns = - ds.computeIfAbsent(Save::load, () -> Save.create(overworld.getSeed()), TAG_SAVED_DATA); - perWorldPatterns.fillMissingEntries(overworld.getSeed()); - if (perWorldPatterns.lookup.containsKey(sig)) { - var it = perWorldPatterns.lookup.get(sig); - return new Pair<>(actionLookup.get(it.getFirst()), it.getFirst()); - } - - throw new MishapInvalidPattern(); - } - - /** - * Internal use only. - */ - @Nullable - public static Action lookupPatternByShape(HexPattern pat) { - // Pipeline: - // patterns are registered here every time the game boots - // when we try to look - for (var handler : specialHandlers) { - var op = handler.handler.handlePattern(pat); - if (op != null) { - return op; - } - } - - // Is it global? - var sig = pat.anglesSignature(); - if (regularPatternLookup.containsKey(sig)) { - var it = regularPatternLookup.get(sig); - if (!actionLookup.containsKey(it.opId)) { - return null; - } - return actionLookup.get(it.opId); - } - - // Currently, there's no way to look up the name of a Great Spell, as the client is unaware of the correct - // mapping. - // TODO: add code to match any pattern in the shape of a Great Spell to its operator. - - // var ds = overworld.getDataStorage(); - // Save perWorldPatterns = - // ds.computeIfAbsent(Save::load, () -> Save.create(overworld.getSeed()), TAG_SAVED_DATA); - // perWorldPatterns.fillMissingEntries(overworld.getSeed()); - // if (perWorldPatterns.lookup.containsKey(sig)) { - // var it = perWorldPatterns.lookup.get(sig); - // return new Pair<>(actionLookup.get(it.getFirst()), it.getFirst()); - // } - - return null; - } - - /** - * Internal use only. - *

- * Map of signatures to (op id, canonical start dir) - */ - public static Map> getPerWorldPatterns(ServerLevel overworld) { - var ds = overworld.getDataStorage(); - Save perWorldPatterns = - ds.computeIfAbsent(Save::load, () -> Save.create(overworld.getSeed()), TAG_SAVED_DATA); - return perWorldPatterns.lookup; - } - - public static ResourceLocation lookupPattern(Action action) { - return keyLookup.get(action); - } - - /** - * Internal use only. - */ - public static PatternEntry lookupPattern(ResourceLocation opId) { - if (perWorldPatternLookup.containsKey(opId)) { - var it = perWorldPatternLookup.get(opId); - return new PatternEntry(it.prototype, actionLookup.get(it.opId), true); - } - for (var kv : regularPatternLookup.entrySet()) { - var sig = kv.getKey(); - var entry = kv.getValue(); - if (entry.opId.equals(opId)) { - var pattern = HexPattern.fromAngles(sig, entry.preferredStart); - return new PatternEntry(pattern, actionLookup.get(entry.opId), false); - } - } - - throw new IllegalArgumentException("could not find a pattern for " + opId); - } - - /** - * Internal use only. - */ - public static Set getAllPerWorldPatternNames() { - return perWorldPatternLookup.keySet(); - } - - public record SpecialHandlerEntry(ResourceLocation id, SpecialHandler handler) { - } - - public static class RegisterPatternException extends Exception { - public RegisterPatternException(String msg, Object... formats) { - super(String.format(msg, formats)); - } - } - - private record RegularEntry(HexDir preferredStart, ResourceLocation opId) { - } - - private record PerWorldEntry(HexPattern prototype, ResourceLocation opId) { - } - - // Fake class we pretend to use internally - public record PatternEntry(HexPattern prototype, Action action, boolean isPerWorld) { - } - - /** - * Maps angle sigs to resource locations and their preferred start dir so we can look them up in the main registry - * Save this on the world in case the random algorithm changes. - */ - public static class Save extends SavedData { - private static final String TAG_OP_ID = "op_id"; - private static final String TAG_START_DIR = "start_dir"; - - // Maps hex signatures to (op ids, canonical start dir) - private Map> lookup; - private boolean missingEntries; - - public Save(Map> lookup, boolean missingEntries) { - this.lookup = lookup; - this.missingEntries = missingEntries; - } - - public Save(Map> lookup) { - this(lookup, missingEntries(lookup)); - } - - private static boolean missingEntries(Map> lookup) { - var allIds = lookup.values().stream().map(Pair::getFirst).collect(Collectors.toSet()); - return perWorldPatternLookup.values().stream().anyMatch(it -> allIds.contains(it.opId)); - } - - private void fillMissingEntries(long seed) { - if (missingEntries) { - var doneAny = false; - - var allIds = lookup.values().stream().map(Pair::getFirst).collect(Collectors.toSet()); - for (var entry : perWorldPatternLookup.values()) { - if (!allIds.contains(entry.opId)) { - scrungle(lookup, entry.prototype, entry.opId, seed); - doneAny = true; - } - } - - if (doneAny) { - setDirty(); - missingEntries = false; - } - } - } - - @Override - public CompoundTag save(CompoundTag tag) { - this.lookup.forEach((sig, rhs) -> { - var entry = new CompoundTag(); - entry.putString(TAG_OP_ID, rhs.getFirst().toString()); - entry.putInt(TAG_START_DIR, rhs.getSecond().ordinal()); - tag.put(sig, entry); - }); - return tag; - } - - private static Save load(CompoundTag tag) { - var map = new HashMap>(); - var allIds = new HashSet(); - for (var sig : tag.getAllKeys()) { - var entry = tag.getCompound(sig); - var opId = ResourceLocation.tryParse(entry.getString(TAG_OP_ID)); - allIds.add(opId); - var startDir = HexDir.values()[entry.getInt(TAG_START_DIR)]; - map.put(sig, new Pair<>(opId, startDir)); - } - var missingEntries = perWorldPatternLookup.values().stream().anyMatch(it -> allIds.contains(it.opId)); - - return new Save(map, missingEntries); - } - - private static void scrungle(Map> lookup, HexPattern prototype, - ResourceLocation opId, long seed) { - var scrungled = EulerPathFinder.findAltDrawing(prototype, seed, it -> { - var sig = it.anglesSignature(); - return !lookup.containsKey(sig) && - !regularPatternLookup.containsKey(sig) - && specialHandlers.stream().noneMatch(handler -> handler.handler.handlePattern(it) != null); - }); - lookup.put(scrungled.anglesSignature(), new Pair<>(opId, scrungled.getStartDir())); - } - - public static Save create(long seed) { - var map = new HashMap>(); - PatternRegistry.perWorldPatternLookup.values().forEach(it -> scrungle(map, it.prototype, it.opId, seed)); - var save = new Save(map); - save.setDirty(); - return save; - } - } - - public static final String TAG_SAVED_DATA = "hex.per-world-patterns"; - - public static String getPatternCountInfo() { - return String.format( - "Loaded %d regular patterns, " + - "%d per-world patterns, and " + - "%d special handlers.", regularPatternLookup.size(), perWorldPatternLookup.size(), - specialHandlers.size()); - } -} diff --git a/Common/src/main/java/at/petrak/hexcasting/api/SpecialHandler.java b/Common/src/main/java/at/petrak/hexcasting/api/SpecialHandler.java deleted file mode 100644 index f229da9d..00000000 --- a/Common/src/main/java/at/petrak/hexcasting/api/SpecialHandler.java +++ /dev/null @@ -1,17 +0,0 @@ -package at.petrak.hexcasting.api; - -import at.petrak.hexcasting.api.spell.Action; -import at.petrak.hexcasting.api.spell.math.HexPattern; -import org.jetbrains.annotations.Nullable; - -/** - * Special handling of a pattern. Before checking any of the normal angle-signature based patterns, - * a given pattern is run by all of these special handlers patterns. If none of them return non-null, - * then its signature is checked. - *

- * In the base mod, this is used for number patterns and Bookkeeper's Gambit. - */ -@FunctionalInterface -public interface SpecialHandler { - @Nullable Action handlePattern(HexPattern pattern); -} diff --git a/Common/src/main/java/at/petrak/hexcasting/api/addldata/ADHexHolder.java b/Common/src/main/java/at/petrak/hexcasting/api/addldata/ADHexHolder.java index d0da5b78..3d945942 100644 --- a/Common/src/main/java/at/petrak/hexcasting/api/addldata/ADHexHolder.java +++ b/Common/src/main/java/at/petrak/hexcasting/api/addldata/ADHexHolder.java @@ -1,6 +1,6 @@ package at.petrak.hexcasting.api.addldata; -import at.petrak.hexcasting.api.spell.iota.Iota; +import at.petrak.hexcasting.api.casting.iota.Iota; import net.minecraft.server.level.ServerLevel; import org.jetbrains.annotations.Nullable; diff --git a/Common/src/main/java/at/petrak/hexcasting/api/addldata/ADIotaHolder.java b/Common/src/main/java/at/petrak/hexcasting/api/addldata/ADIotaHolder.java index 812f4574..4fc1e2c5 100644 --- a/Common/src/main/java/at/petrak/hexcasting/api/addldata/ADIotaHolder.java +++ b/Common/src/main/java/at/petrak/hexcasting/api/addldata/ADIotaHolder.java @@ -1,6 +1,6 @@ package at.petrak.hexcasting.api.addldata; -import at.petrak.hexcasting.api.spell.iota.Iota; +import at.petrak.hexcasting.api.casting.iota.Iota; import at.petrak.hexcasting.common.lib.hex.HexIotaTypes; import net.minecraft.nbt.CompoundTag; import net.minecraft.server.level.ServerLevel; diff --git a/Common/src/main/java/at/petrak/hexcasting/api/addldata/ItemDelegatingEntityIotaHolder.java b/Common/src/main/java/at/petrak/hexcasting/api/addldata/ItemDelegatingEntityIotaHolder.java index d123f0de..390ce0dc 100644 --- a/Common/src/main/java/at/petrak/hexcasting/api/addldata/ItemDelegatingEntityIotaHolder.java +++ b/Common/src/main/java/at/petrak/hexcasting/api/addldata/ItemDelegatingEntityIotaHolder.java @@ -1,6 +1,6 @@ package at.petrak.hexcasting.api.addldata; -import at.petrak.hexcasting.api.spell.iota.Iota; +import at.petrak.hexcasting.api.casting.iota.Iota; import at.petrak.hexcasting.common.entities.EntityWallScroll; import at.petrak.hexcasting.xplat.IXplatAbstractions; import net.minecraft.nbt.CompoundTag; diff --git a/Common/src/main/java/at/petrak/hexcasting/api/block/circle/BlockAbstractImpetus.java b/Common/src/main/java/at/petrak/hexcasting/api/block/circle/BlockAbstractImpetus.java index 958e99f7..32fdc96f 100644 --- a/Common/src/main/java/at/petrak/hexcasting/api/block/circle/BlockAbstractImpetus.java +++ b/Common/src/main/java/at/petrak/hexcasting/api/block/circle/BlockAbstractImpetus.java @@ -1,6 +1,6 @@ package at.petrak.hexcasting.api.block.circle; -import at.petrak.hexcasting.api.spell.math.HexPattern; +import at.petrak.hexcasting.api.casting.math.HexPattern; import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; import net.minecraft.server.level.ServerLevel; diff --git a/Common/src/main/java/at/petrak/hexcasting/api/block/circle/BlockCircleComponent.java b/Common/src/main/java/at/petrak/hexcasting/api/block/circle/BlockCircleComponent.java index 9aead246..695bf21b 100644 --- a/Common/src/main/java/at/petrak/hexcasting/api/block/circle/BlockCircleComponent.java +++ b/Common/src/main/java/at/petrak/hexcasting/api/block/circle/BlockCircleComponent.java @@ -1,6 +1,6 @@ package at.petrak.hexcasting.api.block.circle; -import at.petrak.hexcasting.api.spell.math.HexPattern; +import at.petrak.hexcasting.api.casting.math.HexPattern; import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; import net.minecraft.world.level.Level; diff --git a/Common/src/main/java/at/petrak/hexcasting/api/block/circle/BlockEntityAbstractImpetus.java b/Common/src/main/java/at/petrak/hexcasting/api/block/circle/BlockEntityAbstractImpetus.java index 58c64637..91f40752 100644 --- a/Common/src/main/java/at/petrak/hexcasting/api/block/circle/BlockEntityAbstractImpetus.java +++ b/Common/src/main/java/at/petrak/hexcasting/api/block/circle/BlockEntityAbstractImpetus.java @@ -4,11 +4,11 @@ import at.petrak.hexcasting.api.block.HexBlockEntity; import at.petrak.hexcasting.api.misc.FrozenColorizer; import at.petrak.hexcasting.api.misc.MediaConstants; import at.petrak.hexcasting.api.mod.HexConfig; -import at.petrak.hexcasting.api.spell.ParticleSpray; -import at.petrak.hexcasting.api.spell.casting.CastingContext; -import at.petrak.hexcasting.api.spell.casting.CastingHarness; -import at.petrak.hexcasting.api.spell.casting.SpellCircleContext; -import at.petrak.hexcasting.api.spell.iota.PatternIota; +import at.petrak.hexcasting.api.casting.ParticleSpray; +import at.petrak.hexcasting.api.casting.eval.CastingContext; +import at.petrak.hexcasting.api.casting.eval.CastingHarness; +import at.petrak.hexcasting.api.casting.eval.SpellCircleContext; +import at.petrak.hexcasting.api.casting.iota.PatternIota; import at.petrak.hexcasting.api.utils.MediaHelper; import at.petrak.hexcasting.common.items.magic.ItemCreativeUnlocker; import at.petrak.hexcasting.common.lib.HexItems; diff --git a/Common/src/main/java/at/petrak/hexcasting/api/spell/Action.kt b/Common/src/main/java/at/petrak/hexcasting/api/casting/Action.kt similarity index 72% rename from Common/src/main/java/at/petrak/hexcasting/api/spell/Action.kt rename to Common/src/main/java/at/petrak/hexcasting/api/casting/Action.kt index 7282ef74..b6430fa2 100644 --- a/Common/src/main/java/at/petrak/hexcasting/api/spell/Action.kt +++ b/Common/src/main/java/at/petrak/hexcasting/api/casting/Action.kt @@ -1,9 +1,8 @@ -package at.petrak.hexcasting.api.spell +package at.petrak.hexcasting.api.casting -import at.petrak.hexcasting.api.PatternRegistry -import at.petrak.hexcasting.api.spell.casting.CastingContext -import at.petrak.hexcasting.api.spell.casting.eval.SpellContinuation -import at.petrak.hexcasting.api.spell.iota.Iota +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 @@ -15,6 +14,12 @@ import java.text.DecimalFormat * Manipulates the stack in some way, usually by popping some number of values off the stack * and pushing one new value. * For a more "traditional" pop arguments, push return experience, see [ConstMediaAction]. + * + * Instances of this can exist on the client, but they should NEVER be used there. They only + * exist on the client because Minecraft's registry system demands they do; any information + * the client needs about them is stored elsewhere. (For example, their canonical stroke order + * is stored in [ActionRegistryEntry], and their localization key is gotten from the resource key + * via [at.petrak.hexcasting.api.HexAPI.getActionI18nKey].) */ interface Action { /** @@ -53,7 +58,9 @@ interface Action { /** * The component for displaying this pattern's name. Override for dynamic patterns. */ - val displayName: Component get() = "hexcasting.spell.${PatternRegistry.lookupPattern(this)}".asTranslatedComponent.lightPurple + 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! @@ -73,7 +80,7 @@ interface Action { listOf(x) } - private val DOUBLE_FORMATTER = DecimalFormat("####.####") + public val DOUBLE_FORMATTER = DecimalFormat("####.####") @JvmStatic fun makeConstantOp(x: Double, key: ResourceLocation): Action = object : ConstMediaAction { @@ -83,8 +90,9 @@ interface Action { override fun execute(args: List, ctx: CastingContext): List = x.asActionResult - override val displayName: Component - get() = "hexcasting.spell.$key".asTranslatedComponent(DOUBLE_FORMATTER.format(x)).lightPurple + 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/spell/ActionRegistryEntry.java b/Common/src/main/java/at/petrak/hexcasting/api/casting/ActionRegistryEntry.java similarity index 83% rename from Common/src/main/java/at/petrak/hexcasting/api/spell/ActionRegistryEntry.java rename to Common/src/main/java/at/petrak/hexcasting/api/casting/ActionRegistryEntry.java index 2b540857..374508c6 100644 --- a/Common/src/main/java/at/petrak/hexcasting/api/spell/ActionRegistryEntry.java +++ b/Common/src/main/java/at/petrak/hexcasting/api/casting/ActionRegistryEntry.java @@ -1,6 +1,6 @@ -package at.petrak.hexcasting.api.spell; +package at.petrak.hexcasting.api.casting; -import at.petrak.hexcasting.api.spell.math.HexPattern; +import at.petrak.hexcasting.api.casting.math.HexPattern; /** * A bit of wrapper information around an action to go in the registry. diff --git a/Common/src/main/java/at/petrak/hexcasting/api/spell/ConstMediaAction.kt b/Common/src/main/java/at/petrak/hexcasting/api/casting/ConstMediaAction.kt similarity index 70% rename from Common/src/main/java/at/petrak/hexcasting/api/spell/ConstMediaAction.kt rename to Common/src/main/java/at/petrak/hexcasting/api/casting/ConstMediaAction.kt index 1f721bc1..651cef53 100644 --- a/Common/src/main/java/at/petrak/hexcasting/api/spell/ConstMediaAction.kt +++ b/Common/src/main/java/at/petrak/hexcasting/api/casting/ConstMediaAction.kt @@ -1,10 +1,10 @@ -package at.petrak.hexcasting.api.spell +package at.petrak.hexcasting.api.casting -import at.petrak.hexcasting.api.spell.casting.CastingContext -import at.petrak.hexcasting.api.spell.casting.eval.SpellContinuation -import at.petrak.hexcasting.api.spell.casting.sideeffects.OperatorSideEffect -import at.petrak.hexcasting.api.spell.iota.Iota -import at.petrak.hexcasting.api.spell.mishaps.MishapNotEnoughArgs +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.iota.Iota +import at.petrak.hexcasting.api.casting.mishaps.MishapNotEnoughArgs /** * A SimpleOperator that always costs the same amount of media. diff --git a/Common/src/main/java/at/petrak/hexcasting/api/spell/OperationResult.kt b/Common/src/main/java/at/petrak/hexcasting/api/casting/OperationResult.kt similarity index 50% rename from Common/src/main/java/at/petrak/hexcasting/api/spell/OperationResult.kt rename to Common/src/main/java/at/petrak/hexcasting/api/casting/OperationResult.kt index 364a4fa3..d9e3e4a6 100644 --- a/Common/src/main/java/at/petrak/hexcasting/api/spell/OperationResult.kt +++ b/Common/src/main/java/at/petrak/hexcasting/api/casting/OperationResult.kt @@ -1,8 +1,8 @@ -package at.petrak.hexcasting.api.spell +package at.petrak.hexcasting.api.casting -import at.petrak.hexcasting.api.spell.casting.eval.SpellContinuation -import at.petrak.hexcasting.api.spell.casting.sideeffects.OperatorSideEffect -import at.petrak.hexcasting.api.spell.iota.Iota +import at.petrak.hexcasting.api.casting.eval.vm.SpellContinuation +import at.petrak.hexcasting.api.casting.eval.sideeffects.OperatorSideEffect +import at.petrak.hexcasting.api.casting.iota.Iota /** * What happens when an operator is through? diff --git a/Common/src/main/java/at/petrak/hexcasting/api/spell/OperatorUtils.kt b/Common/src/main/java/at/petrak/hexcasting/api/casting/OperatorUtils.kt similarity index 97% rename from Common/src/main/java/at/petrak/hexcasting/api/spell/OperatorUtils.kt rename to Common/src/main/java/at/petrak/hexcasting/api/casting/OperatorUtils.kt index 840ca0ba..84ed1185 100644 --- a/Common/src/main/java/at/petrak/hexcasting/api/spell/OperatorUtils.kt +++ b/Common/src/main/java/at/petrak/hexcasting/api/casting/OperatorUtils.kt @@ -1,11 +1,11 @@ @file:JvmName("OperatorUtils") -package at.petrak.hexcasting.api.spell +package at.petrak.hexcasting.api.casting -import at.petrak.hexcasting.api.spell.iota.* -import at.petrak.hexcasting.api.spell.math.HexPattern -import at.petrak.hexcasting.api.spell.mishaps.MishapInvalidIota -import at.petrak.hexcasting.api.spell.mishaps.MishapNotEnoughArgs +import at.petrak.hexcasting.api.casting.iota.* +import at.petrak.hexcasting.api.casting.math.HexPattern +import at.petrak.hexcasting.api.casting.mishaps.MishapInvalidIota +import at.petrak.hexcasting.api.casting.mishaps.MishapNotEnoughArgs import at.petrak.hexcasting.api.utils.asTranslatedComponent import com.mojang.datafixers.util.Either import com.mojang.math.Vector3f diff --git a/Common/src/main/java/at/petrak/hexcasting/api/spell/ParticleSpray.kt b/Common/src/main/java/at/petrak/hexcasting/api/casting/ParticleSpray.kt similarity index 95% rename from Common/src/main/java/at/petrak/hexcasting/api/spell/ParticleSpray.kt rename to Common/src/main/java/at/petrak/hexcasting/api/casting/ParticleSpray.kt index 617ee5c0..c766e776 100644 --- a/Common/src/main/java/at/petrak/hexcasting/api/spell/ParticleSpray.kt +++ b/Common/src/main/java/at/petrak/hexcasting/api/casting/ParticleSpray.kt @@ -1,4 +1,4 @@ -package at.petrak.hexcasting.api.spell +package at.petrak.hexcasting.api.casting import at.petrak.hexcasting.api.misc.FrozenColorizer import at.petrak.hexcasting.common.network.MsgCastParticleAck diff --git a/Common/src/main/java/at/petrak/hexcasting/api/casting/PatternShapeMatch.java b/Common/src/main/java/at/petrak/hexcasting/api/casting/PatternShapeMatch.java new file mode 100644 index 00000000..068d9982 --- /dev/null +++ b/Common/src/main/java/at/petrak/hexcasting/api/casting/PatternShapeMatch.java @@ -0,0 +1,56 @@ +package at.petrak.hexcasting.api.casting; + +import net.minecraft.resources.ResourceKey; + +/** + * Possible things we find when trying to match a pattern's shape. + */ +public abstract sealed class PatternShapeMatch { + /** + * I've never met that pattern in my life + */ + public static final class Nothing extends PatternShapeMatch { + } + + /** + * The shape exactly matches a pattern that isn't altered per world + */ + public static final class Normal extends PatternShapeMatch { + public final ResourceKey key; + + public Normal(ResourceKey key) { + this.key = key; + } + } + + /** + * The pattern is the right shape to be one of the per-world patterns. + *

+ * On the server, {@link PerWorld#certain} means whether this is an exact match, or if it's just the + * right shape. (In other words it should only actually be casted if it is true.) + *

+ * On the client, it is always false. + */ + public static final class PerWorld extends PatternShapeMatch { + public final ResourceKey key; + public final boolean certain; + + public PerWorld(ResourceKey key, boolean certain) { + this.key = key; + this.certain = certain; + } + } + + /** + * The shape matches a special handler + */ + public static final class Special extends PatternShapeMatch { + public final ResourceKey> key; + public final SpecialHandler handler; + + public Special(ResourceKey> key, SpecialHandler handler) { + this.key = key; + this.handler = handler; + } + } +} diff --git a/Common/src/main/java/at/petrak/hexcasting/api/casting/RenderedSpell.kt b/Common/src/main/java/at/petrak/hexcasting/api/casting/RenderedSpell.kt new file mode 100644 index 00000000..828f9966 --- /dev/null +++ b/Common/src/main/java/at/petrak/hexcasting/api/casting/RenderedSpell.kt @@ -0,0 +1,7 @@ +package at.petrak.hexcasting.api.casting + +import at.petrak.hexcasting.api.casting.eval.CastingContext + +interface RenderedSpell { + fun cast(ctx: CastingContext) +} diff --git a/Common/src/main/java/at/petrak/hexcasting/api/casting/SpecialHandler.java b/Common/src/main/java/at/petrak/hexcasting/api/casting/SpecialHandler.java new file mode 100644 index 00000000..ea331c04 --- /dev/null +++ b/Common/src/main/java/at/petrak/hexcasting/api/casting/SpecialHandler.java @@ -0,0 +1,40 @@ +package at.petrak.hexcasting.api.casting; + +import at.petrak.hexcasting.api.casting.math.HexPattern; +import net.minecraft.network.chat.Component; +import org.jetbrains.annotations.Nullable; + +/** + * Special handling of a pattern. Before checking any of the normal angle-signature based patterns, + * a given pattern is run by all of these special handlers patterns. If none of them return non-null, + * then its signature is checked. + *

+ * In the base mod, this is used for number patterns and Bookkeeper's Gambit. + *

+ * There's a separation between the special handlers and their factories so we never have to use + * {@link Action} instances on the client. We can have SpecialHandlers on the client though because they're just + * wrappers. + */ +public abstract class SpecialHandler { + /** + * Convert this to an action, for modification of the stack and state. + *

+ * This is called on the SERVER-SIDE ONLY. + */ + public abstract Action act(); + + /** + * Get the name of this handler. + */ + public abstract Component getName(); + + /** + * Given a pattern, possibly make up the special handler from it. + *

+ * This is what goes in the registry! Think of it like BlockEntityType vs BlockEntity. + */ + @FunctionalInterface + public interface Factory { + @Nullable T tryMatch(HexPattern pattern); + } +} diff --git a/Common/src/main/java/at/petrak/hexcasting/api/spell/SpellAction.kt b/Common/src/main/java/at/petrak/hexcasting/api/casting/SpellAction.kt similarity index 81% rename from Common/src/main/java/at/petrak/hexcasting/api/spell/SpellAction.kt rename to Common/src/main/java/at/petrak/hexcasting/api/casting/SpellAction.kt index 856c2b09..8335f0e0 100644 --- a/Common/src/main/java/at/petrak/hexcasting/api/spell/SpellAction.kt +++ b/Common/src/main/java/at/petrak/hexcasting/api/casting/SpellAction.kt @@ -1,10 +1,10 @@ -package at.petrak.hexcasting.api.spell +package at.petrak.hexcasting.api.casting -import at.petrak.hexcasting.api.spell.casting.CastingContext -import at.petrak.hexcasting.api.spell.casting.eval.SpellContinuation -import at.petrak.hexcasting.api.spell.casting.sideeffects.OperatorSideEffect -import at.petrak.hexcasting.api.spell.iota.Iota -import at.petrak.hexcasting.api.spell.mishaps.MishapNotEnoughArgs +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.iota.Iota +import at.petrak.hexcasting.api.casting.mishaps.MishapNotEnoughArgs interface SpellAction : Action { val argc: Int diff --git a/Common/src/main/java/at/petrak/hexcasting/api/spell/SpellList.kt b/Common/src/main/java/at/petrak/hexcasting/api/casting/SpellList.kt similarity index 96% rename from Common/src/main/java/at/petrak/hexcasting/api/spell/SpellList.kt rename to Common/src/main/java/at/petrak/hexcasting/api/casting/SpellList.kt index c1472008..2e76c18c 100644 --- a/Common/src/main/java/at/petrak/hexcasting/api/spell/SpellList.kt +++ b/Common/src/main/java/at/petrak/hexcasting/api/casting/SpellList.kt @@ -1,6 +1,6 @@ -package at.petrak.hexcasting.api.spell +package at.petrak.hexcasting.api.casting -import at.petrak.hexcasting.api.spell.iota.Iota +import at.petrak.hexcasting.api.casting.iota.Iota /** * Restricted interface for functional lists. diff --git a/Common/src/main/java/at/petrak/hexcasting/api/spell/casting/CastingContext.kt b/Common/src/main/java/at/petrak/hexcasting/api/casting/eval/CastingContext.kt similarity index 96% rename from Common/src/main/java/at/petrak/hexcasting/api/spell/casting/CastingContext.kt rename to Common/src/main/java/at/petrak/hexcasting/api/casting/eval/CastingContext.kt index 0ae90378..eb01f4c7 100644 --- a/Common/src/main/java/at/petrak/hexcasting/api/spell/casting/CastingContext.kt +++ b/Common/src/main/java/at/petrak/hexcasting/api/casting/eval/CastingContext.kt @@ -1,12 +1,12 @@ -package at.petrak.hexcasting.api.spell.casting +package at.petrak.hexcasting.api.casting.eval import at.petrak.hexcasting.api.HexAPI.modLoc import at.petrak.hexcasting.api.misc.DiscoveryHandlers import at.petrak.hexcasting.api.mod.HexConfig -import at.petrak.hexcasting.api.spell.Action -import at.petrak.hexcasting.api.spell.mishaps.MishapEntityTooFarAway -import at.petrak.hexcasting.api.spell.mishaps.MishapEvalTooDeep -import at.petrak.hexcasting.api.spell.mishaps.MishapLocationTooFarAway +import at.petrak.hexcasting.api.casting.Action +import at.petrak.hexcasting.api.casting.mishaps.MishapEntityTooFarAway +import at.petrak.hexcasting.api.casting.mishaps.MishapEvalTooDeep +import at.petrak.hexcasting.api.casting.mishaps.MishapLocationTooFarAway import at.petrak.hexcasting.api.utils.otherHand import at.petrak.hexcasting.common.items.magic.ItemCreativeUnlocker import at.petrak.hexcasting.xplat.IXplatAbstractions diff --git a/Common/src/main/java/at/petrak/hexcasting/api/spell/casting/CastingHarness.kt b/Common/src/main/java/at/petrak/hexcasting/api/casting/eval/CastingHarness.kt similarity index 83% rename from Common/src/main/java/at/petrak/hexcasting/api/spell/casting/CastingHarness.kt rename to Common/src/main/java/at/petrak/hexcasting/api/casting/eval/CastingHarness.kt index 780b6548..a87b3700 100644 --- a/Common/src/main/java/at/petrak/hexcasting/api/spell/casting/CastingHarness.kt +++ b/Common/src/main/java/at/petrak/hexcasting/api/casting/eval/CastingHarness.kt @@ -1,30 +1,31 @@ -package at.petrak.hexcasting.api.spell.casting +package at.petrak.hexcasting.api.casting.eval -import at.petrak.hexcasting.api.PatternRegistry +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.ParticleSpray +import at.petrak.hexcasting.api.casting.PatternShapeMatch +import at.petrak.hexcasting.api.casting.PatternShapeMatch.* +import at.petrak.hexcasting.api.casting.SpellList +import at.petrak.hexcasting.api.casting.eval.sideeffects.EvalSound +import at.petrak.hexcasting.api.casting.eval.sideeffects.OperatorSideEffect +import at.petrak.hexcasting.api.casting.eval.vm.FrameEvaluate +import at.petrak.hexcasting.api.casting.eval.vm.FunctionalData +import at.petrak.hexcasting.api.casting.eval.vm.SpellContinuation +import at.petrak.hexcasting.api.casting.iota.Iota +import at.petrak.hexcasting.api.casting.iota.ListIota +import at.petrak.hexcasting.api.casting.iota.PatternIota +import at.petrak.hexcasting.api.casting.math.HexDir +import at.petrak.hexcasting.api.casting.math.HexPattern +import at.petrak.hexcasting.api.casting.mishaps.* import at.petrak.hexcasting.api.misc.DiscoveryHandlers import at.petrak.hexcasting.api.misc.FrozenColorizer import at.petrak.hexcasting.api.misc.HexDamageSources import at.petrak.hexcasting.api.mod.HexConfig import at.petrak.hexcasting.api.mod.HexStatistics import at.petrak.hexcasting.api.mod.HexTags -import at.petrak.hexcasting.api.spell.Action -import at.petrak.hexcasting.api.spell.ParticleSpray -import at.petrak.hexcasting.api.spell.SpellList -import at.petrak.hexcasting.api.spell.casting.eval.ContinuationFrame -import at.petrak.hexcasting.api.spell.casting.eval.FrameEvaluate -import at.petrak.hexcasting.api.spell.casting.eval.FunctionalData -import at.petrak.hexcasting.api.spell.casting.eval.SpellContinuation -import at.petrak.hexcasting.api.spell.casting.sideeffects.EvalSound -import at.petrak.hexcasting.api.spell.casting.sideeffects.OperatorSideEffect -import at.petrak.hexcasting.api.spell.iota.Iota -import at.petrak.hexcasting.api.spell.iota.ListIota -import at.petrak.hexcasting.api.spell.iota.PatternIota -import at.petrak.hexcasting.api.spell.math.HexDir -import at.petrak.hexcasting.api.spell.math.HexPattern -import at.petrak.hexcasting.api.spell.mishaps.* import at.petrak.hexcasting.api.utils.* +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 @@ -32,7 +33,6 @@ import net.minecraft.ChatFormatting import net.minecraft.nbt.CompoundTag import net.minecraft.nbt.Tag import net.minecraft.network.chat.Component -import net.minecraft.resources.ResourceLocation import net.minecraft.server.level.ServerLevel import net.minecraft.sounds.SoundSource import net.minecraft.util.Mth @@ -43,7 +43,10 @@ import kotlin.math.min /** * Keeps track of a player casting a spell on the server. - * It's stored as NBT on the wand. + * It's stored as NBT on the player. + * + * TODO oh god this entire class needs a gigantic refactor. why are there like 6 different entrypoints for casting + * a pattern. oh god. */ class CastingHarness private constructor( var stack: MutableList, @@ -66,7 +69,7 @@ class CastingHarness private constructor( */ fun executeIota(iota: Iota, world: ServerLevel): ControllerInfo = executeIotas(listOf(iota), world) - private fun displayPattern(escapeNext: Boolean, parenCount: Int, iotaRepresentation: Component) { + private fun displayPatternDebug(escapeNext: Boolean, parenCount: Int, iotaRepresentation: Component) { if (this.ctx.debugPatterns) { val display = " ".repeat(parenCount).asTextComponent if (escapeNext) @@ -77,24 +80,6 @@ class CastingHarness private constructor( } } - private fun getOperatorForPattern(iota: Iota, world: ServerLevel): Action? { - if (iota is PatternIota) - return PatternRegistry.matchPattern(iota.pattern, world) - return null - } - - private fun getPatternForFrame(frame: ContinuationFrame): HexPattern? { - if (frame !is FrameEvaluate) return null - - return (frame.list.car as? PatternIota)?.pattern - } - - private fun getOperatorForFrame(frame: ContinuationFrame, world: ServerLevel): Action? { - if (frame !is FrameEvaluate) return null - - return getOperatorForPattern(frame.list.car, world) - } - /** * Given a list of iotas, execute them in sequence. */ @@ -109,28 +94,9 @@ class CastingHarness private constructor( // Take the top of the continuation stack... val next = continuation.frame // ...and execute it. - val result = try { - next.evaluate(continuation.next, world, this) - } catch (mishap: Mishap) { - val pattern = getPatternForFrame(next) - val operator = try { - getOperatorForFrame(next, world) - } catch (e: Throwable) { - null - } - CastResult( - continuation, - null, - mishap.resolutionType(ctx), - listOf( - OperatorSideEffect.DoMishap( - mishap, - Mishap.Context(pattern ?: HexPattern(HexDir.WEST), operator) - ) - ), - HexEvalSounds.MISHAP, - ) - } + // TODO there used to be error checking code here; I'm pretty sure any and all mishaps should already + // get caught and folded into CastResult by evaluate. + val result = next.evaluate(continuation.next, world, this) // Then write all pertinent data back to the harness for the next iteration. if (result.newData != null) { this.applyFunctionalData(result.newData) @@ -172,11 +138,35 @@ class CastingHarness private constructor( ) } + /** + * this DOES NOT THROW THINGS + */ + @Throws() fun getUpdate(iota: Iota, world: ServerLevel, continuation: SpellContinuation): CastResult { try { // TODO we can have a special intro/retro sound - this.handleParentheses(iota)?.let { (data, resolutionType) -> - return@getUpdate CastResult(continuation, data, resolutionType, listOf(), HexEvalSounds.OPERATOR) + // ALSO TODO need to add reader macro-style things + try { + this.handleParentheses(iota)?.let { (data, resolutionType) -> + return@getUpdate CastResult(continuation, data, resolutionType, listOf(), HexEvalSounds.OPERATOR) + } + } catch (e: MishapTooManyCloseParens) { + // This is ridiculous and needs to be fixed + return CastResult( + continuation, + null, + ResolvedPatternType.ERRORED, + listOf( + OperatorSideEffect.DoMishap( + e, + Mishap.Context( + (iota as? PatternIota)?.pattern ?: HexPattern(HexDir.WEST), + HexAPI.instance().getActionI18(HexAPI.modLoc("retrospection"), false) + ) + ) + ), + HexEvalSounds.MISHAP + ) } if (iota is PatternIota) { @@ -195,35 +185,9 @@ class CastingHarness private constructor( HexEvalSounds.MISHAP ) } - } catch (mishap: Mishap) { - val operator = try { - getOperatorForPattern(iota, world) - } catch (e: Throwable) { - null - } - return CastResult( - continuation, - null, - mishap.resolutionType(ctx), - listOf( - OperatorSideEffect.DoMishap( - mishap, - Mishap.Context( - (iota as? PatternIota)?.pattern ?: HexPattern(HexDir.WEST), - operator - ) - ) - ), - HexEvalSounds.MISHAP - ) } catch (exception: Exception) { // This means something very bad has happened exception.printStackTrace() - val operator = try { - getOperatorForPattern(iota, world) - } catch (e: Throwable) { - null - } return CastResult( continuation, null, @@ -233,7 +197,7 @@ class CastingHarness private constructor( MishapError(exception), Mishap.Context( (iota as? PatternIota)?.pattern ?: HexPattern(HexDir.WEST), - operator + null ) ) ), @@ -247,32 +211,51 @@ class CastingHarness private constructor( * handle it functionally. */ fun updateWithPattern(newPat: HexPattern, world: ServerLevel, continuation: SpellContinuation): CastResult { - var actionIdPair: Pair? = null + var castedName: Component? = null try { // Don't catch this one - val mojangPair = PatternRegistry.matchPatternAndID(newPat, world) - actionIdPair = mojangPair.first to mojangPair.second + 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 + } - if (this.ctx.spellCircle == null && !HexConfig.server().isActionAllowed(actionIdPair.second)) { - throw MishapDisallowedSpell() - } else if (this.ctx.spellCircle != null - && !HexConfig.server().isActionAllowedInCircles(actionIdPair.second) - ) { - throw MishapDisallowedSpell("disallowed_circle") + 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 + } + + is Special -> { + lookup.handler.act() to lookup.handler.name + } + + is PatternShapeMatch.Nothing -> throw MishapInvalidPattern() + + else -> throw IllegalStateException() } + castedName = actionNamePair.second + val action = actionNamePair.first - val pattern = actionIdPair.first + // TODO: the config denylist should be handled per VM type. + // I just removed it for now, should re-add it... - val unenlightened = pattern.isGreat && !ctx.isCasterEnlightened + // 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 (!unenlightened || pattern.alwaysProcessGreatSpell) { - displayPattern(false, 0, pattern.displayName) - val result = pattern.operate( + if (!requiresAndFailedEnlightenment || action.alwaysProcessGreatSpell) { + displayPatternDebug(false, 0, castedName) + val result = action.operate( continuation, this.stack.toMutableList(), this.ravenmind, @@ -285,8 +268,8 @@ class CastingHarness private constructor( sideEffects.addAll(result.sideEffects) } - if (unenlightened) { - sideEffects.add(OperatorSideEffect.RequiredEnlightenment(pattern.causesBlindDiversion)) + if (requiresAndFailedEnlightenment) { + sideEffects.add(OperatorSideEffect.RequiredEnlightenment(action.causesBlindDiversion)) } // Stick a poofy particle effect at the caster position @@ -311,6 +294,7 @@ class CastingHarness private constructor( hereFd } + // TODO again this should be per VM var soundType = if (this.ctx.source == CastingContext.CastSource.STAFF) { HexEvalSounds.OPERATOR } else { @@ -342,7 +326,7 @@ class CastingHarness private constructor( continuation, null, mishap.resolutionType(ctx), - listOf(OperatorSideEffect.DoMishap(mishap, Mishap.Context(newPat, actionIdPair?.first))), + listOf(OperatorSideEffect.DoMishap(mishap, Mishap.Context(newPat, castedName))), HexEvalSounds.MISHAP ) } @@ -394,6 +378,7 @@ class CastingHarness private constructor( * Return a non-null value if we handled this in some sort of parenthesey way, * either escaping it onto the stack or changing the parenthese-handling state. */ + @Throws(MishapTooManyCloseParens::class) private fun handleParentheses(iota: Iota): Pair? { val sig = (iota as? PatternIota)?.pattern?.anglesSignature() @@ -497,7 +482,7 @@ class CastingHarness private constructor( .copy() .withStyle(if (out.second == ResolvedPatternType.ESCAPED) ChatFormatting.YELLOW else ChatFormatting.AQUA) } else iota.display() - displayPattern(this.escapeNext, displayDepth, display) + displayPatternDebug(this.escapeNext, displayDepth, display) } return out } diff --git a/Common/src/main/java/at/petrak/hexcasting/api/spell/casting/ControllerInfo.kt b/Common/src/main/java/at/petrak/hexcasting/api/casting/eval/ControllerInfo.kt similarity index 87% rename from Common/src/main/java/at/petrak/hexcasting/api/spell/casting/ControllerInfo.kt rename to Common/src/main/java/at/petrak/hexcasting/api/casting/eval/ControllerInfo.kt index 64d60aba..c17e096c 100644 --- a/Common/src/main/java/at/petrak/hexcasting/api/spell/casting/ControllerInfo.kt +++ b/Common/src/main/java/at/petrak/hexcasting/api/casting/eval/ControllerInfo.kt @@ -1,4 +1,4 @@ -package at.petrak.hexcasting.api.spell.casting +package at.petrak.hexcasting.api.casting.eval import net.minecraft.nbt.CompoundTag diff --git a/Common/src/main/java/at/petrak/hexcasting/api/spell/casting/ResolvedPattern.kt b/Common/src/main/java/at/petrak/hexcasting/api/casting/eval/ResolvedPattern.kt similarity index 84% rename from Common/src/main/java/at/petrak/hexcasting/api/spell/casting/ResolvedPattern.kt rename to Common/src/main/java/at/petrak/hexcasting/api/casting/eval/ResolvedPattern.kt index 0413f64c..61088507 100644 --- a/Common/src/main/java/at/petrak/hexcasting/api/spell/casting/ResolvedPattern.kt +++ b/Common/src/main/java/at/petrak/hexcasting/api/casting/eval/ResolvedPattern.kt @@ -1,7 +1,7 @@ -package at.petrak.hexcasting.api.spell.casting +package at.petrak.hexcasting.api.casting.eval -import at.petrak.hexcasting.api.spell.math.HexCoord -import at.petrak.hexcasting.api.spell.math.HexPattern +import at.petrak.hexcasting.api.casting.math.HexCoord +import at.petrak.hexcasting.api.casting.math.HexPattern import at.petrak.hexcasting.api.utils.NBTBuilder import net.minecraft.nbt.CompoundTag import java.util.* diff --git a/Common/src/main/java/at/petrak/hexcasting/api/spell/casting/ResolvedPatternType.kt b/Common/src/main/java/at/petrak/hexcasting/api/casting/eval/ResolvedPatternType.kt similarity index 91% rename from Common/src/main/java/at/petrak/hexcasting/api/spell/casting/ResolvedPatternType.kt rename to Common/src/main/java/at/petrak/hexcasting/api/casting/eval/ResolvedPatternType.kt index 518f3cec..244d7a1c 100644 --- a/Common/src/main/java/at/petrak/hexcasting/api/spell/casting/ResolvedPatternType.kt +++ b/Common/src/main/java/at/petrak/hexcasting/api/casting/eval/ResolvedPatternType.kt @@ -1,4 +1,4 @@ -package at.petrak.hexcasting.api.spell.casting +package at.petrak.hexcasting.api.casting.eval import at.petrak.hexcasting.api.utils.getSafe diff --git a/Common/src/main/java/at/petrak/hexcasting/api/spell/casting/SpecialPatterns.java b/Common/src/main/java/at/petrak/hexcasting/api/casting/eval/SpecialPatterns.java similarity index 66% rename from Common/src/main/java/at/petrak/hexcasting/api/spell/casting/SpecialPatterns.java rename to Common/src/main/java/at/petrak/hexcasting/api/casting/eval/SpecialPatterns.java index e784b87a..b2276968 100644 --- a/Common/src/main/java/at/petrak/hexcasting/api/spell/casting/SpecialPatterns.java +++ b/Common/src/main/java/at/petrak/hexcasting/api/casting/eval/SpecialPatterns.java @@ -1,7 +1,7 @@ -package at.petrak.hexcasting.api.spell.casting; +package at.petrak.hexcasting.api.casting.eval; -import at.petrak.hexcasting.api.spell.math.HexDir; -import at.petrak.hexcasting.api.spell.math.HexPattern; +import at.petrak.hexcasting.api.casting.math.HexDir; +import at.petrak.hexcasting.api.casting.math.HexPattern; public final class SpecialPatterns { public static final HexPattern INTROSPECTION = HexPattern.fromAngles("qqq", HexDir.WEST); diff --git a/Common/src/main/java/at/petrak/hexcasting/api/spell/casting/SpellCircleContext.kt b/Common/src/main/java/at/petrak/hexcasting/api/casting/eval/SpellCircleContext.kt similarity index 97% rename from Common/src/main/java/at/petrak/hexcasting/api/spell/casting/SpellCircleContext.kt rename to Common/src/main/java/at/petrak/hexcasting/api/casting/eval/SpellCircleContext.kt index 404575f2..bc404876 100644 --- a/Common/src/main/java/at/petrak/hexcasting/api/spell/casting/SpellCircleContext.kt +++ b/Common/src/main/java/at/petrak/hexcasting/api/casting/eval/SpellCircleContext.kt @@ -1,4 +1,4 @@ -package at.petrak.hexcasting.api.spell.casting +package at.petrak.hexcasting.api.casting.eval import at.petrak.hexcasting.api.utils.NBTBuilder import net.minecraft.core.BlockPos diff --git a/Common/src/main/java/at/petrak/hexcasting/api/spell/casting/sideeffects/EvalSound.java b/Common/src/main/java/at/petrak/hexcasting/api/casting/eval/sideeffects/EvalSound.java similarity index 90% rename from Common/src/main/java/at/petrak/hexcasting/api/spell/casting/sideeffects/EvalSound.java rename to Common/src/main/java/at/petrak/hexcasting/api/casting/eval/sideeffects/EvalSound.java index 73e2ad71..a2109858 100644 --- a/Common/src/main/java/at/petrak/hexcasting/api/spell/casting/sideeffects/EvalSound.java +++ b/Common/src/main/java/at/petrak/hexcasting/api/casting/eval/sideeffects/EvalSound.java @@ -1,4 +1,4 @@ -package at.petrak.hexcasting.api.spell.casting.sideeffects; +package at.petrak.hexcasting.api.casting.eval.sideeffects; import net.minecraft.sounds.SoundEvent; import org.jetbrains.annotations.Nullable; diff --git a/Common/src/main/java/at/petrak/hexcasting/api/spell/casting/sideeffects/OperatorSideEffect.kt b/Common/src/main/java/at/petrak/hexcasting/api/casting/eval/sideeffects/OperatorSideEffect.kt similarity index 90% rename from Common/src/main/java/at/petrak/hexcasting/api/spell/casting/sideeffects/OperatorSideEffect.kt rename to Common/src/main/java/at/petrak/hexcasting/api/casting/eval/sideeffects/OperatorSideEffect.kt index e1aa04f7..bdf831de 100644 --- a/Common/src/main/java/at/petrak/hexcasting/api/spell/casting/sideeffects/OperatorSideEffect.kt +++ b/Common/src/main/java/at/petrak/hexcasting/api/casting/eval/sideeffects/OperatorSideEffect.kt @@ -1,13 +1,13 @@ -package at.petrak.hexcasting.api.spell.casting.sideeffects +package at.petrak.hexcasting.api.casting.eval.sideeffects import at.petrak.hexcasting.api.advancements.HexAdvancementTriggers import at.petrak.hexcasting.api.block.circle.BlockEntityAbstractImpetus +import at.petrak.hexcasting.api.casting.ParticleSpray +import at.petrak.hexcasting.api.casting.RenderedSpell +import at.petrak.hexcasting.api.casting.eval.CastingHarness +import at.petrak.hexcasting.api.casting.mishaps.Mishap import at.petrak.hexcasting.api.misc.FrozenColorizer import at.petrak.hexcasting.api.mod.HexStatistics -import at.petrak.hexcasting.api.spell.ParticleSpray -import at.petrak.hexcasting.api.spell.RenderedSpell -import at.petrak.hexcasting.api.spell.casting.CastingHarness -import at.petrak.hexcasting.api.spell.mishaps.Mishap import at.petrak.hexcasting.api.utils.asTranslatedComponent import at.petrak.hexcasting.common.lib.HexItems import net.minecraft.Util @@ -69,7 +69,7 @@ sealed class OperatorSideEffect { data class DoMishap(val mishap: Mishap, val errorCtx: Mishap.Context) : OperatorSideEffect() { override fun performEffect(harness: CastingHarness): Boolean { - val msg = mishap.errorMessage(harness.ctx, errorCtx); + val msg = mishap.errorMessageWithName(harness.ctx, errorCtx); if (harness.ctx.spellCircle != null) { val tile = harness.ctx.world.getBlockEntity(harness.ctx.spellCircle.impetusPos) if (tile is BlockEntityAbstractImpetus) { diff --git a/Common/src/main/java/at/petrak/hexcasting/api/spell/casting/eval/ContinuationFrame.kt b/Common/src/main/java/at/petrak/hexcasting/api/casting/eval/vm/ContinuationFrame.kt similarity index 91% rename from Common/src/main/java/at/petrak/hexcasting/api/spell/casting/eval/ContinuationFrame.kt rename to Common/src/main/java/at/petrak/hexcasting/api/casting/eval/vm/ContinuationFrame.kt index 4d768732..870e3071 100644 --- a/Common/src/main/java/at/petrak/hexcasting/api/spell/casting/eval/ContinuationFrame.kt +++ b/Common/src/main/java/at/petrak/hexcasting/api/casting/eval/vm/ContinuationFrame.kt @@ -1,9 +1,9 @@ -package at.petrak.hexcasting.api.spell.casting.eval +package at.petrak.hexcasting.api.casting.eval.vm -import at.petrak.hexcasting.api.spell.SpellList -import at.petrak.hexcasting.api.spell.casting.CastingHarness -import at.petrak.hexcasting.api.spell.casting.CastingHarness.CastResult -import at.petrak.hexcasting.api.spell.iota.Iota +import at.petrak.hexcasting.api.casting.SpellList +import at.petrak.hexcasting.api.casting.eval.CastingHarness +import at.petrak.hexcasting.api.casting.eval.CastingHarness.CastResult +import at.petrak.hexcasting.api.casting.iota.Iota import at.petrak.hexcasting.api.utils.getList import at.petrak.hexcasting.api.utils.hasList import at.petrak.hexcasting.common.lib.hex.HexIotaTypes diff --git a/Common/src/main/java/at/petrak/hexcasting/api/spell/casting/eval/FrameEvaluate.kt b/Common/src/main/java/at/petrak/hexcasting/api/casting/eval/vm/FrameEvaluate.kt similarity index 87% rename from Common/src/main/java/at/petrak/hexcasting/api/spell/casting/eval/FrameEvaluate.kt rename to Common/src/main/java/at/petrak/hexcasting/api/casting/eval/vm/FrameEvaluate.kt index f8052f2d..daf544e1 100644 --- a/Common/src/main/java/at/petrak/hexcasting/api/spell/casting/eval/FrameEvaluate.kt +++ b/Common/src/main/java/at/petrak/hexcasting/api/casting/eval/vm/FrameEvaluate.kt @@ -1,9 +1,9 @@ -package at.petrak.hexcasting.api.spell.casting.eval +package at.petrak.hexcasting.api.casting.eval.vm -import at.petrak.hexcasting.api.spell.SpellList -import at.petrak.hexcasting.api.spell.casting.CastingHarness -import at.petrak.hexcasting.api.spell.casting.ResolvedPatternType -import at.petrak.hexcasting.api.spell.iota.Iota +import at.petrak.hexcasting.api.casting.SpellList +import at.petrak.hexcasting.api.casting.eval.CastingHarness +import at.petrak.hexcasting.api.casting.eval.ResolvedPatternType +import at.petrak.hexcasting.api.casting.iota.Iota import at.petrak.hexcasting.api.utils.NBTBuilder import at.petrak.hexcasting.api.utils.serializeToNBT import at.petrak.hexcasting.common.lib.hex.HexEvalSounds diff --git a/Common/src/main/java/at/petrak/hexcasting/api/spell/casting/eval/FrameFinishEval.kt b/Common/src/main/java/at/petrak/hexcasting/api/casting/eval/vm/FrameFinishEval.kt similarity index 82% rename from Common/src/main/java/at/petrak/hexcasting/api/spell/casting/eval/FrameFinishEval.kt rename to Common/src/main/java/at/petrak/hexcasting/api/casting/eval/vm/FrameFinishEval.kt index 05ec820b..964683ee 100644 --- a/Common/src/main/java/at/petrak/hexcasting/api/spell/casting/eval/FrameFinishEval.kt +++ b/Common/src/main/java/at/petrak/hexcasting/api/casting/eval/vm/FrameFinishEval.kt @@ -1,8 +1,8 @@ -package at.petrak.hexcasting.api.spell.casting.eval +package at.petrak.hexcasting.api.casting.eval.vm -import at.petrak.hexcasting.api.spell.casting.CastingHarness -import at.petrak.hexcasting.api.spell.casting.ResolvedPatternType -import at.petrak.hexcasting.api.spell.iota.Iota +import at.petrak.hexcasting.api.casting.eval.CastingHarness +import at.petrak.hexcasting.api.casting.eval.ResolvedPatternType +import at.petrak.hexcasting.api.casting.iota.Iota import at.petrak.hexcasting.api.utils.NBTBuilder import at.petrak.hexcasting.common.lib.hex.HexEvalSounds import net.minecraft.server.level.ServerLevel diff --git a/Common/src/main/java/at/petrak/hexcasting/api/spell/casting/eval/FrameForEach.kt b/Common/src/main/java/at/petrak/hexcasting/api/casting/eval/vm/FrameForEach.kt similarity index 90% rename from Common/src/main/java/at/petrak/hexcasting/api/spell/casting/eval/FrameForEach.kt rename to Common/src/main/java/at/petrak/hexcasting/api/casting/eval/vm/FrameForEach.kt index 40107399..01f6d998 100644 --- a/Common/src/main/java/at/petrak/hexcasting/api/spell/casting/eval/FrameForEach.kt +++ b/Common/src/main/java/at/petrak/hexcasting/api/casting/eval/vm/FrameForEach.kt @@ -1,10 +1,10 @@ -package at.petrak.hexcasting.api.spell.casting.eval +package at.petrak.hexcasting.api.casting.eval.vm -import at.petrak.hexcasting.api.spell.SpellList -import at.petrak.hexcasting.api.spell.casting.CastingHarness -import at.petrak.hexcasting.api.spell.casting.ResolvedPatternType -import at.petrak.hexcasting.api.spell.iota.Iota -import at.petrak.hexcasting.api.spell.iota.ListIota +import at.petrak.hexcasting.api.casting.SpellList +import at.petrak.hexcasting.api.casting.eval.CastingHarness +import at.petrak.hexcasting.api.casting.eval.ResolvedPatternType +import at.petrak.hexcasting.api.casting.iota.Iota +import at.petrak.hexcasting.api.casting.iota.ListIota import at.petrak.hexcasting.api.utils.NBTBuilder import at.petrak.hexcasting.api.utils.serializeToNBT import at.petrak.hexcasting.common.lib.hex.HexEvalSounds diff --git a/Common/src/main/java/at/petrak/hexcasting/api/spell/casting/eval/FunctionalData.kt b/Common/src/main/java/at/petrak/hexcasting/api/casting/eval/vm/FunctionalData.kt similarity index 71% rename from Common/src/main/java/at/petrak/hexcasting/api/spell/casting/eval/FunctionalData.kt rename to Common/src/main/java/at/petrak/hexcasting/api/casting/eval/vm/FunctionalData.kt index 32ad396e..49f3d149 100644 --- a/Common/src/main/java/at/petrak/hexcasting/api/spell/casting/eval/FunctionalData.kt +++ b/Common/src/main/java/at/petrak/hexcasting/api/casting/eval/vm/FunctionalData.kt @@ -1,6 +1,6 @@ -package at.petrak.hexcasting.api.spell.casting.eval +package at.petrak.hexcasting.api.casting.eval.vm -import at.petrak.hexcasting.api.spell.iota.Iota +import at.petrak.hexcasting.api.casting.iota.Iota /** * A change to the data in a CastHarness after a pattern is drawn. diff --git a/Common/src/main/java/at/petrak/hexcasting/api/spell/casting/eval/SpellContinuation.kt b/Common/src/main/java/at/petrak/hexcasting/api/casting/eval/vm/SpellContinuation.kt similarity index 86% rename from Common/src/main/java/at/petrak/hexcasting/api/spell/casting/eval/SpellContinuation.kt rename to Common/src/main/java/at/petrak/hexcasting/api/casting/eval/vm/SpellContinuation.kt index d956f6a0..867189b0 100644 --- a/Common/src/main/java/at/petrak/hexcasting/api/spell/casting/eval/SpellContinuation.kt +++ b/Common/src/main/java/at/petrak/hexcasting/api/casting/eval/vm/SpellContinuation.kt @@ -1,4 +1,4 @@ -package at.petrak.hexcasting.api.spell.casting.eval +package at.petrak.hexcasting.api.casting.eval.vm /** * A continuation during the execution of a spell. diff --git a/Common/src/main/java/at/petrak/hexcasting/api/spell/iota/BooleanIota.java b/Common/src/main/java/at/petrak/hexcasting/api/casting/iota/BooleanIota.java similarity index 97% rename from Common/src/main/java/at/petrak/hexcasting/api/spell/iota/BooleanIota.java rename to Common/src/main/java/at/petrak/hexcasting/api/casting/iota/BooleanIota.java index 54e3f2be..91cf0b33 100644 --- a/Common/src/main/java/at/petrak/hexcasting/api/spell/iota/BooleanIota.java +++ b/Common/src/main/java/at/petrak/hexcasting/api/casting/iota/BooleanIota.java @@ -1,4 +1,4 @@ -package at.petrak.hexcasting.api.spell.iota; +package at.petrak.hexcasting.api.casting.iota; import at.petrak.hexcasting.api.utils.HexUtils; import at.petrak.hexcasting.common.lib.hex.HexIotaTypes; diff --git a/Common/src/main/java/at/petrak/hexcasting/api/spell/iota/DoubleIota.java b/Common/src/main/java/at/petrak/hexcasting/api/casting/iota/DoubleIota.java similarity index 97% rename from Common/src/main/java/at/petrak/hexcasting/api/spell/iota/DoubleIota.java rename to Common/src/main/java/at/petrak/hexcasting/api/casting/iota/DoubleIota.java index 288501f7..e9ff20f5 100644 --- a/Common/src/main/java/at/petrak/hexcasting/api/spell/iota/DoubleIota.java +++ b/Common/src/main/java/at/petrak/hexcasting/api/casting/iota/DoubleIota.java @@ -1,4 +1,4 @@ -package at.petrak.hexcasting.api.spell.iota; +package at.petrak.hexcasting.api.casting.iota; import at.petrak.hexcasting.api.utils.HexUtils; import at.petrak.hexcasting.common.lib.hex.HexIotaTypes; diff --git a/Common/src/main/java/at/petrak/hexcasting/api/spell/iota/EntityIota.java b/Common/src/main/java/at/petrak/hexcasting/api/casting/iota/EntityIota.java similarity index 98% rename from Common/src/main/java/at/petrak/hexcasting/api/spell/iota/EntityIota.java rename to Common/src/main/java/at/petrak/hexcasting/api/casting/iota/EntityIota.java index 7c5b0be6..fe2ee51f 100644 --- a/Common/src/main/java/at/petrak/hexcasting/api/spell/iota/EntityIota.java +++ b/Common/src/main/java/at/petrak/hexcasting/api/casting/iota/EntityIota.java @@ -1,4 +1,4 @@ -package at.petrak.hexcasting.api.spell.iota; +package at.petrak.hexcasting.api.casting.iota; import at.petrak.hexcasting.api.utils.HexUtils; import at.petrak.hexcasting.common.lib.hex.HexIotaTypes; diff --git a/Common/src/main/java/at/petrak/hexcasting/api/spell/iota/GarbageIota.java b/Common/src/main/java/at/petrak/hexcasting/api/casting/iota/GarbageIota.java similarity index 97% rename from Common/src/main/java/at/petrak/hexcasting/api/spell/iota/GarbageIota.java rename to Common/src/main/java/at/petrak/hexcasting/api/casting/iota/GarbageIota.java index 4d480f53..08249858 100644 --- a/Common/src/main/java/at/petrak/hexcasting/api/spell/iota/GarbageIota.java +++ b/Common/src/main/java/at/petrak/hexcasting/api/casting/iota/GarbageIota.java @@ -1,4 +1,4 @@ -package at.petrak.hexcasting.api.spell.iota; +package at.petrak.hexcasting.api.casting.iota; import at.petrak.hexcasting.common.lib.hex.HexIotaTypes; import net.minecraft.ChatFormatting; diff --git a/Common/src/main/java/at/petrak/hexcasting/api/spell/iota/Iota.java b/Common/src/main/java/at/petrak/hexcasting/api/casting/iota/Iota.java similarity index 96% rename from Common/src/main/java/at/petrak/hexcasting/api/spell/iota/Iota.java rename to Common/src/main/java/at/petrak/hexcasting/api/casting/iota/Iota.java index 90489361..85491970 100644 --- a/Common/src/main/java/at/petrak/hexcasting/api/spell/iota/Iota.java +++ b/Common/src/main/java/at/petrak/hexcasting/api/casting/iota/Iota.java @@ -1,4 +1,4 @@ -package at.petrak.hexcasting.api.spell.iota; +package at.petrak.hexcasting.api.casting.iota; import at.petrak.hexcasting.common.lib.hex.HexIotaTypes; import net.minecraft.nbt.Tag; diff --git a/Common/src/main/java/at/petrak/hexcasting/api/spell/iota/IotaType.java b/Common/src/main/java/at/petrak/hexcasting/api/casting/iota/IotaType.java similarity index 96% rename from Common/src/main/java/at/petrak/hexcasting/api/spell/iota/IotaType.java rename to Common/src/main/java/at/petrak/hexcasting/api/casting/iota/IotaType.java index f40f024c..97cfc9c0 100644 --- a/Common/src/main/java/at/petrak/hexcasting/api/spell/iota/IotaType.java +++ b/Common/src/main/java/at/petrak/hexcasting/api/casting/iota/IotaType.java @@ -1,4 +1,4 @@ -package at.petrak.hexcasting.api.spell.iota; +package at.petrak.hexcasting.api.casting.iota; import at.petrak.hexcasting.common.lib.hex.HexIotaTypes; import net.minecraft.nbt.Tag; diff --git a/Common/src/main/java/at/petrak/hexcasting/api/spell/iota/ListIota.java b/Common/src/main/java/at/petrak/hexcasting/api/casting/iota/ListIota.java similarity index 97% rename from Common/src/main/java/at/petrak/hexcasting/api/spell/iota/ListIota.java rename to Common/src/main/java/at/petrak/hexcasting/api/casting/iota/ListIota.java index 69f7f3a4..ca4727c7 100644 --- a/Common/src/main/java/at/petrak/hexcasting/api/spell/iota/ListIota.java +++ b/Common/src/main/java/at/petrak/hexcasting/api/casting/iota/ListIota.java @@ -1,6 +1,6 @@ -package at.petrak.hexcasting.api.spell.iota; +package at.petrak.hexcasting.api.casting.iota; -import at.petrak.hexcasting.api.spell.SpellList; +import at.petrak.hexcasting.api.casting.SpellList; import at.petrak.hexcasting.api.utils.HexUtils; import at.petrak.hexcasting.common.lib.hex.HexIotaTypes; import net.minecraft.ChatFormatting; diff --git a/Common/src/main/java/at/petrak/hexcasting/api/spell/iota/NullIota.java b/Common/src/main/java/at/petrak/hexcasting/api/casting/iota/NullIota.java similarity index 97% rename from Common/src/main/java/at/petrak/hexcasting/api/spell/iota/NullIota.java rename to Common/src/main/java/at/petrak/hexcasting/api/casting/iota/NullIota.java index 30ab1b2b..525e6b22 100644 --- a/Common/src/main/java/at/petrak/hexcasting/api/spell/iota/NullIota.java +++ b/Common/src/main/java/at/petrak/hexcasting/api/casting/iota/NullIota.java @@ -1,4 +1,4 @@ -package at.petrak.hexcasting.api.spell.iota; +package at.petrak.hexcasting.api.casting.iota; import at.petrak.hexcasting.common.lib.hex.HexIotaTypes; import net.minecraft.ChatFormatting; diff --git a/Common/src/main/java/at/petrak/hexcasting/api/spell/iota/PatternIota.java b/Common/src/main/java/at/petrak/hexcasting/api/casting/iota/PatternIota.java similarity index 95% rename from Common/src/main/java/at/petrak/hexcasting/api/spell/iota/PatternIota.java rename to Common/src/main/java/at/petrak/hexcasting/api/casting/iota/PatternIota.java index f7a28597..0f9b10c3 100644 --- a/Common/src/main/java/at/petrak/hexcasting/api/spell/iota/PatternIota.java +++ b/Common/src/main/java/at/petrak/hexcasting/api/casting/iota/PatternIota.java @@ -1,6 +1,6 @@ -package at.petrak.hexcasting.api.spell.iota; +package at.petrak.hexcasting.api.casting.iota; -import at.petrak.hexcasting.api.spell.math.HexPattern; +import at.petrak.hexcasting.api.casting.math.HexPattern; import at.petrak.hexcasting.api.utils.HexUtils; import at.petrak.hexcasting.common.lib.hex.HexIotaTypes; import net.minecraft.ChatFormatting; diff --git a/Common/src/main/java/at/petrak/hexcasting/api/spell/iota/Vec3Iota.java b/Common/src/main/java/at/petrak/hexcasting/api/casting/iota/Vec3Iota.java similarity index 98% rename from Common/src/main/java/at/petrak/hexcasting/api/spell/iota/Vec3Iota.java rename to Common/src/main/java/at/petrak/hexcasting/api/casting/iota/Vec3Iota.java index 1babae96..d620878f 100644 --- a/Common/src/main/java/at/petrak/hexcasting/api/spell/iota/Vec3Iota.java +++ b/Common/src/main/java/at/petrak/hexcasting/api/casting/iota/Vec3Iota.java @@ -1,4 +1,4 @@ -package at.petrak.hexcasting.api.spell.iota; +package at.petrak.hexcasting.api.casting.iota; import at.petrak.hexcasting.api.utils.HexUtils; import at.petrak.hexcasting.common.lib.hex.HexIotaTypes; diff --git a/Common/src/main/java/at/petrak/hexcasting/api/spell/math/EulerPathFinder.kt b/Common/src/main/java/at/petrak/hexcasting/api/casting/math/EulerPathFinder.kt similarity index 98% rename from Common/src/main/java/at/petrak/hexcasting/api/spell/math/EulerPathFinder.kt rename to Common/src/main/java/at/petrak/hexcasting/api/casting/math/EulerPathFinder.kt index efdbe780..d79ff002 100644 --- a/Common/src/main/java/at/petrak/hexcasting/api/spell/math/EulerPathFinder.kt +++ b/Common/src/main/java/at/petrak/hexcasting/api/casting/math/EulerPathFinder.kt @@ -1,4 +1,4 @@ -package at.petrak.hexcasting.api.spell.math +package at.petrak.hexcasting.api.casting.math import at.petrak.hexcasting.api.HexAPI import java.util.* diff --git a/Common/src/main/java/at/petrak/hexcasting/api/spell/math/HexAngle.kt b/Common/src/main/java/at/petrak/hexcasting/api/casting/math/HexAngle.kt similarity index 82% rename from Common/src/main/java/at/petrak/hexcasting/api/spell/math/HexAngle.kt rename to Common/src/main/java/at/petrak/hexcasting/api/casting/math/HexAngle.kt index 4565329b..bca8b0b9 100644 --- a/Common/src/main/java/at/petrak/hexcasting/api/spell/math/HexAngle.kt +++ b/Common/src/main/java/at/petrak/hexcasting/api/casting/math/HexAngle.kt @@ -1,4 +1,4 @@ -package at.petrak.hexcasting.api.spell.math +package at.petrak.hexcasting.api.casting.math enum class HexAngle { FORWARD, RIGHT, RIGHT_BACK, BACK, LEFT_BACK, LEFT; diff --git a/Common/src/main/java/at/petrak/hexcasting/api/spell/math/HexCoord.kt b/Common/src/main/java/at/petrak/hexcasting/api/casting/math/HexCoord.kt similarity index 97% rename from Common/src/main/java/at/petrak/hexcasting/api/spell/math/HexCoord.kt rename to Common/src/main/java/at/petrak/hexcasting/api/casting/math/HexCoord.kt index 82506f0e..a10d3dfe 100644 --- a/Common/src/main/java/at/petrak/hexcasting/api/spell/math/HexCoord.kt +++ b/Common/src/main/java/at/petrak/hexcasting/api/casting/math/HexCoord.kt @@ -1,4 +1,4 @@ -package at.petrak.hexcasting.api.spell.math +package at.petrak.hexcasting.api.casting.math import kotlin.math.abs import kotlin.math.max diff --git a/Common/src/main/java/at/petrak/hexcasting/api/spell/math/HexDir.kt b/Common/src/main/java/at/petrak/hexcasting/api/casting/math/HexDir.kt similarity index 95% rename from Common/src/main/java/at/petrak/hexcasting/api/spell/math/HexDir.kt rename to Common/src/main/java/at/petrak/hexcasting/api/casting/math/HexDir.kt index afef8666..514cb0e4 100644 --- a/Common/src/main/java/at/petrak/hexcasting/api/spell/math/HexDir.kt +++ b/Common/src/main/java/at/petrak/hexcasting/api/casting/math/HexDir.kt @@ -1,4 +1,4 @@ -package at.petrak.hexcasting.api.spell.math +package at.petrak.hexcasting.api.casting.math import at.petrak.hexcasting.api.utils.getSafe diff --git a/Common/src/main/java/at/petrak/hexcasting/api/spell/math/HexPattern.kt b/Common/src/main/java/at/petrak/hexcasting/api/casting/math/HexPattern.kt similarity index 99% rename from Common/src/main/java/at/petrak/hexcasting/api/spell/math/HexPattern.kt rename to Common/src/main/java/at/petrak/hexcasting/api/casting/math/HexPattern.kt index d05d6874..53062de5 100644 --- a/Common/src/main/java/at/petrak/hexcasting/api/spell/math/HexPattern.kt +++ b/Common/src/main/java/at/petrak/hexcasting/api/casting/math/HexPattern.kt @@ -1,4 +1,4 @@ -package at.petrak.hexcasting.api.spell.math +package at.petrak.hexcasting.api.casting.math import at.petrak.hexcasting.api.utils.NBTBuilder import at.petrak.hexcasting.api.utils.coordToPx diff --git a/Common/src/main/java/at/petrak/hexcasting/api/spell/mishaps/Mishap.kt b/Common/src/main/java/at/petrak/hexcasting/api/casting/mishaps/Mishap.kt similarity index 82% rename from Common/src/main/java/at/petrak/hexcasting/api/spell/mishaps/Mishap.kt rename to Common/src/main/java/at/petrak/hexcasting/api/casting/mishaps/Mishap.kt index 44ee54f9..7d4121ad 100644 --- a/Common/src/main/java/at/petrak/hexcasting/api/spell/mishaps/Mishap.kt +++ b/Common/src/main/java/at/petrak/hexcasting/api/casting/mishaps/Mishap.kt @@ -1,13 +1,12 @@ -package at.petrak.hexcasting.api.spell.mishaps +package at.petrak.hexcasting.api.casting.mishaps +import at.petrak.hexcasting.api.casting.ParticleSpray +import at.petrak.hexcasting.api.casting.eval.CastingContext +import at.petrak.hexcasting.api.casting.eval.ResolvedPatternType +import at.petrak.hexcasting.api.casting.iota.Iota +import at.petrak.hexcasting.api.casting.math.HexPattern import at.petrak.hexcasting.api.misc.FrozenColorizer import at.petrak.hexcasting.api.mod.HexTags -import at.petrak.hexcasting.api.spell.Action -import at.petrak.hexcasting.api.spell.ParticleSpray -import at.petrak.hexcasting.api.spell.casting.CastingContext -import at.petrak.hexcasting.api.spell.casting.ResolvedPatternType -import at.petrak.hexcasting.api.spell.iota.Iota -import at.petrak.hexcasting.api.spell.math.HexPattern import at.petrak.hexcasting.api.utils.asTranslatedComponent import at.petrak.hexcasting.api.utils.lightPurple import at.petrak.hexcasting.common.lib.HexItems @@ -41,7 +40,18 @@ abstract class Mishap : Throwable() { */ abstract fun execute(ctx: CastingContext, errorCtx: Context, stack: MutableList) - abstract fun errorMessage(ctx: CastingContext, errorCtx: Context): Component + abstract protected fun errorMessage(ctx: CastingContext, errorCtx: Context): Component + + /** + * Every error message should be prefixed with the name of the action... + */ + public fun errorMessageWithName(ctx: CastingContext, errorCtx: Context): Component { + return if (errorCtx.name != null) { + errorCtx.name.copy().append(": ").append(this.errorMessage(ctx, errorCtx)) + } else { + this.errorMessage(ctx, errorCtx) + } + } // Useful helper functions @@ -54,8 +64,8 @@ abstract class Mishap : Throwable() { protected fun error(stub: String, vararg args: Any): Component = "hexcasting.mishap.$stub".asTranslatedComponent(*args) - protected fun actionName(action: Action?): Component = - action?.displayName ?: "hexcasting.spell.null".asTranslatedComponent.lightPurple + protected fun actionName(name: Component?): Component = + name ?: "hexcasting.spell.null".asTranslatedComponent.lightPurple protected fun yeetHeldItemsTowards(ctx: CastingContext, targetPos: Vec3) { // Knock the player's items out of their hands @@ -101,7 +111,7 @@ abstract class Mishap : Throwable() { return ctx.world.getBlockState(pos).block.name } - data class Context(val pattern: HexPattern, val action: Action?) + data class Context(val pattern: HexPattern, val name: Component?) companion object { fun trulyHurt(entity: LivingEntity, source: DamageSource, amount: Float) { diff --git a/Common/src/main/java/at/petrak/hexcasting/api/spell/mishaps/MishapAlreadyBrainswept.kt b/Common/src/main/java/at/petrak/hexcasting/api/casting/mishaps/MishapAlreadyBrainswept.kt similarity index 78% rename from Common/src/main/java/at/petrak/hexcasting/api/spell/mishaps/MishapAlreadyBrainswept.kt rename to Common/src/main/java/at/petrak/hexcasting/api/casting/mishaps/MishapAlreadyBrainswept.kt index 07e5a00d..07e656b3 100644 --- a/Common/src/main/java/at/petrak/hexcasting/api/spell/mishaps/MishapAlreadyBrainswept.kt +++ b/Common/src/main/java/at/petrak/hexcasting/api/casting/mishaps/MishapAlreadyBrainswept.kt @@ -1,10 +1,10 @@ -package at.petrak.hexcasting.api.spell.mishaps +package at.petrak.hexcasting.api.casting.mishaps import at.petrak.hexcasting.api.misc.FrozenColorizer import at.petrak.hexcasting.api.misc.HexDamageSources -import at.petrak.hexcasting.api.spell.ParticleSpray -import at.petrak.hexcasting.api.spell.casting.CastingContext -import at.petrak.hexcasting.api.spell.iota.Iota +import at.petrak.hexcasting.api.casting.ParticleSpray +import at.petrak.hexcasting.api.casting.eval.CastingContext +import at.petrak.hexcasting.api.casting.iota.Iota import net.minecraft.world.entity.Mob import net.minecraft.world.item.DyeColor diff --git a/Common/src/main/java/at/petrak/hexcasting/api/spell/mishaps/MishapBadBlock.kt b/Common/src/main/java/at/petrak/hexcasting/api/casting/mishaps/MishapBadBlock.kt similarity index 85% rename from Common/src/main/java/at/petrak/hexcasting/api/spell/mishaps/MishapBadBlock.kt rename to Common/src/main/java/at/petrak/hexcasting/api/casting/mishaps/MishapBadBlock.kt index 822515c1..d239af9a 100644 --- a/Common/src/main/java/at/petrak/hexcasting/api/spell/mishaps/MishapBadBlock.kt +++ b/Common/src/main/java/at/petrak/hexcasting/api/casting/mishaps/MishapBadBlock.kt @@ -1,9 +1,9 @@ -package at.petrak.hexcasting.api.spell.mishaps +package at.petrak.hexcasting.api.casting.mishaps import at.petrak.hexcasting.api.misc.FrozenColorizer -import at.petrak.hexcasting.api.spell.ParticleSpray -import at.petrak.hexcasting.api.spell.iota.Iota -import at.petrak.hexcasting.api.spell.casting.CastingContext +import at.petrak.hexcasting.api.casting.ParticleSpray +import at.petrak.hexcasting.api.casting.iota.Iota +import at.petrak.hexcasting.api.casting.eval.CastingContext import at.petrak.hexcasting.api.utils.asTranslatedComponent import net.minecraft.core.BlockPos import net.minecraft.network.chat.Component diff --git a/Common/src/main/java/at/petrak/hexcasting/api/spell/mishaps/MishapBadBrainsweep.kt b/Common/src/main/java/at/petrak/hexcasting/api/casting/mishaps/MishapBadBrainsweep.kt similarity index 81% rename from Common/src/main/java/at/petrak/hexcasting/api/spell/mishaps/MishapBadBrainsweep.kt rename to Common/src/main/java/at/petrak/hexcasting/api/casting/mishaps/MishapBadBrainsweep.kt index 78e35e2b..59a441eb 100644 --- a/Common/src/main/java/at/petrak/hexcasting/api/spell/mishaps/MishapBadBrainsweep.kt +++ b/Common/src/main/java/at/petrak/hexcasting/api/casting/mishaps/MishapBadBrainsweep.kt @@ -1,10 +1,10 @@ -package at.petrak.hexcasting.api.spell.mishaps +package at.petrak.hexcasting.api.casting.mishaps import at.petrak.hexcasting.api.misc.FrozenColorizer import at.petrak.hexcasting.api.misc.HexDamageSources -import at.petrak.hexcasting.api.spell.ParticleSpray -import at.petrak.hexcasting.api.spell.casting.CastingContext -import at.petrak.hexcasting.api.spell.iota.Iota +import at.petrak.hexcasting.api.casting.ParticleSpray +import at.petrak.hexcasting.api.casting.eval.CastingContext +import at.petrak.hexcasting.api.casting.iota.Iota import net.minecraft.core.BlockPos import net.minecraft.world.entity.Mob import net.minecraft.world.item.DyeColor diff --git a/Common/src/main/java/at/petrak/hexcasting/api/spell/mishaps/MishapBadEntity.kt b/Common/src/main/java/at/petrak/hexcasting/api/casting/mishaps/MishapBadEntity.kt similarity index 81% rename from Common/src/main/java/at/petrak/hexcasting/api/spell/mishaps/MishapBadEntity.kt rename to Common/src/main/java/at/petrak/hexcasting/api/casting/mishaps/MishapBadEntity.kt index ba3cbcec..2a5be33a 100644 --- a/Common/src/main/java/at/petrak/hexcasting/api/spell/mishaps/MishapBadEntity.kt +++ b/Common/src/main/java/at/petrak/hexcasting/api/casting/mishaps/MishapBadEntity.kt @@ -1,8 +1,8 @@ -package at.petrak.hexcasting.api.spell.mishaps +package at.petrak.hexcasting.api.casting.mishaps +import at.petrak.hexcasting.api.casting.eval.CastingContext +import at.petrak.hexcasting.api.casting.iota.Iota import at.petrak.hexcasting.api.misc.FrozenColorizer -import at.petrak.hexcasting.api.spell.casting.CastingContext -import at.petrak.hexcasting.api.spell.iota.Iota import at.petrak.hexcasting.api.utils.aqua import at.petrak.hexcasting.api.utils.asTranslatedComponent import net.minecraft.network.chat.Component @@ -19,7 +19,7 @@ class MishapBadEntity(val entity: Entity, val wanted: Component) : Mishap() { } override fun errorMessage(ctx: CastingContext, errorCtx: Context) = - error("bad_entity", actionName(errorCtx.action), wanted, entity.displayName.plainCopy().aqua) + error("bad_entity", wanted, entity.displayName.plainCopy().aqua) companion object { @JvmStatic diff --git a/Common/src/main/java/at/petrak/hexcasting/api/spell/mishaps/MishapBadItem.kt b/Common/src/main/java/at/petrak/hexcasting/api/casting/mishaps/MishapBadItem.kt similarity index 75% rename from Common/src/main/java/at/petrak/hexcasting/api/spell/mishaps/MishapBadItem.kt rename to Common/src/main/java/at/petrak/hexcasting/api/casting/mishaps/MishapBadItem.kt index e147e634..e2b13656 100644 --- a/Common/src/main/java/at/petrak/hexcasting/api/spell/mishaps/MishapBadItem.kt +++ b/Common/src/main/java/at/petrak/hexcasting/api/casting/mishaps/MishapBadItem.kt @@ -1,8 +1,8 @@ -package at.petrak.hexcasting.api.spell.mishaps +package at.petrak.hexcasting.api.casting.mishaps +import at.petrak.hexcasting.api.casting.eval.CastingContext +import at.petrak.hexcasting.api.casting.iota.Iota import at.petrak.hexcasting.api.misc.FrozenColorizer -import at.petrak.hexcasting.api.spell.iota.Iota -import at.petrak.hexcasting.api.spell.casting.CastingContext import at.petrak.hexcasting.api.utils.asTranslatedComponent import net.minecraft.network.chat.Component import net.minecraft.world.entity.item.ItemEntity @@ -17,9 +17,9 @@ class MishapBadItem(val item: ItemEntity, val wanted: Component) : Mishap() { } override fun errorMessage(ctx: CastingContext, errorCtx: Context) = if (item.item.isEmpty) - error("no_item", actionName(errorCtx.action), wanted) + error("no_item", wanted) else - error("bad_item", actionName(errorCtx.action), wanted, item.item.count, item.item.displayName) + error("bad_item", wanted, item.item.count, item.item.displayName) companion object { @JvmStatic diff --git a/Common/src/main/java/at/petrak/hexcasting/api/spell/mishaps/MishapBadOffhandItem.kt b/Common/src/main/java/at/petrak/hexcasting/api/casting/mishaps/MishapBadOffhandItem.kt similarity index 76% rename from Common/src/main/java/at/petrak/hexcasting/api/spell/mishaps/MishapBadOffhandItem.kt rename to Common/src/main/java/at/petrak/hexcasting/api/casting/mishaps/MishapBadOffhandItem.kt index 71dda350..82633c99 100644 --- a/Common/src/main/java/at/petrak/hexcasting/api/spell/mishaps/MishapBadOffhandItem.kt +++ b/Common/src/main/java/at/petrak/hexcasting/api/casting/mishaps/MishapBadOffhandItem.kt @@ -1,8 +1,8 @@ -package at.petrak.hexcasting.api.spell.mishaps +package at.petrak.hexcasting.api.casting.mishaps +import at.petrak.hexcasting.api.casting.eval.CastingContext +import at.petrak.hexcasting.api.casting.iota.Iota import at.petrak.hexcasting.api.misc.FrozenColorizer -import at.petrak.hexcasting.api.spell.iota.Iota -import at.petrak.hexcasting.api.spell.casting.CastingContext import at.petrak.hexcasting.api.utils.asTranslatedComponent import net.minecraft.network.chat.Component import net.minecraft.world.InteractionHand @@ -18,9 +18,9 @@ class MishapBadOffhandItem(val item: ItemStack, val hand: InteractionHand, val w } override fun errorMessage(ctx: CastingContext, errorCtx: Context) = if (item.isEmpty) - error("no_item.offhand", actionName(errorCtx.action), wanted) + error("no_item.offhand", wanted) else - error("bad_item.offhand", actionName(errorCtx.action), wanted, item.count, item.displayName) + error("bad_item.offhand", wanted, item.count, item.displayName) companion object { @JvmStatic diff --git a/Common/src/main/java/at/petrak/hexcasting/api/spell/mishaps/MishapDisallowedSpell.kt b/Common/src/main/java/at/petrak/hexcasting/api/casting/mishaps/MishapDisallowedSpell.kt similarity index 67% rename from Common/src/main/java/at/petrak/hexcasting/api/spell/mishaps/MishapDisallowedSpell.kt rename to Common/src/main/java/at/petrak/hexcasting/api/casting/mishaps/MishapDisallowedSpell.kt index 65da779f..d040d1b8 100644 --- a/Common/src/main/java/at/petrak/hexcasting/api/spell/mishaps/MishapDisallowedSpell.kt +++ b/Common/src/main/java/at/petrak/hexcasting/api/casting/mishaps/MishapDisallowedSpell.kt @@ -1,9 +1,9 @@ -package at.petrak.hexcasting.api.spell.mishaps +package at.petrak.hexcasting.api.casting.mishaps +import at.petrak.hexcasting.api.casting.eval.CastingContext +import at.petrak.hexcasting.api.casting.eval.ResolvedPatternType +import at.petrak.hexcasting.api.casting.iota.Iota import at.petrak.hexcasting.api.misc.FrozenColorizer -import at.petrak.hexcasting.api.spell.iota.Iota -import at.petrak.hexcasting.api.spell.casting.CastingContext -import at.petrak.hexcasting.api.spell.casting.ResolvedPatternType import net.minecraft.world.item.DyeColor class MishapDisallowedSpell(val type: String = "disallowed") : Mishap() { @@ -17,5 +17,5 @@ class MishapDisallowedSpell(val type: String = "disallowed") : Mishap() { } override fun errorMessage(ctx: CastingContext, errorCtx: Context) = - error(type, actionName(errorCtx.action)) + error(type) } diff --git a/Common/src/main/java/at/petrak/hexcasting/api/spell/mishaps/MishapDivideByZero.kt b/Common/src/main/java/at/petrak/hexcasting/api/casting/mishaps/MishapDivideByZero.kt similarity index 88% rename from Common/src/main/java/at/petrak/hexcasting/api/spell/mishaps/MishapDivideByZero.kt rename to Common/src/main/java/at/petrak/hexcasting/api/casting/mishaps/MishapDivideByZero.kt index 7b9ec707..6915184e 100644 --- a/Common/src/main/java/at/petrak/hexcasting/api/spell/mishaps/MishapDivideByZero.kt +++ b/Common/src/main/java/at/petrak/hexcasting/api/casting/mishaps/MishapDivideByZero.kt @@ -1,12 +1,12 @@ -package at.petrak.hexcasting.api.spell.mishaps +package at.petrak.hexcasting.api.casting.mishaps import at.petrak.hexcasting.api.misc.FrozenColorizer import at.petrak.hexcasting.api.misc.HexDamageSources -import at.petrak.hexcasting.api.spell.casting.CastingContext -import at.petrak.hexcasting.api.spell.iota.DoubleIota -import at.petrak.hexcasting.api.spell.iota.GarbageIota -import at.petrak.hexcasting.api.spell.iota.Iota -import at.petrak.hexcasting.api.spell.iota.Vec3Iota +import at.petrak.hexcasting.api.casting.eval.CastingContext +import at.petrak.hexcasting.api.casting.iota.DoubleIota +import at.petrak.hexcasting.api.casting.iota.GarbageIota +import at.petrak.hexcasting.api.casting.iota.Iota +import at.petrak.hexcasting.api.casting.iota.Vec3Iota import at.petrak.hexcasting.api.utils.asTranslatedComponent import net.minecraft.network.chat.Component import net.minecraft.world.item.DyeColor diff --git a/Common/src/main/java/at/petrak/hexcasting/api/spell/mishaps/MishapEntityTooFarAway.kt b/Common/src/main/java/at/petrak/hexcasting/api/casting/mishaps/MishapEntityTooFarAway.kt similarity index 73% rename from Common/src/main/java/at/petrak/hexcasting/api/spell/mishaps/MishapEntityTooFarAway.kt rename to Common/src/main/java/at/petrak/hexcasting/api/casting/mishaps/MishapEntityTooFarAway.kt index 5eb5fab7..d7000a83 100644 --- a/Common/src/main/java/at/petrak/hexcasting/api/spell/mishaps/MishapEntityTooFarAway.kt +++ b/Common/src/main/java/at/petrak/hexcasting/api/casting/mishaps/MishapEntityTooFarAway.kt @@ -1,8 +1,8 @@ -package at.petrak.hexcasting.api.spell.mishaps +package at.petrak.hexcasting.api.casting.mishaps +import at.petrak.hexcasting.api.casting.eval.CastingContext +import at.petrak.hexcasting.api.casting.iota.Iota import at.petrak.hexcasting.api.misc.FrozenColorizer -import at.petrak.hexcasting.api.spell.casting.CastingContext -import at.petrak.hexcasting.api.spell.iota.Iota import net.minecraft.network.chat.Component import net.minecraft.world.entity.Entity import net.minecraft.world.item.DyeColor @@ -17,5 +17,5 @@ class MishapEntityTooFarAway(val entity: Entity) : Mishap() { } override fun errorMessage(ctx: CastingContext, errorCtx: Context): Component = - error("entity_too_far", entity.displayName, actionName(errorCtx.action)) + error("entity_too_far", entity.displayName) } diff --git a/Common/src/main/java/at/petrak/hexcasting/api/spell/mishaps/MishapError.kt b/Common/src/main/java/at/petrak/hexcasting/api/casting/mishaps/MishapError.kt similarity index 67% rename from Common/src/main/java/at/petrak/hexcasting/api/spell/mishaps/MishapError.kt rename to Common/src/main/java/at/petrak/hexcasting/api/casting/mishaps/MishapError.kt index 0f6d4666..c9ae9491 100644 --- a/Common/src/main/java/at/petrak/hexcasting/api/spell/mishaps/MishapError.kt +++ b/Common/src/main/java/at/petrak/hexcasting/api/casting/mishaps/MishapError.kt @@ -1,8 +1,8 @@ -package at.petrak.hexcasting.api.spell.mishaps +package at.petrak.hexcasting.api.casting.mishaps +import at.petrak.hexcasting.api.casting.eval.CastingContext +import at.petrak.hexcasting.api.casting.iota.Iota import at.petrak.hexcasting.api.misc.FrozenColorizer -import at.petrak.hexcasting.api.spell.iota.Iota -import at.petrak.hexcasting.api.spell.casting.CastingContext import net.minecraft.world.item.DyeColor class MishapError(val exception: Exception) : Mishap() { @@ -14,5 +14,5 @@ class MishapError(val exception: Exception) : Mishap() { } override fun errorMessage(ctx: CastingContext, errorCtx: Context) = - error("unknown", actionName(errorCtx.action), exception) + error("unknown", exception) } diff --git a/Common/src/main/java/at/petrak/hexcasting/api/spell/mishaps/MishapEvalTooDeep.kt b/Common/src/main/java/at/petrak/hexcasting/api/casting/mishaps/MishapEvalTooDeep.kt similarity index 75% rename from Common/src/main/java/at/petrak/hexcasting/api/spell/mishaps/MishapEvalTooDeep.kt rename to Common/src/main/java/at/petrak/hexcasting/api/casting/mishaps/MishapEvalTooDeep.kt index c118486f..b9aefc0c 100644 --- a/Common/src/main/java/at/petrak/hexcasting/api/spell/mishaps/MishapEvalTooDeep.kt +++ b/Common/src/main/java/at/petrak/hexcasting/api/casting/mishaps/MishapEvalTooDeep.kt @@ -1,8 +1,8 @@ -package at.petrak.hexcasting.api.spell.mishaps +package at.petrak.hexcasting.api.casting.mishaps import at.petrak.hexcasting.api.misc.FrozenColorizer -import at.petrak.hexcasting.api.spell.iota.Iota -import at.petrak.hexcasting.api.spell.casting.CastingContext +import at.petrak.hexcasting.api.casting.iota.Iota +import at.petrak.hexcasting.api.casting.eval.CastingContext import net.minecraft.world.item.DyeColor class MishapEvalTooDeep : Mishap() { diff --git a/Common/src/main/java/at/petrak/hexcasting/api/spell/mishaps/MishapImmuneEntity.kt b/Common/src/main/java/at/petrak/hexcasting/api/casting/mishaps/MishapImmuneEntity.kt similarity index 69% rename from Common/src/main/java/at/petrak/hexcasting/api/spell/mishaps/MishapImmuneEntity.kt rename to Common/src/main/java/at/petrak/hexcasting/api/casting/mishaps/MishapImmuneEntity.kt index 793641f4..07182411 100644 --- a/Common/src/main/java/at/petrak/hexcasting/api/spell/mishaps/MishapImmuneEntity.kt +++ b/Common/src/main/java/at/petrak/hexcasting/api/casting/mishaps/MishapImmuneEntity.kt @@ -1,8 +1,8 @@ -package at.petrak.hexcasting.api.spell.mishaps +package at.petrak.hexcasting.api.casting.mishaps +import at.petrak.hexcasting.api.casting.eval.CastingContext +import at.petrak.hexcasting.api.casting.iota.Iota import at.petrak.hexcasting.api.misc.FrozenColorizer -import at.petrak.hexcasting.api.spell.iota.Iota -import at.petrak.hexcasting.api.spell.casting.CastingContext import at.petrak.hexcasting.api.utils.aqua import net.minecraft.world.entity.Entity import net.minecraft.world.item.DyeColor @@ -16,5 +16,5 @@ class MishapImmuneEntity(val entity: Entity) : Mishap() { } override fun errorMessage(ctx: CastingContext, errorCtx: Context) = - error("immune_entity", actionName(errorCtx.action), entity.displayName.plainCopy().aqua) + error("immune_entity", entity.displayName.plainCopy().aqua) } diff --git a/Common/src/main/java/at/petrak/hexcasting/api/spell/mishaps/MishapInvalidIota.kt b/Common/src/main/java/at/petrak/hexcasting/api/casting/mishaps/MishapInvalidIota.kt similarity index 82% rename from Common/src/main/java/at/petrak/hexcasting/api/spell/mishaps/MishapInvalidIota.kt rename to Common/src/main/java/at/petrak/hexcasting/api/casting/mishaps/MishapInvalidIota.kt index 1e1b6b83..a1a555f0 100644 --- a/Common/src/main/java/at/petrak/hexcasting/api/spell/mishaps/MishapInvalidIota.kt +++ b/Common/src/main/java/at/petrak/hexcasting/api/casting/mishaps/MishapInvalidIota.kt @@ -1,9 +1,9 @@ -package at.petrak.hexcasting.api.spell.mishaps +package at.petrak.hexcasting.api.casting.mishaps +import at.petrak.hexcasting.api.casting.eval.CastingContext +import at.petrak.hexcasting.api.casting.iota.GarbageIota +import at.petrak.hexcasting.api.casting.iota.Iota import at.petrak.hexcasting.api.misc.FrozenColorizer -import at.petrak.hexcasting.api.spell.casting.CastingContext -import at.petrak.hexcasting.api.spell.iota.GarbageIota -import at.petrak.hexcasting.api.spell.iota.Iota import at.petrak.hexcasting.api.utils.asTranslatedComponent import net.minecraft.network.chat.Component import net.minecraft.world.item.DyeColor @@ -27,7 +27,7 @@ class MishapInvalidIota( override fun errorMessage(ctx: CastingContext, errorCtx: Context) = error( - "invalid_value", actionName(errorCtx.action), expected, reverseIdx, + "invalid_value", expected, reverseIdx, perpetrator.display() ) diff --git a/Common/src/main/java/at/petrak/hexcasting/api/spell/mishaps/MishapInvalidPattern.kt b/Common/src/main/java/at/petrak/hexcasting/api/casting/mishaps/MishapInvalidPattern.kt similarity index 67% rename from Common/src/main/java/at/petrak/hexcasting/api/spell/mishaps/MishapInvalidPattern.kt rename to Common/src/main/java/at/petrak/hexcasting/api/casting/mishaps/MishapInvalidPattern.kt index f1bee32a..8a2ff5ee 100644 --- a/Common/src/main/java/at/petrak/hexcasting/api/spell/mishaps/MishapInvalidPattern.kt +++ b/Common/src/main/java/at/petrak/hexcasting/api/casting/mishaps/MishapInvalidPattern.kt @@ -1,10 +1,10 @@ -package at.petrak.hexcasting.api.spell.mishaps +package at.petrak.hexcasting.api.casting.mishaps import at.petrak.hexcasting.api.misc.FrozenColorizer -import at.petrak.hexcasting.api.spell.casting.CastingContext -import at.petrak.hexcasting.api.spell.casting.ResolvedPatternType -import at.petrak.hexcasting.api.spell.iota.GarbageIota -import at.petrak.hexcasting.api.spell.iota.Iota +import at.petrak.hexcasting.api.casting.eval.CastingContext +import at.petrak.hexcasting.api.casting.eval.ResolvedPatternType +import at.petrak.hexcasting.api.casting.iota.GarbageIota +import at.petrak.hexcasting.api.casting.iota.Iota import net.minecraft.world.item.DyeColor class MishapInvalidPattern : Mishap() { diff --git a/Common/src/main/java/at/petrak/hexcasting/api/spell/mishaps/MishapInvalidSpellDatumType.kt b/Common/src/main/java/at/petrak/hexcasting/api/casting/mishaps/MishapInvalidSpellDatumType.kt similarity index 79% rename from Common/src/main/java/at/petrak/hexcasting/api/spell/mishaps/MishapInvalidSpellDatumType.kt rename to Common/src/main/java/at/petrak/hexcasting/api/casting/mishaps/MishapInvalidSpellDatumType.kt index 49ea0825..721ccdfd 100644 --- a/Common/src/main/java/at/petrak/hexcasting/api/spell/mishaps/MishapInvalidSpellDatumType.kt +++ b/Common/src/main/java/at/petrak/hexcasting/api/casting/mishaps/MishapInvalidSpellDatumType.kt @@ -1,8 +1,8 @@ -package at.petrak.hexcasting.api.spell.mishaps +package at.petrak.hexcasting.api.casting.mishaps import at.petrak.hexcasting.api.misc.FrozenColorizer -import at.petrak.hexcasting.api.spell.iota.Iota -import at.petrak.hexcasting.api.spell.casting.CastingContext +import at.petrak.hexcasting.api.casting.iota.Iota +import at.petrak.hexcasting.api.casting.eval.CastingContext import net.minecraft.world.item.DyeColor /** diff --git a/Common/src/main/java/at/petrak/hexcasting/api/spell/mishaps/MishapLocationInWrongDimension.kt b/Common/src/main/java/at/petrak/hexcasting/api/casting/mishaps/MishapLocationInWrongDimension.kt similarity index 69% rename from Common/src/main/java/at/petrak/hexcasting/api/spell/mishaps/MishapLocationInWrongDimension.kt rename to Common/src/main/java/at/petrak/hexcasting/api/casting/mishaps/MishapLocationInWrongDimension.kt index 865036da..2afd9c1b 100644 --- a/Common/src/main/java/at/petrak/hexcasting/api/spell/mishaps/MishapLocationInWrongDimension.kt +++ b/Common/src/main/java/at/petrak/hexcasting/api/casting/mishaps/MishapLocationInWrongDimension.kt @@ -1,9 +1,9 @@ -package at.petrak.hexcasting.api.spell.mishaps +package at.petrak.hexcasting.api.casting.mishaps +import at.petrak.hexcasting.api.casting.eval.CastingContext +import at.petrak.hexcasting.api.casting.iota.GarbageIota +import at.petrak.hexcasting.api.casting.iota.Iota import at.petrak.hexcasting.api.misc.FrozenColorizer -import at.petrak.hexcasting.api.spell.casting.CastingContext -import at.petrak.hexcasting.api.spell.iota.GarbageIota -import at.petrak.hexcasting.api.spell.iota.Iota import net.minecraft.network.chat.Component import net.minecraft.resources.ResourceLocation import net.minecraft.world.item.DyeColor @@ -18,7 +18,7 @@ class MishapLocationInWrongDimension(val properDimension: ResourceLocation) : Mi override fun errorMessage(ctx: CastingContext, errorCtx: Context): Component = error( - "wrong_dimension", actionName(errorCtx.action!!), properDimension.toString(), + "wrong_dimension", properDimension.toString(), ctx.world.dimension().location().toString() ) } diff --git a/Common/src/main/java/at/petrak/hexcasting/api/spell/mishaps/MishapLocationTooFarAway.kt b/Common/src/main/java/at/petrak/hexcasting/api/casting/mishaps/MishapLocationTooFarAway.kt similarity index 67% rename from Common/src/main/java/at/petrak/hexcasting/api/spell/mishaps/MishapLocationTooFarAway.kt rename to Common/src/main/java/at/petrak/hexcasting/api/casting/mishaps/MishapLocationTooFarAway.kt index f22a4dcf..84dcd915 100644 --- a/Common/src/main/java/at/petrak/hexcasting/api/spell/mishaps/MishapLocationTooFarAway.kt +++ b/Common/src/main/java/at/petrak/hexcasting/api/casting/mishaps/MishapLocationTooFarAway.kt @@ -1,9 +1,9 @@ -package at.petrak.hexcasting.api.spell.mishaps +package at.petrak.hexcasting.api.casting.mishaps +import at.petrak.hexcasting.api.casting.eval.CastingContext +import at.petrak.hexcasting.api.casting.iota.Iota +import at.petrak.hexcasting.api.casting.iota.Vec3Iota import at.petrak.hexcasting.api.misc.FrozenColorizer -import at.petrak.hexcasting.api.spell.casting.CastingContext -import at.petrak.hexcasting.api.spell.iota.Iota -import at.petrak.hexcasting.api.spell.iota.Vec3Iota import net.minecraft.network.chat.Component import net.minecraft.world.item.DyeColor import net.minecraft.world.phys.Vec3 @@ -17,5 +17,5 @@ class MishapLocationTooFarAway(val location: Vec3, val type: String = "too_far") } override fun errorMessage(ctx: CastingContext, errorCtx: Context): Component = - error("location_$type", Vec3Iota.display(location), actionName(errorCtx.action)) + error("location_$type", Vec3Iota.display(location)) } diff --git a/Common/src/main/java/at/petrak/hexcasting/api/spell/mishaps/MishapNoAkashicRecord.kt b/Common/src/main/java/at/petrak/hexcasting/api/casting/mishaps/MishapNoAkashicRecord.kt similarity index 78% rename from Common/src/main/java/at/petrak/hexcasting/api/spell/mishaps/MishapNoAkashicRecord.kt rename to Common/src/main/java/at/petrak/hexcasting/api/casting/mishaps/MishapNoAkashicRecord.kt index 66a323f2..01aecb8d 100644 --- a/Common/src/main/java/at/petrak/hexcasting/api/spell/mishaps/MishapNoAkashicRecord.kt +++ b/Common/src/main/java/at/petrak/hexcasting/api/casting/mishaps/MishapNoAkashicRecord.kt @@ -1,8 +1,8 @@ -package at.petrak.hexcasting.api.spell.mishaps +package at.petrak.hexcasting.api.casting.mishaps import at.petrak.hexcasting.api.misc.FrozenColorizer -import at.petrak.hexcasting.api.spell.iota.Iota -import at.petrak.hexcasting.api.spell.casting.CastingContext +import at.petrak.hexcasting.api.casting.iota.Iota +import at.petrak.hexcasting.api.casting.eval.CastingContext import net.minecraft.core.BlockPos import net.minecraft.world.item.DyeColor diff --git a/Common/src/main/java/at/petrak/hexcasting/api/spell/mishaps/MishapNoSpellCircle.kt b/Common/src/main/java/at/petrak/hexcasting/api/casting/mishaps/MishapNoSpellCircle.kt similarity index 84% rename from Common/src/main/java/at/petrak/hexcasting/api/spell/mishaps/MishapNoSpellCircle.kt rename to Common/src/main/java/at/petrak/hexcasting/api/casting/mishaps/MishapNoSpellCircle.kt index 35726671..989a4dc3 100644 --- a/Common/src/main/java/at/petrak/hexcasting/api/spell/mishaps/MishapNoSpellCircle.kt +++ b/Common/src/main/java/at/petrak/hexcasting/api/casting/mishaps/MishapNoSpellCircle.kt @@ -1,8 +1,8 @@ -package at.petrak.hexcasting.api.spell.mishaps +package at.petrak.hexcasting.api.casting.mishaps +import at.petrak.hexcasting.api.casting.eval.CastingContext +import at.petrak.hexcasting.api.casting.iota.Iota import at.petrak.hexcasting.api.misc.FrozenColorizer -import at.petrak.hexcasting.api.spell.casting.CastingContext -import at.petrak.hexcasting.api.spell.iota.Iota import net.minecraft.world.entity.player.Player import net.minecraft.world.item.DyeColor import net.minecraft.world.item.ItemStack @@ -31,5 +31,5 @@ class MishapNoSpellCircle : Mishap() { } override fun errorMessage(ctx: CastingContext, errorCtx: Context) = - error("no_spell_circle", actionName(errorCtx.action)) + error("no_spell_circle") } diff --git a/Common/src/main/java/at/petrak/hexcasting/api/spell/mishaps/MishapNotEnoughArgs.kt b/Common/src/main/java/at/petrak/hexcasting/api/casting/mishaps/MishapNotEnoughArgs.kt similarity index 61% rename from Common/src/main/java/at/petrak/hexcasting/api/spell/mishaps/MishapNotEnoughArgs.kt rename to Common/src/main/java/at/petrak/hexcasting/api/casting/mishaps/MishapNotEnoughArgs.kt index e94b1542..b02ab738 100644 --- a/Common/src/main/java/at/petrak/hexcasting/api/spell/mishaps/MishapNotEnoughArgs.kt +++ b/Common/src/main/java/at/petrak/hexcasting/api/casting/mishaps/MishapNotEnoughArgs.kt @@ -1,9 +1,9 @@ -package at.petrak.hexcasting.api.spell.mishaps +package at.petrak.hexcasting.api.casting.mishaps +import at.petrak.hexcasting.api.casting.eval.CastingContext +import at.petrak.hexcasting.api.casting.iota.GarbageIota +import at.petrak.hexcasting.api.casting.iota.Iota import at.petrak.hexcasting.api.misc.FrozenColorizer -import at.petrak.hexcasting.api.spell.casting.CastingContext -import at.petrak.hexcasting.api.spell.iota.GarbageIota -import at.petrak.hexcasting.api.spell.iota.Iota import net.minecraft.world.item.DyeColor class MishapNotEnoughArgs(val expected: Int, val got: Int) : Mishap() { @@ -16,7 +16,7 @@ class MishapNotEnoughArgs(val expected: Int, val got: Int) : Mishap() { override fun errorMessage(ctx: CastingContext, errorCtx: Context) = if (got == 0) - error("no_args", actionName(errorCtx.action), expected) + error("no_args", expected) else - error("not_enough_args", actionName(errorCtx.action), expected, got) + error("not_enough_args", expected, got) } diff --git a/Common/src/main/java/at/petrak/hexcasting/api/spell/mishaps/MishapOthersName.kt b/Common/src/main/java/at/petrak/hexcasting/api/casting/mishaps/MishapOthersName.kt similarity index 87% rename from Common/src/main/java/at/petrak/hexcasting/api/spell/mishaps/MishapOthersName.kt rename to Common/src/main/java/at/petrak/hexcasting/api/casting/mishaps/MishapOthersName.kt index fa2e16b4..1b313a49 100644 --- a/Common/src/main/java/at/petrak/hexcasting/api/spell/mishaps/MishapOthersName.kt +++ b/Common/src/main/java/at/petrak/hexcasting/api/casting/mishaps/MishapOthersName.kt @@ -1,10 +1,10 @@ -package at.petrak.hexcasting.api.spell.mishaps +package at.petrak.hexcasting.api.casting.mishaps import at.petrak.hexcasting.api.misc.FrozenColorizer -import at.petrak.hexcasting.api.spell.casting.CastingContext -import at.petrak.hexcasting.api.spell.iota.EntityIota -import at.petrak.hexcasting.api.spell.iota.Iota -import at.petrak.hexcasting.api.spell.iota.ListIota +import at.petrak.hexcasting.api.casting.eval.CastingContext +import at.petrak.hexcasting.api.casting.iota.EntityIota +import at.petrak.hexcasting.api.casting.iota.Iota +import at.petrak.hexcasting.api.casting.iota.ListIota import net.minecraft.world.effect.MobEffectInstance import net.minecraft.world.effect.MobEffects import net.minecraft.world.entity.player.Player diff --git a/Common/src/main/java/at/petrak/hexcasting/api/spell/mishaps/MishapShameOnYou.kt b/Common/src/main/java/at/petrak/hexcasting/api/casting/mishaps/MishapShameOnYou.kt similarity index 78% rename from Common/src/main/java/at/petrak/hexcasting/api/spell/mishaps/MishapShameOnYou.kt rename to Common/src/main/java/at/petrak/hexcasting/api/casting/mishaps/MishapShameOnYou.kt index 8700cedf..d624c1c9 100644 --- a/Common/src/main/java/at/petrak/hexcasting/api/spell/mishaps/MishapShameOnYou.kt +++ b/Common/src/main/java/at/petrak/hexcasting/api/casting/mishaps/MishapShameOnYou.kt @@ -1,9 +1,9 @@ -package at.petrak.hexcasting.api.spell.mishaps +package at.petrak.hexcasting.api.casting.mishaps import at.petrak.hexcasting.api.misc.FrozenColorizer import at.petrak.hexcasting.api.misc.HexDamageSources -import at.petrak.hexcasting.api.spell.casting.CastingContext -import at.petrak.hexcasting.api.spell.iota.Iota +import at.petrak.hexcasting.api.casting.eval.CastingContext +import at.petrak.hexcasting.api.casting.iota.Iota import net.minecraft.world.item.DyeColor class MishapShameOnYou() : Mishap() { diff --git a/Common/src/main/java/at/petrak/hexcasting/api/spell/mishaps/MishapTooManyCloseParens.kt b/Common/src/main/java/at/petrak/hexcasting/api/casting/mishaps/MishapTooManyCloseParens.kt similarity index 72% rename from Common/src/main/java/at/petrak/hexcasting/api/spell/mishaps/MishapTooManyCloseParens.kt rename to Common/src/main/java/at/petrak/hexcasting/api/casting/mishaps/MishapTooManyCloseParens.kt index 5420d090..568a0d2f 100644 --- a/Common/src/main/java/at/petrak/hexcasting/api/spell/mishaps/MishapTooManyCloseParens.kt +++ b/Common/src/main/java/at/petrak/hexcasting/api/casting/mishaps/MishapTooManyCloseParens.kt @@ -1,9 +1,9 @@ -package at.petrak.hexcasting.api.spell.mishaps +package at.petrak.hexcasting.api.casting.mishaps import at.petrak.hexcasting.api.misc.FrozenColorizer -import at.petrak.hexcasting.api.spell.casting.CastingContext -import at.petrak.hexcasting.api.spell.iota.Iota -import at.petrak.hexcasting.api.spell.iota.PatternIota +import at.petrak.hexcasting.api.casting.eval.CastingContext +import at.petrak.hexcasting.api.casting.iota.Iota +import at.petrak.hexcasting.api.casting.iota.PatternIota import net.minecraft.world.item.DyeColor class MishapTooManyCloseParens : Mishap() { diff --git a/Common/src/main/java/at/petrak/hexcasting/api/spell/mishaps/MishapUnescapedValue.kt b/Common/src/main/java/at/petrak/hexcasting/api/casting/mishaps/MishapUnescapedValue.kt similarity index 87% rename from Common/src/main/java/at/petrak/hexcasting/api/spell/mishaps/MishapUnescapedValue.kt rename to Common/src/main/java/at/petrak/hexcasting/api/casting/mishaps/MishapUnescapedValue.kt index f952f6d0..318b784f 100644 --- a/Common/src/main/java/at/petrak/hexcasting/api/spell/mishaps/MishapUnescapedValue.kt +++ b/Common/src/main/java/at/petrak/hexcasting/api/casting/mishaps/MishapUnescapedValue.kt @@ -1,8 +1,8 @@ -package at.petrak.hexcasting.api.spell.mishaps +package at.petrak.hexcasting.api.casting.mishaps import at.petrak.hexcasting.api.misc.FrozenColorizer -import at.petrak.hexcasting.api.spell.iota.Iota -import at.petrak.hexcasting.api.spell.casting.CastingContext +import at.petrak.hexcasting.api.casting.iota.Iota +import at.petrak.hexcasting.api.casting.eval.CastingContext import net.minecraft.world.item.DyeColor /** diff --git a/Common/src/main/java/at/petrak/hexcasting/api/item/HexHolderItem.java b/Common/src/main/java/at/petrak/hexcasting/api/item/HexHolderItem.java index bf276235..72ea7685 100644 --- a/Common/src/main/java/at/petrak/hexcasting/api/item/HexHolderItem.java +++ b/Common/src/main/java/at/petrak/hexcasting/api/item/HexHolderItem.java @@ -1,6 +1,6 @@ package at.petrak.hexcasting.api.item; -import at.petrak.hexcasting.api.spell.iota.Iota; +import at.petrak.hexcasting.api.casting.iota.Iota; import net.minecraft.server.level.ServerLevel; import net.minecraft.world.item.ItemStack; import org.jetbrains.annotations.ApiStatus; diff --git a/Common/src/main/java/at/petrak/hexcasting/api/item/IotaHolderItem.java b/Common/src/main/java/at/petrak/hexcasting/api/item/IotaHolderItem.java index 3aeef986..dc9cdf8d 100644 --- a/Common/src/main/java/at/petrak/hexcasting/api/item/IotaHolderItem.java +++ b/Common/src/main/java/at/petrak/hexcasting/api/item/IotaHolderItem.java @@ -1,6 +1,6 @@ package at.petrak.hexcasting.api.item; -import at.petrak.hexcasting.api.spell.iota.Iota; +import at.petrak.hexcasting.api.casting.iota.Iota; import at.petrak.hexcasting.api.utils.HexUtils; import at.petrak.hexcasting.api.utils.NBTHelper; import at.petrak.hexcasting.client.ClientTickCounter; @@ -27,7 +27,7 @@ import java.util.List; public interface IotaHolderItem { /** * If this key is set on the item, we ignore the rest of the item and render this as if it were of the - * {@link at.petrak.hexcasting.api.spell.iota.IotaType IotaType} given by the resource location. + * {@link at.petrak.hexcasting.api.casting.iota.IotaType IotaType} given by the resource location. *

* This is not useful to the player at all. */ diff --git a/Common/src/main/java/at/petrak/hexcasting/api/misc/DiscoveryHandlers.java b/Common/src/main/java/at/petrak/hexcasting/api/misc/DiscoveryHandlers.java index f231fe6f..da42b7c1 100644 --- a/Common/src/main/java/at/petrak/hexcasting/api/misc/DiscoveryHandlers.java +++ b/Common/src/main/java/at/petrak/hexcasting/api/misc/DiscoveryHandlers.java @@ -1,8 +1,8 @@ package at.petrak.hexcasting.api.misc; import at.petrak.hexcasting.api.addldata.ADMediaHolder; -import at.petrak.hexcasting.api.spell.casting.CastingContext; -import at.petrak.hexcasting.api.spell.casting.CastingHarness; +import at.petrak.hexcasting.api.casting.eval.CastingContext; +import at.petrak.hexcasting.api.casting.eval.CastingHarness; import com.google.common.collect.Lists; import net.minecraft.world.entity.player.Player; import net.minecraft.world.item.ItemStack; 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 e23b6fba..2e6b1180 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 @@ -1,6 +1,6 @@ package at.petrak.hexcasting.api.mod; -import at.petrak.hexcasting.api.spell.ActionRegistryEntry; +import at.petrak.hexcasting.api.casting.ActionRegistryEntry; import at.petrak.hexcasting.xplat.IXplatAbstractions; import net.minecraft.core.Registry; import net.minecraft.resources.ResourceLocation; diff --git a/Common/src/main/java/at/petrak/hexcasting/api/spell/RenderedSpell.kt b/Common/src/main/java/at/petrak/hexcasting/api/spell/RenderedSpell.kt deleted file mode 100644 index 5929aa71..00000000 --- a/Common/src/main/java/at/petrak/hexcasting/api/spell/RenderedSpell.kt +++ /dev/null @@ -1,7 +0,0 @@ -package at.petrak.hexcasting.api.spell - -import at.petrak.hexcasting.api.spell.casting.CastingContext - -interface RenderedSpell { - fun cast(ctx: CastingContext) -} diff --git a/Common/src/main/java/at/petrak/hexcasting/api/utils/HexUtils.kt b/Common/src/main/java/at/petrak/hexcasting/api/utils/HexUtils.kt index 7f65b885..12235ee0 100644 --- a/Common/src/main/java/at/petrak/hexcasting/api/utils/HexUtils.kt +++ b/Common/src/main/java/at/petrak/hexcasting/api/utils/HexUtils.kt @@ -2,9 +2,9 @@ package at.petrak.hexcasting.api.utils -import at.petrak.hexcasting.api.spell.iota.Iota -import at.petrak.hexcasting.api.spell.iota.ListIota -import at.petrak.hexcasting.api.spell.math.HexCoord +import at.petrak.hexcasting.api.casting.iota.Iota +import at.petrak.hexcasting.api.casting.iota.ListIota +import at.petrak.hexcasting.api.casting.math.HexCoord import at.petrak.hexcasting.common.lib.hex.HexIotaTypes import net.minecraft.ChatFormatting import net.minecraft.nbt.* diff --git a/Common/src/main/java/at/petrak/hexcasting/api/utils/PatternNameHelper.java b/Common/src/main/java/at/petrak/hexcasting/api/utils/PatternNameHelper.java index 1f05fc06..880b4717 100644 --- a/Common/src/main/java/at/petrak/hexcasting/api/utils/PatternNameHelper.java +++ b/Common/src/main/java/at/petrak/hexcasting/api/utils/PatternNameHelper.java @@ -1,28 +1,29 @@ package at.petrak.hexcasting.api.utils; -import at.petrak.hexcasting.api.PatternRegistry; -import at.petrak.hexcasting.api.spell.casting.SpecialPatterns; -import at.petrak.hexcasting.api.spell.iota.PatternIota; -import at.petrak.hexcasting.api.spell.math.HexPattern; +import at.petrak.hexcasting.common.casting.PatternRegistryManifest; +import at.petrak.hexcasting.api.casting.eval.SpecialPatterns; +import at.petrak.hexcasting.api.casting.iota.PatternIota; +import at.petrak.hexcasting.api.casting.math.HexPattern; import net.minecraft.ChatFormatting; import net.minecraft.network.chat.Component; public class PatternNameHelper { - public static Component representationForPattern(HexPattern pattern) { - if (pattern.sigsEqual(SpecialPatterns.CONSIDERATION)) { - return Component.translatable("hexcasting.spell.hexcasting:escape").withStyle(ChatFormatting.LIGHT_PURPLE); - } else if (pattern.sigsEqual(SpecialPatterns.INTROSPECTION)) { - return Component.translatable("hexcasting.spell.hexcasting:open_paren").withStyle(ChatFormatting.LIGHT_PURPLE); - } else if (pattern.sigsEqual(SpecialPatterns.RETROSPECTION)) { - return Component.translatable("hexcasting.spell.hexcasting:close_paren").withStyle(ChatFormatting.LIGHT_PURPLE); - } + public static Component representationForPattern(HexPattern pattern) { + if (pattern.sigsEqual(SpecialPatterns.CONSIDERATION)) { + return Component.translatable("hexcasting.spell.hexcasting:escape").withStyle(ChatFormatting.LIGHT_PURPLE); + } else if (pattern.sigsEqual(SpecialPatterns.INTROSPECTION)) { + return Component.translatable("hexcasting.spell.hexcasting:open_paren").withStyle(ChatFormatting.LIGHT_PURPLE); + } else if (pattern.sigsEqual(SpecialPatterns.RETROSPECTION)) { + return Component.translatable("hexcasting.spell.hexcasting:close_paren").withStyle(ChatFormatting.LIGHT_PURPLE); + } - var action = PatternRegistry.lookupPatternByShape(pattern); - if (action != null) { - return action.getDisplayName(); - } + var action = PatternRegistryManifest.lookupPatternByShape(pattern); + if (action != null) { + return action.getDisplayName(); + } - return new PatternIota(pattern).display(); // TODO: this should be merged into iota.display once Great Spells can be identified by name - } + return new PatternIota(pattern).display(); // TODO: this should be merged into iota.display once Great Spells + // can be identified by name + } } diff --git a/Common/src/main/java/at/petrak/hexcasting/client/PatternShapeMatcher.java b/Common/src/main/java/at/petrak/hexcasting/client/PatternShapeMatcher.java new file mode 100644 index 00000000..dbe366ce --- /dev/null +++ b/Common/src/main/java/at/petrak/hexcasting/client/PatternShapeMatcher.java @@ -0,0 +1,4 @@ +package at.petrak.hexcasting.client; + +public class PatternShapeMatcher { +} diff --git a/Common/src/main/java/at/petrak/hexcasting/client/RenderLib.kt b/Common/src/main/java/at/petrak/hexcasting/client/RenderLib.kt index 00b7e546..8168b6f2 100644 --- a/Common/src/main/java/at/petrak/hexcasting/client/RenderLib.kt +++ b/Common/src/main/java/at/petrak/hexcasting/client/RenderLib.kt @@ -3,7 +3,7 @@ package at.petrak.hexcasting.client import at.petrak.hexcasting.api.mod.HexConfig -import at.petrak.hexcasting.api.spell.math.HexPattern +import at.petrak.hexcasting.api.casting.math.HexPattern import at.petrak.hexcasting.api.utils.TAU import at.petrak.hexcasting.api.utils.getValue import at.petrak.hexcasting.api.utils.setValue diff --git a/Common/src/main/java/at/petrak/hexcasting/client/be/BlockEntityAkashicBookshelfRenderer.java b/Common/src/main/java/at/petrak/hexcasting/client/be/BlockEntityAkashicBookshelfRenderer.java index 1f5c2fc9..8c3ab958 100644 --- a/Common/src/main/java/at/petrak/hexcasting/client/be/BlockEntityAkashicBookshelfRenderer.java +++ b/Common/src/main/java/at/petrak/hexcasting/client/be/BlockEntityAkashicBookshelfRenderer.java @@ -1,6 +1,6 @@ package at.petrak.hexcasting.client.be; -import at.petrak.hexcasting.api.spell.math.HexPattern; +import at.petrak.hexcasting.api.casting.math.HexPattern; import at.petrak.hexcasting.client.RenderLib; import at.petrak.hexcasting.common.blocks.akashic.BlockAkashicBookshelf; import at.petrak.hexcasting.common.blocks.akashic.BlockEntityAkashicBookshelf; diff --git a/Common/src/main/java/at/petrak/hexcasting/client/gui/GuiSpellcasting.kt b/Common/src/main/java/at/petrak/hexcasting/client/gui/GuiSpellcasting.kt index fc50f9e8..c4a934bd 100644 --- a/Common/src/main/java/at/petrak/hexcasting/client/gui/GuiSpellcasting.kt +++ b/Common/src/main/java/at/petrak/hexcasting/client/gui/GuiSpellcasting.kt @@ -3,13 +3,13 @@ package at.petrak.hexcasting.client.gui import at.petrak.hexcasting.api.misc.DiscoveryHandlers import at.petrak.hexcasting.api.mod.HexConfig import at.petrak.hexcasting.api.mod.HexTags -import at.petrak.hexcasting.api.spell.casting.ControllerInfo -import at.petrak.hexcasting.api.spell.casting.ResolvedPattern -import at.petrak.hexcasting.api.spell.casting.ResolvedPatternType -import at.petrak.hexcasting.api.spell.math.HexAngle -import at.petrak.hexcasting.api.spell.math.HexCoord -import at.petrak.hexcasting.api.spell.math.HexDir -import at.petrak.hexcasting.api.spell.math.HexPattern +import at.petrak.hexcasting.api.casting.eval.ControllerInfo +import at.petrak.hexcasting.api.casting.eval.ResolvedPattern +import at.petrak.hexcasting.api.casting.eval.ResolvedPatternType +import at.petrak.hexcasting.api.casting.math.HexAngle +import at.petrak.hexcasting.api.casting.math.HexCoord +import at.petrak.hexcasting.api.casting.math.HexDir +import at.petrak.hexcasting.api.casting.math.HexPattern import at.petrak.hexcasting.api.utils.asTranslatedComponent import at.petrak.hexcasting.client.* import at.petrak.hexcasting.client.ktxt.accumulatedScroll diff --git a/Common/src/main/java/at/petrak/hexcasting/client/gui/PatternTooltipComponent.java b/Common/src/main/java/at/petrak/hexcasting/client/gui/PatternTooltipComponent.java index 0d6aca6f..0d7a6e12 100644 --- a/Common/src/main/java/at/petrak/hexcasting/client/gui/PatternTooltipComponent.java +++ b/Common/src/main/java/at/petrak/hexcasting/client/gui/PatternTooltipComponent.java @@ -1,6 +1,6 @@ package at.petrak.hexcasting.client.gui; -import at.petrak.hexcasting.api.spell.math.HexPattern; +import at.petrak.hexcasting.api.casting.math.HexPattern; import at.petrak.hexcasting.client.RenderLib; import at.petrak.hexcasting.common.misc.PatternTooltip; import com.mojang.blaze3d.platform.GlStateManager; diff --git a/Common/src/main/java/at/petrak/hexcasting/common/blocks/akashic/BlockAkashicBookshelf.java b/Common/src/main/java/at/petrak/hexcasting/common/blocks/akashic/BlockAkashicBookshelf.java index 66476329..233773f8 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/blocks/akashic/BlockAkashicBookshelf.java +++ b/Common/src/main/java/at/petrak/hexcasting/common/blocks/akashic/BlockAkashicBookshelf.java @@ -1,7 +1,7 @@ package at.petrak.hexcasting.common.blocks.akashic; import at.petrak.hexcasting.annotations.SoftImplement; -import at.petrak.hexcasting.api.spell.iota.PatternIota; +import at.petrak.hexcasting.api.casting.iota.PatternIota; import at.petrak.hexcasting.common.items.ItemScroll; import at.petrak.hexcasting.common.lib.HexSounds; import at.petrak.hexcasting.xplat.IForgeLikeBlock; diff --git a/Common/src/main/java/at/petrak/hexcasting/common/blocks/akashic/BlockAkashicRecord.java b/Common/src/main/java/at/petrak/hexcasting/common/blocks/akashic/BlockAkashicRecord.java index 2ff38553..119ad21c 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/blocks/akashic/BlockAkashicRecord.java +++ b/Common/src/main/java/at/petrak/hexcasting/common/blocks/akashic/BlockAkashicRecord.java @@ -1,7 +1,7 @@ package at.petrak.hexcasting.common.blocks.akashic; -import at.petrak.hexcasting.api.spell.iota.Iota; -import at.petrak.hexcasting.api.spell.math.HexPattern; +import at.petrak.hexcasting.api.casting.iota.Iota; +import at.petrak.hexcasting.api.casting.math.HexPattern; import at.petrak.hexcasting.common.lib.hex.HexIotaTypes; import net.minecraft.core.BlockPos; import net.minecraft.server.level.ServerLevel; diff --git a/Common/src/main/java/at/petrak/hexcasting/common/blocks/akashic/BlockEntityAkashicBookshelf.java b/Common/src/main/java/at/petrak/hexcasting/common/blocks/akashic/BlockEntityAkashicBookshelf.java index 8d5b653c..d851731b 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/blocks/akashic/BlockEntityAkashicBookshelf.java +++ b/Common/src/main/java/at/petrak/hexcasting/common/blocks/akashic/BlockEntityAkashicBookshelf.java @@ -1,8 +1,8 @@ package at.petrak.hexcasting.common.blocks.akashic; import at.petrak.hexcasting.api.block.HexBlockEntity; -import at.petrak.hexcasting.api.spell.iota.Iota; -import at.petrak.hexcasting.api.spell.math.HexPattern; +import at.petrak.hexcasting.api.casting.iota.Iota; +import at.petrak.hexcasting.api.casting.math.HexPattern; import at.petrak.hexcasting.common.lib.HexBlockEntities; import at.petrak.hexcasting.common.lib.hex.HexIotaTypes; import net.minecraft.core.BlockPos; diff --git a/Common/src/main/java/at/petrak/hexcasting/common/blocks/circles/BlockEmptyImpetus.java b/Common/src/main/java/at/petrak/hexcasting/common/blocks/circles/BlockEmptyImpetus.java index 4e277b04..a4746b23 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/blocks/circles/BlockEmptyImpetus.java +++ b/Common/src/main/java/at/petrak/hexcasting/common/blocks/circles/BlockEmptyImpetus.java @@ -1,7 +1,7 @@ package at.petrak.hexcasting.common.blocks.circles; import at.petrak.hexcasting.api.block.circle.BlockCircleComponent; -import at.petrak.hexcasting.api.spell.math.HexPattern; +import at.petrak.hexcasting.api.casting.math.HexPattern; import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; import net.minecraft.world.item.context.BlockPlaceContext; diff --git a/Common/src/main/java/at/petrak/hexcasting/common/blocks/circles/BlockEntitySlate.java b/Common/src/main/java/at/petrak/hexcasting/common/blocks/circles/BlockEntitySlate.java index e3822d0e..9a0ec965 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/blocks/circles/BlockEntitySlate.java +++ b/Common/src/main/java/at/petrak/hexcasting/common/blocks/circles/BlockEntitySlate.java @@ -1,7 +1,7 @@ package at.petrak.hexcasting.common.blocks.circles; import at.petrak.hexcasting.api.block.HexBlockEntity; -import at.petrak.hexcasting.api.spell.math.HexPattern; +import at.petrak.hexcasting.api.casting.math.HexPattern; import at.petrak.hexcasting.common.lib.HexBlockEntities; import net.minecraft.core.BlockPos; import net.minecraft.nbt.CompoundTag; diff --git a/Common/src/main/java/at/petrak/hexcasting/common/blocks/circles/BlockSlate.java b/Common/src/main/java/at/petrak/hexcasting/common/blocks/circles/BlockSlate.java index 63935caa..5ce988b5 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/blocks/circles/BlockSlate.java +++ b/Common/src/main/java/at/petrak/hexcasting/common/blocks/circles/BlockSlate.java @@ -2,8 +2,8 @@ package at.petrak.hexcasting.common.blocks.circles; import at.petrak.hexcasting.annotations.SoftImplement; import at.petrak.hexcasting.api.block.circle.BlockCircleComponent; -import at.petrak.hexcasting.api.spell.iota.PatternIota; -import at.petrak.hexcasting.api.spell.math.HexPattern; +import at.petrak.hexcasting.api.casting.iota.PatternIota; +import at.petrak.hexcasting.api.casting.math.HexPattern; import at.petrak.hexcasting.common.lib.HexItems; import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; diff --git a/Common/src/main/java/at/petrak/hexcasting/common/blocks/circles/directrix/BlockEmptyDirectrix.java b/Common/src/main/java/at/petrak/hexcasting/common/blocks/circles/directrix/BlockEmptyDirectrix.java index 710e143a..8eef5a46 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/blocks/circles/directrix/BlockEmptyDirectrix.java +++ b/Common/src/main/java/at/petrak/hexcasting/common/blocks/circles/directrix/BlockEmptyDirectrix.java @@ -1,7 +1,7 @@ package at.petrak.hexcasting.common.blocks.circles.directrix; import at.petrak.hexcasting.api.block.circle.BlockCircleComponent; -import at.petrak.hexcasting.api.spell.math.HexPattern; +import at.petrak.hexcasting.api.casting.math.HexPattern; import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; import net.minecraft.world.item.context.BlockPlaceContext; diff --git a/Common/src/main/java/at/petrak/hexcasting/common/blocks/circles/directrix/BlockRedstoneDirectrix.java b/Common/src/main/java/at/petrak/hexcasting/common/blocks/circles/directrix/BlockRedstoneDirectrix.java index 9ecaecef..867e685f 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/blocks/circles/directrix/BlockRedstoneDirectrix.java +++ b/Common/src/main/java/at/petrak/hexcasting/common/blocks/circles/directrix/BlockRedstoneDirectrix.java @@ -1,7 +1,7 @@ package at.petrak.hexcasting.common.blocks.circles.directrix; import at.petrak.hexcasting.api.block.circle.BlockCircleComponent; -import at.petrak.hexcasting.api.spell.math.HexPattern; +import at.petrak.hexcasting.api.casting.math.HexPattern; import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; import net.minecraft.core.particles.DustParticleOptions; diff --git a/Common/src/main/java/at/petrak/hexcasting/common/blocks/circles/impetuses/BlockStoredPlayerImpetus.java b/Common/src/main/java/at/petrak/hexcasting/common/blocks/circles/impetuses/BlockStoredPlayerImpetus.java index f5b79f6f..b626df76 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/blocks/circles/impetuses/BlockStoredPlayerImpetus.java +++ b/Common/src/main/java/at/petrak/hexcasting/common/blocks/circles/impetuses/BlockStoredPlayerImpetus.java @@ -1,7 +1,7 @@ package at.petrak.hexcasting.common.blocks.circles.impetuses; import at.petrak.hexcasting.api.block.circle.BlockAbstractImpetus; -import at.petrak.hexcasting.api.spell.iota.EntityIota; +import at.petrak.hexcasting.api.casting.iota.EntityIota; import at.petrak.hexcasting.common.blocks.entity.BlockEntityStoredPlayerImpetus; import at.petrak.hexcasting.common.lib.HexSounds; import at.petrak.hexcasting.xplat.IXplatAbstractions; diff --git a/Common/src/main/java/at/petrak/hexcasting/common/casting/PatternRegistryManifest.java b/Common/src/main/java/at/petrak/hexcasting/common/casting/PatternRegistryManifest.java new file mode 100644 index 00000000..e815a0f6 --- /dev/null +++ b/Common/src/main/java/at/petrak/hexcasting/common/casting/PatternRegistryManifest.java @@ -0,0 +1,200 @@ +package at.petrak.hexcasting.common.casting; + +import at.petrak.hexcasting.api.HexAPI; +import at.petrak.hexcasting.api.casting.ActionRegistryEntry; +import at.petrak.hexcasting.api.casting.PatternShapeMatch; +import at.petrak.hexcasting.api.casting.SpecialHandler; +import at.petrak.hexcasting.api.casting.math.EulerPathFinder; +import at.petrak.hexcasting.api.casting.math.HexPattern; +import at.petrak.hexcasting.api.mod.HexTags; +import at.petrak.hexcasting.xplat.IXplatAbstractions; +import com.mojang.datafixers.util.Pair; +import net.minecraft.nbt.CompoundTag; +import net.minecraft.resources.ResourceKey; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.server.level.ServerLevel; +import net.minecraft.world.level.saveddata.SavedData; +import org.apache.commons.lang3.NotImplementedException; +import org.jetbrains.annotations.Nullable; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.Map; +import java.util.concurrent.ConcurrentHashMap; +import java.util.concurrent.ConcurrentMap; + +// Now an internal-only class used to do final processing on the registered stuff +public class PatternRegistryManifest { + // Map actions to their entry except for the per-world ones. Client and server side + public static final ConcurrentMap> NORMAL_ACTION_LOOKUP = + new ConcurrentHashMap<>(); + + // On the server side, where we know such things, the jumbled patterns + // + // SERVER SIDE ONLY + public static final ConcurrentMap> PER_WORLD_ACTION_LOOKUP = + new ConcurrentHashMap<>(); + + /** + * Process the registry! + *

+ * Pass null for the OW to signal we're on the client + */ + public static void processRegistry(@Nullable ServerLevel overworld) { + ScrungledPatternsSave perWorldPatterns = null; + if (overworld != null) { + var ds = overworld.getDataStorage(); + perWorldPatterns = ds.computeIfAbsent(ScrungledPatternsSave::load, + ScrungledPatternsSave::create, + TAG_SAVED_DATA); + } + + var postCalculationNeeders = new ArrayList>(); + + var registry = IXplatAbstractions.INSTANCE.getActionRegistry(); + for (var key : registry.registryKeySet()) { + var entry = registry.get(key); + if (registry.getHolderOrThrow(key).is(HexTags.Actions.PER_WORLD_PATTERN)) { + // Then we need to create this only on the server, gulp + if (perWorldPatterns != null) { + var precalced = perWorldPatterns.lookup.get(entry.prototype().anglesSignature()); + if (precalced == null) { + postCalculationNeeders.add(key); + perWorldPatterns.setDirty(); + } + } else { + // We're on the client, TODO implement the client guessing code + } + + } else { + NORMAL_ACTION_LOOKUP.put(entry.prototype().anglesSignature(), key); + } + } + + if (perWorldPatterns != null) { + for (var postNeederKey : postCalculationNeeders) { + var entry = registry.get(postNeederKey); + var scrungledSig = scrunglePattern(entry.prototype(), overworld.getSeed()); + PER_WORLD_ACTION_LOOKUP.put(scrungledSig, postNeederKey); + } + } + + HexAPI.LOGGER.info(("We're on the %s! Loaded %d regular actions, %d per-world actions, and %d special " + + "handlers").formatted( + (overworld == null) ? "client" : "server", NORMAL_ACTION_LOOKUP.size(), PER_WORLD_ACTION_LOOKUP.size(), + IXplatAbstractions.INSTANCE.getSpecialHandlerRegistry().size() + )); + } + + /** + * Try to match this pattern to a special handler. If one is found, return both the handler and its key. + */ + @Nullable + public static Pair>> matchPatternToSpecialHandler(HexPattern pat) { + var registry = IXplatAbstractions.INSTANCE.getSpecialHandlerRegistry(); + for (var key : registry.registryKeySet()) { + var factory = registry.get(key); + var handler = factory.tryMatch(pat); + if (handler != null) { + return Pair.of(handler, key); + } + } + return null; + } + + /** + * Try to match this pattern to an action, whether via a normal pattern, a per-world pattern, or the machinations + * of a special handler. + * + * @param checkForAlternateStrokeOrders if this is true, will check if the pattern given is an erroneous stroke + * order + * for a per-world pattern. + */ + public static PatternShapeMatch matchPattern(HexPattern pat, ServerLevel overworld, + boolean checkForAlternateStrokeOrders) { + // I am PURPOSELY checking normal actions before special handlers + // This way we don't get a repeat of the phial number literal incident + var sig = pat.anglesSignature(); + if (NORMAL_ACTION_LOOKUP.containsKey(sig)) { + var key = NORMAL_ACTION_LOOKUP.get(sig); + return new PatternShapeMatch.Normal(key); + } + + // Look it up in the world? + var ds = overworld.getDataStorage(); + ScrungledPatternsSave perWorldPatterns = + ds.computeIfAbsent(ScrungledPatternsSave::load, ScrungledPatternsSave::create, + TAG_SAVED_DATA); + if (perWorldPatterns.lookup.containsKey(sig)) { + var key = perWorldPatterns.lookup.get(sig); + return new PatternShapeMatch.PerWorld(key, true); + } + + if (checkForAlternateStrokeOrders) { + throw new NotImplementedException("checking for alternate stroke orders is NYI sorry"); + } + + var shMatch = matchPatternToSpecialHandler(pat); + if (shMatch != null) { + return new PatternShapeMatch.Special(shMatch.getSecond(), shMatch.getFirst()); + } + + return new PatternShapeMatch.Nothing(); + } + + /** + * Maps angle sigs to resource locations and their preferred start dir so we can look them up in the main registry + * Save this on the world in case the random algorithm changes. + */ + public static class ScrungledPatternsSave extends SavedData { + + // Maps scrungled signatures to their keys. + private final Map> lookup; + + public ScrungledPatternsSave(Map> lookup) { + this.lookup = lookup; + } + + + @Override + public CompoundTag save(CompoundTag tag) { + this.lookup.forEach((sig, key) -> tag.putString(sig, key.location().toString())); + return tag; + } + + private static ScrungledPatternsSave load(CompoundTag tag) { + var registryKey = IXplatAbstractions.INSTANCE.getActionRegistry().key(); + + var map = new HashMap>(); + for (var sig : tag.getAllKeys()) { + var keyStr = tag.getString(sig); + var key = ResourceKey.create(registryKey, new ResourceLocation(keyStr)); + + map.put(sig, key); + } + + return new ScrungledPatternsSave(map); + } + + + public static ScrungledPatternsSave create() { + var save = new ScrungledPatternsSave(new HashMap<>()); + return save; + } + + } + + public static final String DATA_VERSION = "0.1.0"; + public static final String TAG_SAVED_DATA = "hexcasting.per-world-patterns." + DATA_VERSION; + + /** + * Find a valid alternate drawing for this pattern that won't collide with anything pre-existing + */ + private static String scrunglePattern(HexPattern prototype, long seed) { + var scrungled = EulerPathFinder.findAltDrawing(prototype, seed, it -> { + var sig = it.anglesSignature(); + return !NORMAL_ACTION_LOOKUP.containsKey(sig); + }); + return scrungled.anglesSignature(); + } +} diff --git a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/OpBlockAxisRaycast.kt b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/OpBlockAxisRaycast.kt index edd1c530..17c6165c 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/OpBlockAxisRaycast.kt +++ b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/OpBlockAxisRaycast.kt @@ -1,13 +1,13 @@ package at.petrak.hexcasting.common.casting.operators import at.petrak.hexcasting.api.misc.MediaConstants -import at.petrak.hexcasting.api.spell.Action -import at.petrak.hexcasting.api.spell.ConstMediaAction -import at.petrak.hexcasting.api.spell.asActionResult -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.api.spell.iota.NullIota +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.getVec3 +import at.petrak.hexcasting.api.casting.iota.Iota +import at.petrak.hexcasting.api.casting.iota.NullIota import net.minecraft.world.level.ClipContext import net.minecraft.world.phys.HitResult import net.minecraft.world.phys.Vec3 diff --git a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/OpBlockRaycast.kt b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/OpBlockRaycast.kt index a7c9e49c..cbf2d398 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/OpBlockRaycast.kt +++ b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/OpBlockRaycast.kt @@ -1,13 +1,13 @@ package at.petrak.hexcasting.common.casting.operators import at.petrak.hexcasting.api.misc.MediaConstants -import at.petrak.hexcasting.api.spell.Action -import at.petrak.hexcasting.api.spell.ConstMediaAction -import at.petrak.hexcasting.api.spell.asActionResult -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.api.spell.iota.NullIota +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.getVec3 +import at.petrak.hexcasting.api.casting.iota.Iota +import at.petrak.hexcasting.api.casting.iota.NullIota import net.minecraft.world.level.ClipContext import net.minecraft.world.phys.HitResult import net.minecraft.world.phys.Vec3 diff --git a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/OpEntityHeight.kt b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/OpEntityHeight.kt index d291f3b8..16de676a 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/OpEntityHeight.kt +++ b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/OpEntityHeight.kt @@ -1,10 +1,10 @@ package at.petrak.hexcasting.common.casting.operators -import at.petrak.hexcasting.api.spell.ConstMediaAction -import at.petrak.hexcasting.api.spell.asActionResult -import at.petrak.hexcasting.api.spell.casting.CastingContext -import at.petrak.hexcasting.api.spell.getEntity -import at.petrak.hexcasting.api.spell.iota.Iota +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.getEntity +import at.petrak.hexcasting.api.casting.iota.Iota object OpEntityHeight : ConstMediaAction { override val argc = 1 diff --git a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/OpEntityLook.kt b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/OpEntityLook.kt index ac0f7cfd..08550871 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/OpEntityLook.kt +++ b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/OpEntityLook.kt @@ -1,10 +1,10 @@ package at.petrak.hexcasting.common.casting.operators -import at.petrak.hexcasting.api.spell.ConstMediaAction -import at.petrak.hexcasting.api.spell.asActionResult -import at.petrak.hexcasting.api.spell.casting.CastingContext -import at.petrak.hexcasting.api.spell.getEntity -import at.petrak.hexcasting.api.spell.iota.Iota +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.getEntity +import at.petrak.hexcasting.api.casting.iota.Iota object OpEntityLook : ConstMediaAction { override val argc = 1 diff --git a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/OpEntityPos.kt b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/OpEntityPos.kt index e1ac345d..91919c94 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/OpEntityPos.kt +++ b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/OpEntityPos.kt @@ -1,10 +1,10 @@ package at.petrak.hexcasting.common.casting.operators -import at.petrak.hexcasting.api.spell.ConstMediaAction -import at.petrak.hexcasting.api.spell.asActionResult -import at.petrak.hexcasting.api.spell.casting.CastingContext -import at.petrak.hexcasting.api.spell.getEntity -import at.petrak.hexcasting.api.spell.iota.Iota +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.getEntity +import at.petrak.hexcasting.api.casting.iota.Iota class OpEntityPos(val feet: Boolean) : ConstMediaAction { override val argc = 1 diff --git a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/OpEntityRaycast.kt b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/OpEntityRaycast.kt index 08169d01..43572a16 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/OpEntityRaycast.kt +++ b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/OpEntityRaycast.kt @@ -1,13 +1,13 @@ package at.petrak.hexcasting.common.casting.operators import at.petrak.hexcasting.api.misc.MediaConstants -import at.petrak.hexcasting.api.spell.Action -import at.petrak.hexcasting.api.spell.ConstMediaAction -import at.petrak.hexcasting.api.spell.asActionResult -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.api.spell.iota.NullIota +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.getVec3 +import at.petrak.hexcasting.api.casting.iota.Iota +import at.petrak.hexcasting.api.casting.iota.NullIota import net.minecraft.world.entity.projectile.ProjectileUtil import net.minecraft.world.phys.AABB diff --git a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/OpEntityVelocity.kt b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/OpEntityVelocity.kt index 83bacc74..c93c3157 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/OpEntityVelocity.kt +++ b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/OpEntityVelocity.kt @@ -1,10 +1,10 @@ package at.petrak.hexcasting.common.casting.operators -import at.petrak.hexcasting.api.spell.ConstMediaAction -import at.petrak.hexcasting.api.spell.asActionResult -import at.petrak.hexcasting.api.spell.casting.CastingContext -import at.petrak.hexcasting.api.spell.getEntity -import at.petrak.hexcasting.api.spell.iota.Iota +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.getEntity +import at.petrak.hexcasting.api.casting.iota.Iota import at.petrak.hexcasting.common.misc.PlayerPositionRecorder import net.minecraft.server.level.ServerPlayer diff --git a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/akashic/OpAkashicRead.kt b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/akashic/OpAkashicRead.kt index 2b19d0a1..7978d755 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/akashic/OpAkashicRead.kt +++ b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/akashic/OpAkashicRead.kt @@ -1,13 +1,13 @@ package at.petrak.hexcasting.common.casting.operators.akashic import at.petrak.hexcasting.api.misc.MediaConstants -import at.petrak.hexcasting.api.spell.ConstMediaAction -import at.petrak.hexcasting.api.spell.casting.CastingContext -import at.petrak.hexcasting.api.spell.getBlockPos -import at.petrak.hexcasting.api.spell.getPattern -import at.petrak.hexcasting.api.spell.iota.Iota -import at.petrak.hexcasting.api.spell.iota.NullIota -import at.petrak.hexcasting.api.spell.mishaps.MishapNoAkashicRecord +import at.petrak.hexcasting.api.casting.ConstMediaAction +import at.petrak.hexcasting.api.casting.eval.CastingContext +import at.petrak.hexcasting.api.casting.getBlockPos +import at.petrak.hexcasting.api.casting.getPattern +import at.petrak.hexcasting.api.casting.iota.Iota +import at.petrak.hexcasting.api.casting.iota.NullIota +import at.petrak.hexcasting.api.casting.mishaps.MishapNoAkashicRecord import at.petrak.hexcasting.common.blocks.akashic.BlockAkashicRecord object OpAkashicRead : ConstMediaAction { 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 ba42869b..c1d678b6 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.spell.* -import at.petrak.hexcasting.api.spell.casting.CastingContext -import at.petrak.hexcasting.api.spell.iota.Iota -import at.petrak.hexcasting.api.spell.math.HexPattern -import at.petrak.hexcasting.api.spell.mishaps.MishapNoAkashicRecord -import at.petrak.hexcasting.api.spell.mishaps.MishapOthersName +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.common.blocks.akashic.BlockAkashicRecord import at.petrak.hexcasting.common.lib.HexSounds import net.minecraft.core.BlockPos diff --git a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/circles/OpCircleBounds.kt b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/circles/OpCircleBounds.kt index e888cdab..ee270650 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/circles/OpCircleBounds.kt +++ b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/circles/OpCircleBounds.kt @@ -1,10 +1,10 @@ package at.petrak.hexcasting.common.casting.operators.circles -import at.petrak.hexcasting.api.spell.ConstMediaAction -import at.petrak.hexcasting.api.spell.asActionResult -import at.petrak.hexcasting.api.spell.casting.CastingContext -import at.petrak.hexcasting.api.spell.iota.Iota -import at.petrak.hexcasting.api.spell.mishaps.MishapNoSpellCircle +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.casting.mishaps.MishapNoSpellCircle import net.minecraft.world.phys.Vec3 class OpCircleBounds(val max: Boolean) : ConstMediaAction { diff --git a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/circles/OpImpetusDir.kt b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/circles/OpImpetusDir.kt index 73e0aacd..e5dad30f 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/circles/OpImpetusDir.kt +++ b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/circles/OpImpetusDir.kt @@ -1,11 +1,11 @@ package at.petrak.hexcasting.common.casting.operators.circles import at.petrak.hexcasting.api.block.circle.BlockAbstractImpetus -import at.petrak.hexcasting.api.spell.ConstMediaAction -import at.petrak.hexcasting.api.spell.asActionResult -import at.petrak.hexcasting.api.spell.casting.CastingContext -import at.petrak.hexcasting.api.spell.iota.Iota -import at.petrak.hexcasting.api.spell.mishaps.MishapNoSpellCircle +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.casting.mishaps.MishapNoSpellCircle object OpImpetusDir : ConstMediaAction { override val argc = 0 diff --git a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/circles/OpImpetusPos.kt b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/circles/OpImpetusPos.kt index fd8b1cc3..ee2107f1 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/circles/OpImpetusPos.kt +++ b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/circles/OpImpetusPos.kt @@ -1,10 +1,10 @@ package at.petrak.hexcasting.common.casting.operators.circles -import at.petrak.hexcasting.api.spell.ConstMediaAction -import at.petrak.hexcasting.api.spell.asActionResult -import at.petrak.hexcasting.api.spell.casting.CastingContext -import at.petrak.hexcasting.api.spell.iota.Iota -import at.petrak.hexcasting.api.spell.mishaps.MishapNoSpellCircle +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.casting.mishaps.MishapNoSpellCircle object OpImpetusPos : ConstMediaAction { override val argc = 0 diff --git a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/eval/OpEval.kt b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/eval/OpEval.kt index a42c589c..542b01b2 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/eval/OpEval.kt +++ b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/eval/OpEval.kt @@ -1,16 +1,16 @@ package at.petrak.hexcasting.common.casting.operators.eval -import at.petrak.hexcasting.api.spell.Action -import at.petrak.hexcasting.api.spell.OperationResult -import at.petrak.hexcasting.api.spell.SpellList -import at.petrak.hexcasting.api.spell.casting.CastingContext -import at.petrak.hexcasting.api.spell.casting.eval.FrameEvaluate -import at.petrak.hexcasting.api.spell.casting.eval.FrameFinishEval -import at.petrak.hexcasting.api.spell.casting.eval.SpellContinuation -import at.petrak.hexcasting.api.spell.evaluatable -import at.petrak.hexcasting.api.spell.iota.Iota -import at.petrak.hexcasting.api.spell.iota.PatternIota -import at.petrak.hexcasting.api.spell.mishaps.MishapNotEnoughArgs +import at.petrak.hexcasting.api.casting.Action +import at.petrak.hexcasting.api.casting.OperationResult +import at.petrak.hexcasting.api.casting.SpellList +import at.petrak.hexcasting.api.casting.eval.CastingContext +import at.petrak.hexcasting.api.casting.eval.vm.FrameEvaluate +import at.petrak.hexcasting.api.casting.eval.vm.FrameFinishEval +import at.petrak.hexcasting.api.casting.eval.vm.SpellContinuation +import at.petrak.hexcasting.api.casting.evaluatable +import at.petrak.hexcasting.api.casting.iota.Iota +import at.petrak.hexcasting.api.casting.iota.PatternIota +import at.petrak.hexcasting.api.casting.mishaps.MishapNotEnoughArgs object OpEval : Action { override fun operate( diff --git a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/eval/OpEvalDelay.kt b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/eval/OpEvalDelay.kt index ab8f32e6..895531fc 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/eval/OpEvalDelay.kt +++ b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/eval/OpEvalDelay.kt @@ -1,10 +1,10 @@ package at.petrak.hexcasting.common.casting.operators.eval -import at.petrak.hexcasting.api.spell.Action -import at.petrak.hexcasting.api.spell.OperationResult -import at.petrak.hexcasting.api.spell.casting.CastingContext -import at.petrak.hexcasting.api.spell.casting.eval.SpellContinuation -import at.petrak.hexcasting.api.spell.iota.Iota +import at.petrak.hexcasting.api.casting.Action +import at.petrak.hexcasting.api.casting.OperationResult +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 object OpEvalDelay : Action { override fun operate( diff --git a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/eval/OpForEach.kt b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/eval/OpForEach.kt index 03ddc131..e718ed44 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/eval/OpForEach.kt +++ b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/eval/OpForEach.kt @@ -1,13 +1,13 @@ package at.petrak.hexcasting.common.casting.operators.eval -import at.petrak.hexcasting.api.spell.Action -import at.petrak.hexcasting.api.spell.OperationResult -import at.petrak.hexcasting.api.spell.casting.CastingContext -import at.petrak.hexcasting.api.spell.casting.eval.FrameForEach -import at.petrak.hexcasting.api.spell.casting.eval.SpellContinuation -import at.petrak.hexcasting.api.spell.getList -import at.petrak.hexcasting.api.spell.iota.Iota -import at.petrak.hexcasting.api.spell.mishaps.MishapNotEnoughArgs +import at.petrak.hexcasting.api.casting.Action +import at.petrak.hexcasting.api.casting.OperationResult +import at.petrak.hexcasting.api.casting.eval.CastingContext +import at.petrak.hexcasting.api.casting.eval.vm.FrameForEach +import at.petrak.hexcasting.api.casting.eval.vm.SpellContinuation +import at.petrak.hexcasting.api.casting.getList +import at.petrak.hexcasting.api.casting.iota.Iota +import at.petrak.hexcasting.api.casting.mishaps.MishapNotEnoughArgs object OpForEach : Action { override fun operate( diff --git a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/eval/OpHalt.kt b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/eval/OpHalt.kt index 0b1526b0..398523b3 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/eval/OpHalt.kt +++ b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/eval/OpHalt.kt @@ -1,10 +1,10 @@ package at.petrak.hexcasting.common.casting.operators.eval -import at.petrak.hexcasting.api.spell.Action -import at.petrak.hexcasting.api.spell.OperationResult -import at.petrak.hexcasting.api.spell.casting.CastingContext -import at.petrak.hexcasting.api.spell.casting.eval.SpellContinuation -import at.petrak.hexcasting.api.spell.iota.Iota +import at.petrak.hexcasting.api.casting.Action +import at.petrak.hexcasting.api.casting.OperationResult +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 object OpHalt : Action { override fun operate( diff --git a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/lists/OpAppend.kt b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/lists/OpAppend.kt index fc84dfd7..5e15a975 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/lists/OpAppend.kt +++ b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/lists/OpAppend.kt @@ -1,10 +1,10 @@ package at.petrak.hexcasting.common.casting.operators.lists -import at.petrak.hexcasting.api.spell.ConstMediaAction -import at.petrak.hexcasting.api.spell.asActionResult -import at.petrak.hexcasting.api.spell.casting.CastingContext -import at.petrak.hexcasting.api.spell.getList -import at.petrak.hexcasting.api.spell.iota.Iota +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.getList +import at.petrak.hexcasting.api.casting.iota.Iota object OpAppend : ConstMediaAction { override val argc = 2 diff --git a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/lists/OpConcat.kt b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/lists/OpConcat.kt index 55fbb17b..ff5032bb 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/lists/OpConcat.kt +++ b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/lists/OpConcat.kt @@ -1,10 +1,10 @@ package at.petrak.hexcasting.common.casting.operators.lists -import at.petrak.hexcasting.api.spell.ConstMediaAction -import at.petrak.hexcasting.api.spell.asActionResult -import at.petrak.hexcasting.api.spell.casting.CastingContext -import at.petrak.hexcasting.api.spell.getList -import at.petrak.hexcasting.api.spell.iota.Iota +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.getList +import at.petrak.hexcasting.api.casting.iota.Iota object OpConcat : ConstMediaAction { override val argc = 2 diff --git a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/lists/OpCons.kt b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/lists/OpCons.kt index 665090a7..e1266760 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/lists/OpCons.kt +++ b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/lists/OpCons.kt @@ -1,11 +1,11 @@ package at.petrak.hexcasting.common.casting.operators.lists -import at.petrak.hexcasting.api.spell.ConstMediaAction -import at.petrak.hexcasting.api.spell.SpellList -import at.petrak.hexcasting.api.spell.asActionResult -import at.petrak.hexcasting.api.spell.casting.CastingContext -import at.petrak.hexcasting.api.spell.getList -import at.petrak.hexcasting.api.spell.iota.Iota +import at.petrak.hexcasting.api.casting.ConstMediaAction +import at.petrak.hexcasting.api.casting.SpellList +import at.petrak.hexcasting.api.casting.asActionResult +import at.petrak.hexcasting.api.casting.eval.CastingContext +import at.petrak.hexcasting.api.casting.getList +import at.petrak.hexcasting.api.casting.iota.Iota object OpCons : ConstMediaAction { override val argc = 2 diff --git a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/lists/OpEmptyList.kt b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/lists/OpEmptyList.kt index 977ae98f..c688cd59 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/lists/OpEmptyList.kt +++ b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/lists/OpEmptyList.kt @@ -1,9 +1,9 @@ package at.petrak.hexcasting.common.casting.operators.lists -import at.petrak.hexcasting.api.spell.ConstMediaAction -import at.petrak.hexcasting.api.spell.iota.Iota -import at.petrak.hexcasting.api.spell.asActionResult -import at.petrak.hexcasting.api.spell.casting.CastingContext +import at.petrak.hexcasting.api.casting.ConstMediaAction +import at.petrak.hexcasting.api.casting.iota.Iota +import at.petrak.hexcasting.api.casting.asActionResult +import at.petrak.hexcasting.api.casting.eval.CastingContext object OpEmptyList : ConstMediaAction { override val argc = 0 diff --git a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/lists/OpIndex.kt b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/lists/OpIndex.kt index a98b4c2a..0d912bcb 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/lists/OpIndex.kt +++ b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/lists/OpIndex.kt @@ -1,11 +1,11 @@ package at.petrak.hexcasting.common.casting.operators.lists -import at.petrak.hexcasting.api.spell.ConstMediaAction -import at.petrak.hexcasting.api.spell.casting.CastingContext -import at.petrak.hexcasting.api.spell.getDouble -import at.petrak.hexcasting.api.spell.getList -import at.petrak.hexcasting.api.spell.iota.Iota -import at.petrak.hexcasting.api.spell.iota.NullIota +import at.petrak.hexcasting.api.casting.ConstMediaAction +import at.petrak.hexcasting.api.casting.eval.CastingContext +import at.petrak.hexcasting.api.casting.getDouble +import at.petrak.hexcasting.api.casting.getList +import at.petrak.hexcasting.api.casting.iota.Iota +import at.petrak.hexcasting.api.casting.iota.NullIota import kotlin.math.roundToInt object OpIndex : ConstMediaAction { diff --git a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/lists/OpIndexOf.kt b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/lists/OpIndexOf.kt index c3ddd19e..1f1dd0e1 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/lists/OpIndexOf.kt +++ b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/lists/OpIndexOf.kt @@ -1,10 +1,10 @@ package at.petrak.hexcasting.common.casting.operators.lists -import at.petrak.hexcasting.api.spell.ConstMediaAction -import at.petrak.hexcasting.api.spell.asActionResult -import at.petrak.hexcasting.api.spell.casting.CastingContext -import at.petrak.hexcasting.api.spell.getList -import at.petrak.hexcasting.api.spell.iota.Iota +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.getList +import at.petrak.hexcasting.api.casting.iota.Iota object OpIndexOf : ConstMediaAction { override val argc: Int diff --git a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/lists/OpLastNToList.kt b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/lists/OpLastNToList.kt index 6d73d56f..791ede46 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/lists/OpLastNToList.kt +++ b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/lists/OpLastNToList.kt @@ -1,13 +1,13 @@ package at.petrak.hexcasting.common.casting.operators.lists -import at.petrak.hexcasting.api.spell.Action -import at.petrak.hexcasting.api.spell.OperationResult -import at.petrak.hexcasting.api.spell.asActionResult -import at.petrak.hexcasting.api.spell.casting.CastingContext -import at.petrak.hexcasting.api.spell.casting.eval.SpellContinuation -import at.petrak.hexcasting.api.spell.getPositiveIntUnderInclusive -import at.petrak.hexcasting.api.spell.iota.Iota -import at.petrak.hexcasting.api.spell.mishaps.MishapNotEnoughArgs +import at.petrak.hexcasting.api.casting.Action +import at.petrak.hexcasting.api.casting.OperationResult +import at.petrak.hexcasting.api.casting.asActionResult +import at.petrak.hexcasting.api.casting.eval.CastingContext +import at.petrak.hexcasting.api.casting.eval.vm.SpellContinuation +import at.petrak.hexcasting.api.casting.getPositiveIntUnderInclusive +import at.petrak.hexcasting.api.casting.iota.Iota +import at.petrak.hexcasting.api.casting.mishaps.MishapNotEnoughArgs object OpLastNToList : Action { override fun operate( diff --git a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/lists/OpListSize.kt b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/lists/OpListSize.kt index decb0f53..15046f33 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/lists/OpListSize.kt +++ b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/lists/OpListSize.kt @@ -1,10 +1,10 @@ package at.petrak.hexcasting.common.casting.operators.lists -import at.petrak.hexcasting.api.spell.ConstMediaAction -import at.petrak.hexcasting.api.spell.asActionResult -import at.petrak.hexcasting.api.spell.casting.CastingContext -import at.petrak.hexcasting.api.spell.getList -import at.petrak.hexcasting.api.spell.iota.Iota +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.getList +import at.petrak.hexcasting.api.casting.iota.Iota // it's still called beancounter's distillation in my heart object OpListSize : ConstMediaAction { diff --git a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/lists/OpModifyInPlace.kt b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/lists/OpModifyInPlace.kt index 25106049..ba1a75e3 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/lists/OpModifyInPlace.kt +++ b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/lists/OpModifyInPlace.kt @@ -1,8 +1,8 @@ package at.petrak.hexcasting.common.casting.operators.lists -import at.petrak.hexcasting.api.spell.* -import at.petrak.hexcasting.api.spell.casting.CastingContext -import at.petrak.hexcasting.api.spell.iota.Iota +import at.petrak.hexcasting.api.casting.* +import at.petrak.hexcasting.api.casting.eval.CastingContext +import at.petrak.hexcasting.api.casting.iota.Iota object OpModifyInPlace : ConstMediaAction { override val argc = 3 diff --git a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/lists/OpRemove.kt b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/lists/OpRemove.kt index 3b40e798..90ee5f9d 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/lists/OpRemove.kt +++ b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/lists/OpRemove.kt @@ -1,11 +1,11 @@ package at.petrak.hexcasting.common.casting.operators.lists -import at.petrak.hexcasting.api.spell.ConstMediaAction -import at.petrak.hexcasting.api.spell.asActionResult -import at.petrak.hexcasting.api.spell.casting.CastingContext -import at.petrak.hexcasting.api.spell.getInt -import at.petrak.hexcasting.api.spell.getList -import at.petrak.hexcasting.api.spell.iota.Iota +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.getInt +import at.petrak.hexcasting.api.casting.getList +import at.petrak.hexcasting.api.casting.iota.Iota object OpRemove : ConstMediaAction { override val argc: Int diff --git a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/lists/OpReverski.kt b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/lists/OpReverski.kt index 5dad2ec9..4133b779 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/lists/OpReverski.kt +++ b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/lists/OpReverski.kt @@ -1,10 +1,10 @@ package at.petrak.hexcasting.common.casting.operators.lists -import at.petrak.hexcasting.api.spell.ConstMediaAction -import at.petrak.hexcasting.api.spell.asActionResult -import at.petrak.hexcasting.api.spell.casting.CastingContext -import at.petrak.hexcasting.api.spell.getList -import at.petrak.hexcasting.api.spell.iota.Iota +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.getList +import at.petrak.hexcasting.api.casting.iota.Iota object OpReverski : ConstMediaAction { override val argc = 1 diff --git a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/lists/OpSingleton.kt b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/lists/OpSingleton.kt index 77f5094b..f1c2534c 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/lists/OpSingleton.kt +++ b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/lists/OpSingleton.kt @@ -1,9 +1,9 @@ package at.petrak.hexcasting.common.casting.operators.lists -import at.petrak.hexcasting.api.spell.ConstMediaAction -import at.petrak.hexcasting.api.spell.asActionResult -import at.petrak.hexcasting.api.spell.casting.CastingContext -import at.petrak.hexcasting.api.spell.iota.Iota +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 object OpSingleton : ConstMediaAction { override val argc = 1 diff --git a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/lists/OpSlice.kt b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/lists/OpSlice.kt index 5715b8ce..1bc2ae0c 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/lists/OpSlice.kt +++ b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/lists/OpSlice.kt @@ -1,11 +1,11 @@ package at.petrak.hexcasting.common.casting.operators.lists -import at.petrak.hexcasting.api.spell.ConstMediaAction -import at.petrak.hexcasting.api.spell.asActionResult -import at.petrak.hexcasting.api.spell.casting.CastingContext -import at.petrak.hexcasting.api.spell.getList -import at.petrak.hexcasting.api.spell.getPositiveIntUnderInclusive -import at.petrak.hexcasting.api.spell.iota.Iota +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.getList +import at.petrak.hexcasting.api.casting.getPositiveIntUnderInclusive +import at.petrak.hexcasting.api.casting.iota.Iota import kotlin.math.max import kotlin.math.min diff --git a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/lists/OpSplat.kt b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/lists/OpSplat.kt index 7d97f34b..30af1427 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/lists/OpSplat.kt +++ b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/lists/OpSplat.kt @@ -1,9 +1,9 @@ package at.petrak.hexcasting.common.casting.operators.lists -import at.petrak.hexcasting.api.spell.ConstMediaAction -import at.petrak.hexcasting.api.spell.casting.CastingContext -import at.petrak.hexcasting.api.spell.getList -import at.petrak.hexcasting.api.spell.iota.Iota +import at.petrak.hexcasting.api.casting.ConstMediaAction +import at.petrak.hexcasting.api.casting.eval.CastingContext +import at.petrak.hexcasting.api.casting.getList +import at.petrak.hexcasting.api.casting.iota.Iota object OpSplat : ConstMediaAction { override val argc: Int diff --git a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/lists/OpUnCons.kt b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/lists/OpUnCons.kt index 21bba315..bf49d794 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/lists/OpUnCons.kt +++ b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/lists/OpUnCons.kt @@ -1,11 +1,11 @@ package at.petrak.hexcasting.common.casting.operators.lists -import at.petrak.hexcasting.api.spell.ConstMediaAction -import at.petrak.hexcasting.api.spell.casting.CastingContext -import at.petrak.hexcasting.api.spell.getList -import at.petrak.hexcasting.api.spell.iota.Iota -import at.petrak.hexcasting.api.spell.iota.ListIota -import at.petrak.hexcasting.api.spell.iota.NullIota +import at.petrak.hexcasting.api.casting.ConstMediaAction +import at.petrak.hexcasting.api.casting.eval.CastingContext +import at.petrak.hexcasting.api.casting.getList +import at.petrak.hexcasting.api.casting.iota.Iota +import at.petrak.hexcasting.api.casting.iota.ListIota +import at.petrak.hexcasting.api.casting.iota.NullIota object OpUnCons : ConstMediaAction { override val argc = 1 diff --git a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/local/OpPeekLocal.kt b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/local/OpPeekLocal.kt index c0add471..ba24b7a1 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/local/OpPeekLocal.kt +++ b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/local/OpPeekLocal.kt @@ -1,11 +1,11 @@ package at.petrak.hexcasting.common.casting.operators.local -import at.petrak.hexcasting.api.spell.Action -import at.petrak.hexcasting.api.spell.OperationResult -import at.petrak.hexcasting.api.spell.casting.CastingContext -import at.petrak.hexcasting.api.spell.casting.eval.SpellContinuation -import at.petrak.hexcasting.api.spell.iota.Iota -import at.petrak.hexcasting.api.spell.orNull +import at.petrak.hexcasting.api.casting.Action +import at.petrak.hexcasting.api.casting.OperationResult +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.casting.orNull object OpPeekLocal : Action { override fun operate( diff --git a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/local/OpPushLocal.kt b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/local/OpPushLocal.kt index a03120dd..ecbf6006 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/local/OpPushLocal.kt +++ b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/local/OpPushLocal.kt @@ -1,11 +1,11 @@ package at.petrak.hexcasting.common.casting.operators.local -import at.petrak.hexcasting.api.spell.Action -import at.petrak.hexcasting.api.spell.OperationResult -import at.petrak.hexcasting.api.spell.casting.CastingContext -import at.petrak.hexcasting.api.spell.casting.eval.SpellContinuation -import at.petrak.hexcasting.api.spell.iota.Iota -import at.petrak.hexcasting.api.spell.mishaps.MishapNotEnoughArgs +import at.petrak.hexcasting.api.casting.Action +import at.petrak.hexcasting.api.casting.OperationResult +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.casting.mishaps.MishapNotEnoughArgs object OpPushLocal : Action { override fun operate( diff --git a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/math/OpAbsLen.kt b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/math/OpAbsLen.kt index f5218021..e6ee7ee3 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/math/OpAbsLen.kt +++ b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/math/OpAbsLen.kt @@ -1,10 +1,10 @@ package at.petrak.hexcasting.common.casting.operators.math -import at.petrak.hexcasting.api.spell.ConstMediaAction -import at.petrak.hexcasting.api.spell.asActionResult -import at.petrak.hexcasting.api.spell.casting.CastingContext -import at.petrak.hexcasting.api.spell.getNumOrVec -import at.petrak.hexcasting.api.spell.iota.Iota +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.getNumOrVec +import at.petrak.hexcasting.api.casting.iota.Iota import kotlin.math.absoluteValue object OpAbsLen : ConstMediaAction { diff --git a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/math/OpAdd.kt b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/math/OpAdd.kt index e1bce073..b7bf87df 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/math/OpAdd.kt +++ b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/math/OpAdd.kt @@ -1,10 +1,10 @@ package at.petrak.hexcasting.common.casting.operators.math -import at.petrak.hexcasting.api.spell.ConstMediaAction -import at.petrak.hexcasting.api.spell.asActionResult -import at.petrak.hexcasting.api.spell.casting.CastingContext -import at.petrak.hexcasting.api.spell.getNumOrVec -import at.petrak.hexcasting.api.spell.iota.Iota +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.getNumOrVec +import at.petrak.hexcasting.api.casting.iota.Iota object OpAdd : ConstMediaAction { override val argc: Int diff --git a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/math/OpCeil.kt b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/math/OpCeil.kt index e777be9d..85aecb0a 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/math/OpCeil.kt +++ b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/math/OpCeil.kt @@ -1,10 +1,10 @@ package at.petrak.hexcasting.common.casting.operators.math -import at.petrak.hexcasting.api.spell.ConstMediaAction -import at.petrak.hexcasting.api.spell.aplKinnie -import at.petrak.hexcasting.api.spell.casting.CastingContext -import at.petrak.hexcasting.api.spell.getNumOrVec -import at.petrak.hexcasting.api.spell.iota.Iota +import at.petrak.hexcasting.api.casting.ConstMediaAction +import at.petrak.hexcasting.api.casting.aplKinnie +import at.petrak.hexcasting.api.casting.eval.CastingContext +import at.petrak.hexcasting.api.casting.getNumOrVec +import at.petrak.hexcasting.api.casting.iota.Iota import kotlin.math.ceil object OpCeil : ConstMediaAction { diff --git a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/math/OpCoerceToAxial.kt b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/math/OpCoerceToAxial.kt index 711a4aa1..f795c64f 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/math/OpCoerceToAxial.kt +++ b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/math/OpCoerceToAxial.kt @@ -1,10 +1,10 @@ package at.petrak.hexcasting.common.casting.operators.math -import at.petrak.hexcasting.api.spell.ConstMediaAction -import at.petrak.hexcasting.api.spell.asActionResult -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.api.casting.ConstMediaAction +import at.petrak.hexcasting.api.casting.asActionResult +import at.petrak.hexcasting.api.casting.eval.CastingContext +import at.petrak.hexcasting.api.casting.getVec3 +import at.petrak.hexcasting.api.casting.iota.Iota import net.minecraft.core.Direction import net.minecraft.world.phys.Vec3 diff --git a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/math/OpConstructVec.kt b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/math/OpConstructVec.kt index 879ee478..f59fc230 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/math/OpConstructVec.kt +++ b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/math/OpConstructVec.kt @@ -1,10 +1,10 @@ package at.petrak.hexcasting.common.casting.operators.math -import at.petrak.hexcasting.api.spell.ConstMediaAction -import at.petrak.hexcasting.api.spell.asActionResult -import at.petrak.hexcasting.api.spell.casting.CastingContext -import at.petrak.hexcasting.api.spell.getDouble -import at.petrak.hexcasting.api.spell.iota.Iota +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.getDouble +import at.petrak.hexcasting.api.casting.iota.Iota import net.minecraft.world.phys.Vec3 object OpConstructVec : ConstMediaAction { diff --git a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/math/OpDeconstructVec.kt b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/math/OpDeconstructVec.kt index 3ef8b204..319046bd 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/math/OpDeconstructVec.kt +++ b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/math/OpDeconstructVec.kt @@ -1,10 +1,10 @@ package at.petrak.hexcasting.common.casting.operators.math -import at.petrak.hexcasting.api.spell.ConstMediaAction -import at.petrak.hexcasting.api.spell.casting.CastingContext -import at.petrak.hexcasting.api.spell.getVec3 -import at.petrak.hexcasting.api.spell.iota.DoubleIota -import at.petrak.hexcasting.api.spell.iota.Iota +import at.petrak.hexcasting.api.casting.ConstMediaAction +import at.petrak.hexcasting.api.casting.eval.CastingContext +import at.petrak.hexcasting.api.casting.getVec3 +import at.petrak.hexcasting.api.casting.iota.DoubleIota +import at.petrak.hexcasting.api.casting.iota.Iota object OpDeconstructVec : ConstMediaAction { override val argc = 1 diff --git a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/math/OpDivCross.kt b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/math/OpDivCross.kt index 5db51fbd..c0dc85e2 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/math/OpDivCross.kt +++ b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/math/OpDivCross.kt @@ -1,11 +1,11 @@ package at.petrak.hexcasting.common.casting.operators.math -import at.petrak.hexcasting.api.spell.ConstMediaAction -import at.petrak.hexcasting.api.spell.asActionResult -import at.petrak.hexcasting.api.spell.casting.CastingContext -import at.petrak.hexcasting.api.spell.getNumOrVec -import at.petrak.hexcasting.api.spell.iota.Iota -import at.petrak.hexcasting.api.spell.mishaps.MishapDivideByZero +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.getNumOrVec +import at.petrak.hexcasting.api.casting.iota.Iota +import at.petrak.hexcasting.api.casting.mishaps.MishapDivideByZero import net.minecraft.world.phys.Vec3 object OpDivCross : ConstMediaAction { diff --git a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/math/OpFloor.kt b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/math/OpFloor.kt index 0aff276c..3edb3b22 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/math/OpFloor.kt +++ b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/math/OpFloor.kt @@ -1,10 +1,10 @@ package at.petrak.hexcasting.common.casting.operators.math -import at.petrak.hexcasting.api.spell.ConstMediaAction -import at.petrak.hexcasting.api.spell.aplKinnie -import at.petrak.hexcasting.api.spell.casting.CastingContext -import at.petrak.hexcasting.api.spell.getNumOrVec -import at.petrak.hexcasting.api.spell.iota.Iota +import at.petrak.hexcasting.api.casting.ConstMediaAction +import at.petrak.hexcasting.api.casting.aplKinnie +import at.petrak.hexcasting.api.casting.eval.CastingContext +import at.petrak.hexcasting.api.casting.getNumOrVec +import at.petrak.hexcasting.api.casting.iota.Iota import kotlin.math.floor object OpFloor : ConstMediaAction { diff --git a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/math/OpLog.kt b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/math/OpLog.kt index 6a3d3a45..e97ad717 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/math/OpLog.kt +++ b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/math/OpLog.kt @@ -1,11 +1,11 @@ package at.petrak.hexcasting.common.casting.operators.math -import at.petrak.hexcasting.api.spell.ConstMediaAction -import at.petrak.hexcasting.api.spell.asActionResult -import at.petrak.hexcasting.api.spell.casting.CastingContext -import at.petrak.hexcasting.api.spell.getDouble -import at.petrak.hexcasting.api.spell.iota.Iota -import at.petrak.hexcasting.api.spell.mishaps.MishapDivideByZero +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.getDouble +import at.petrak.hexcasting.api.casting.iota.Iota +import at.petrak.hexcasting.api.casting.mishaps.MishapDivideByZero import kotlin.math.log object OpLog : ConstMediaAction { diff --git a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/math/OpModulo.kt b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/math/OpModulo.kt index 6b418916..21a3d884 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/math/OpModulo.kt +++ b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/math/OpModulo.kt @@ -1,11 +1,11 @@ package at.petrak.hexcasting.common.casting.operators.math -import at.petrak.hexcasting.api.spell.ConstMediaAction -import at.petrak.hexcasting.api.spell.asActionResult -import at.petrak.hexcasting.api.spell.casting.CastingContext -import at.petrak.hexcasting.api.spell.getDouble -import at.petrak.hexcasting.api.spell.iota.Iota -import at.petrak.hexcasting.api.spell.mishaps.MishapDivideByZero +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.getDouble +import at.petrak.hexcasting.api.casting.iota.Iota +import at.petrak.hexcasting.api.casting.mishaps.MishapDivideByZero object OpModulo : ConstMediaAction { override val argc: Int diff --git a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/math/OpMulDot.kt b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/math/OpMulDot.kt index 54124ee4..bcdd3980 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/math/OpMulDot.kt +++ b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/math/OpMulDot.kt @@ -1,10 +1,10 @@ package at.petrak.hexcasting.common.casting.operators.math -import at.petrak.hexcasting.api.spell.ConstMediaAction -import at.petrak.hexcasting.api.spell.asActionResult -import at.petrak.hexcasting.api.spell.casting.CastingContext -import at.petrak.hexcasting.api.spell.getNumOrVec -import at.petrak.hexcasting.api.spell.iota.Iota +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.getNumOrVec +import at.petrak.hexcasting.api.casting.iota.Iota object OpMulDot : ConstMediaAction { override val argc: Int 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 new file mode 100644 index 00000000..8fd6fc20 --- /dev/null +++ b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/math/OpNumberLiteral.kt @@ -0,0 +1,23 @@ +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/math/OpPowProj.kt b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/math/OpPowProj.kt index 2b96ec61..b35af8a2 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/math/OpPowProj.kt +++ b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/math/OpPowProj.kt @@ -1,11 +1,11 @@ package at.petrak.hexcasting.common.casting.operators.math -import at.petrak.hexcasting.api.spell.ConstMediaAction -import at.petrak.hexcasting.api.spell.asActionResult -import at.petrak.hexcasting.api.spell.casting.CastingContext -import at.petrak.hexcasting.api.spell.getNumOrVec -import at.petrak.hexcasting.api.spell.iota.Iota -import at.petrak.hexcasting.api.spell.mishaps.MishapDivideByZero +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.getNumOrVec +import at.petrak.hexcasting.api.casting.iota.Iota +import at.petrak.hexcasting.api.casting.mishaps.MishapDivideByZero import net.minecraft.world.phys.Vec3 import kotlin.math.pow diff --git a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/math/OpRandom.kt b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/math/OpRandom.kt index 8e8a01e6..bba9686b 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/math/OpRandom.kt +++ b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/math/OpRandom.kt @@ -1,9 +1,9 @@ package at.petrak.hexcasting.common.casting.operators.math -import at.petrak.hexcasting.api.spell.ConstMediaAction -import at.petrak.hexcasting.api.spell.asActionResult -import at.petrak.hexcasting.api.spell.casting.CastingContext -import at.petrak.hexcasting.api.spell.iota.Iota +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 object OpRandom : ConstMediaAction { override val argc: Int diff --git a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/math/OpSub.kt b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/math/OpSub.kt index de354c76..58396552 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/math/OpSub.kt +++ b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/math/OpSub.kt @@ -1,10 +1,10 @@ package at.petrak.hexcasting.common.casting.operators.math -import at.petrak.hexcasting.api.spell.ConstMediaAction -import at.petrak.hexcasting.api.spell.asActionResult -import at.petrak.hexcasting.api.spell.casting.CastingContext -import at.petrak.hexcasting.api.spell.getNumOrVec -import at.petrak.hexcasting.api.spell.iota.Iota +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.getNumOrVec +import at.petrak.hexcasting.api.casting.iota.Iota import net.minecraft.world.phys.Vec3 object OpSub : ConstMediaAction { diff --git a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/math/SpecialHandlerNumberLiteral.kt b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/math/SpecialHandlerNumberLiteral.kt new file mode 100644 index 00000000..00e456c6 --- /dev/null +++ b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/math/SpecialHandlerNumberLiteral.kt @@ -0,0 +1,81 @@ +package at.petrak.hexcasting.common.casting.operators.math + +import at.petrak.hexcasting.api.HexAPI +import at.petrak.hexcasting.api.HexAPI.modLoc +import at.petrak.hexcasting.api.casting.Action +import at.petrak.hexcasting.api.casting.ConstMediaAction +import at.petrak.hexcasting.api.casting.SpecialHandler +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.casting.math.HexPattern +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 SpecialHandlerNumberLiteral(val x: Double) : SpecialHandler() { + override fun act(): Action { + return InnerAction(this.x) + } + + override fun getName(): Component { + return HexAPI.instance().getActionI18nKey(NAME) + .asTranslatedComponent(Action.DOUBLE_FORMATTER.format(x)).lightPurple + } + + class InnerAction(val x: Double) : ConstMediaAction { + override val argc = 0 + + override fun execute(args: List, ctx: CastingContext): List { + return this.x.asActionResult + } + } + + class Factory : SpecialHandler.Factory { + override fun tryMatch(pat: HexPattern): SpecialHandlerNumberLiteral? { + val sig = pat.anglesSignature() + if (sig.startsWith("aqaa") || sig.startsWith("dedd")) { + val negate = sig.startsWith("dedd"); + var accumulator = 0.0; + for (ch in sig.substring(4)) { + when (ch) { + 'w' -> { + accumulator += 1; + } + + 'q' -> { + accumulator += 5; + } + + 'e' -> { + accumulator += 10; + } + + 'a' -> { + accumulator *= 2; + } + + 'd' -> { + accumulator /= 2; + } + // ok funny man + 's' -> {} + else -> throw IllegalStateException() + } + } + if (negate) { + accumulator = -accumulator; + } + return SpecialHandlerNumberLiteral(accumulator); + } else { + return null; + } + } + + } + + companion object { + public val NAME: ResourceLocation = modLoc("number") + } +} \ No newline at end of file diff --git a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/math/bit/OpAnd.kt b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/math/bit/OpAnd.kt index b4ad818a..7a0220bc 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/math/bit/OpAnd.kt +++ b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/math/bit/OpAnd.kt @@ -1,8 +1,8 @@ package at.petrak.hexcasting.common.casting.operators.math.bit -import at.petrak.hexcasting.api.spell.* -import at.petrak.hexcasting.api.spell.casting.CastingContext -import at.petrak.hexcasting.api.spell.iota.Iota +import at.petrak.hexcasting.api.casting.* +import at.petrak.hexcasting.api.casting.eval.CastingContext +import at.petrak.hexcasting.api.casting.iota.Iota object OpAnd : ConstMediaAction { override val argc = 2 diff --git a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/math/bit/OpNot.kt b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/math/bit/OpNot.kt index a2a08b59..1675db68 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/math/bit/OpNot.kt +++ b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/math/bit/OpNot.kt @@ -1,10 +1,10 @@ package at.petrak.hexcasting.common.casting.operators.math.bit -import at.petrak.hexcasting.api.spell.ConstMediaAction -import at.petrak.hexcasting.api.spell.asActionResult -import at.petrak.hexcasting.api.spell.casting.CastingContext -import at.petrak.hexcasting.api.spell.getLong -import at.petrak.hexcasting.api.spell.iota.Iota +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.getLong +import at.petrak.hexcasting.api.casting.iota.Iota object OpNot : ConstMediaAction { override val argc = 1 diff --git a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/math/bit/OpOr.kt b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/math/bit/OpOr.kt index c918c4f7..02fec808 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/math/bit/OpOr.kt +++ b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/math/bit/OpOr.kt @@ -1,8 +1,8 @@ package at.petrak.hexcasting.common.casting.operators.math.bit -import at.petrak.hexcasting.api.spell.* -import at.petrak.hexcasting.api.spell.casting.CastingContext -import at.petrak.hexcasting.api.spell.iota.Iota +import at.petrak.hexcasting.api.casting.* +import at.petrak.hexcasting.api.casting.eval.CastingContext +import at.petrak.hexcasting.api.casting.iota.Iota object OpOr : ConstMediaAction { override val argc = 2 diff --git a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/math/bit/OpToSet.kt b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/math/bit/OpToSet.kt index e0a0f01c..9a502948 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/math/bit/OpToSet.kt +++ b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/math/bit/OpToSet.kt @@ -1,10 +1,10 @@ package at.petrak.hexcasting.common.casting.operators.math.bit -import at.petrak.hexcasting.api.spell.ConstMediaAction -import at.petrak.hexcasting.api.spell.asActionResult -import at.petrak.hexcasting.api.spell.casting.CastingContext -import at.petrak.hexcasting.api.spell.getList -import at.petrak.hexcasting.api.spell.iota.Iota +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.getList +import at.petrak.hexcasting.api.casting.iota.Iota object OpToSet : ConstMediaAction { override val argc = 1 diff --git a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/math/bit/OpXor.kt b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/math/bit/OpXor.kt index ef33dafb..3df8c9f0 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/math/bit/OpXor.kt +++ b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/math/bit/OpXor.kt @@ -1,8 +1,8 @@ package at.petrak.hexcasting.common.casting.operators.math.bit -import at.petrak.hexcasting.api.spell.* -import at.petrak.hexcasting.api.spell.casting.CastingContext -import at.petrak.hexcasting.api.spell.iota.Iota +import at.petrak.hexcasting.api.casting.* +import at.petrak.hexcasting.api.casting.eval.CastingContext +import at.petrak.hexcasting.api.casting.iota.Iota object OpXor : ConstMediaAction { override val argc = 2 diff --git a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/math/logic/OpBoolAnd.kt b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/math/logic/OpBoolAnd.kt index f2a11bd8..87946d82 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/math/logic/OpBoolAnd.kt +++ b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/math/logic/OpBoolAnd.kt @@ -1,10 +1,10 @@ package at.petrak.hexcasting.common.casting.operators.math.logic -import at.petrak.hexcasting.api.spell.ConstMediaAction -import at.petrak.hexcasting.api.spell.asActionResult -import at.petrak.hexcasting.api.spell.casting.CastingContext -import at.petrak.hexcasting.api.spell.getBool -import at.petrak.hexcasting.api.spell.iota.Iota +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.getBool +import at.petrak.hexcasting.api.casting.iota.Iota object OpBoolAnd : ConstMediaAction { override val argc = 2 diff --git a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/math/logic/OpBoolIf.kt b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/math/logic/OpBoolIf.kt index c0afc2ce..e22c9f1d 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/math/logic/OpBoolIf.kt +++ b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/math/logic/OpBoolIf.kt @@ -1,9 +1,9 @@ package at.petrak.hexcasting.common.casting.operators.math.logic -import at.petrak.hexcasting.api.spell.ConstMediaAction -import at.petrak.hexcasting.api.spell.casting.CastingContext -import at.petrak.hexcasting.api.spell.getBool -import at.petrak.hexcasting.api.spell.iota.Iota +import at.petrak.hexcasting.api.casting.ConstMediaAction +import at.petrak.hexcasting.api.casting.eval.CastingContext +import at.petrak.hexcasting.api.casting.getBool +import at.petrak.hexcasting.api.casting.iota.Iota object OpBoolIf : ConstMediaAction { override val argc = 3 diff --git a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/math/logic/OpBoolNot.kt b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/math/logic/OpBoolNot.kt index 867b212a..5ef878cc 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/math/logic/OpBoolNot.kt +++ b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/math/logic/OpBoolNot.kt @@ -1,10 +1,10 @@ package at.petrak.hexcasting.common.casting.operators.math.logic -import at.petrak.hexcasting.api.spell.ConstMediaAction -import at.petrak.hexcasting.api.spell.asActionResult -import at.petrak.hexcasting.api.spell.casting.CastingContext -import at.petrak.hexcasting.api.spell.getBool -import at.petrak.hexcasting.api.spell.iota.Iota +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.getBool +import at.petrak.hexcasting.api.casting.iota.Iota object OpBoolNot : ConstMediaAction { override val argc = 1 diff --git a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/math/logic/OpBoolOr.kt b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/math/logic/OpBoolOr.kt index 911ab20b..275667b4 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/math/logic/OpBoolOr.kt +++ b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/math/logic/OpBoolOr.kt @@ -1,10 +1,10 @@ package at.petrak.hexcasting.common.casting.operators.math.logic -import at.petrak.hexcasting.api.spell.ConstMediaAction -import at.petrak.hexcasting.api.spell.asActionResult -import at.petrak.hexcasting.api.spell.casting.CastingContext -import at.petrak.hexcasting.api.spell.getBool -import at.petrak.hexcasting.api.spell.iota.Iota +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.getBool +import at.petrak.hexcasting.api.casting.iota.Iota object OpBoolOr : ConstMediaAction { override val argc = 2 diff --git a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/math/logic/OpBoolXor.kt b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/math/logic/OpBoolXor.kt index 7b20841f..fdd59e29 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/math/logic/OpBoolXor.kt +++ b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/math/logic/OpBoolXor.kt @@ -1,10 +1,10 @@ package at.petrak.hexcasting.common.casting.operators.math.logic -import at.petrak.hexcasting.api.spell.ConstMediaAction -import at.petrak.hexcasting.api.spell.asActionResult -import at.petrak.hexcasting.api.spell.casting.CastingContext -import at.petrak.hexcasting.api.spell.getBool -import at.petrak.hexcasting.api.spell.iota.Iota +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.getBool +import at.petrak.hexcasting.api.casting.iota.Iota object OpBoolXor : ConstMediaAction { override val argc = 2 diff --git a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/math/logic/OpCoerceToBool.kt b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/math/logic/OpCoerceToBool.kt index 9e40d796..fe097876 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/math/logic/OpCoerceToBool.kt +++ b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/math/logic/OpCoerceToBool.kt @@ -1,9 +1,9 @@ package at.petrak.hexcasting.common.casting.operators.math.logic -import at.petrak.hexcasting.api.spell.ConstMediaAction -import at.petrak.hexcasting.api.spell.asActionResult -import at.petrak.hexcasting.api.spell.casting.CastingContext -import at.petrak.hexcasting.api.spell.iota.Iota +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 object OpCoerceToBool : ConstMediaAction { override val argc = 1 diff --git a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/math/logic/OpCompare.kt b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/math/logic/OpCompare.kt index dca4baee..a39e004a 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/math/logic/OpCompare.kt +++ b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/math/logic/OpCompare.kt @@ -1,11 +1,11 @@ package at.petrak.hexcasting.common.casting.operators.math.logic -import at.petrak.hexcasting.api.spell.ConstMediaAction -import at.petrak.hexcasting.api.spell.asActionResult -import at.petrak.hexcasting.api.spell.casting.CastingContext -import at.petrak.hexcasting.api.spell.getDouble -import at.petrak.hexcasting.api.spell.iota.DoubleIota -import at.petrak.hexcasting.api.spell.iota.Iota +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.getDouble +import at.petrak.hexcasting.api.casting.iota.DoubleIota +import at.petrak.hexcasting.api.casting.iota.Iota import java.util.function.BiPredicate class OpCompare(val acceptsEqual: Boolean, val cmp: BiPredicate) : ConstMediaAction { diff --git a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/math/logic/OpEquality.kt b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/math/logic/OpEquality.kt index 4d9964fd..ab710224 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/math/logic/OpEquality.kt +++ b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/math/logic/OpEquality.kt @@ -1,9 +1,9 @@ package at.petrak.hexcasting.common.casting.operators.math.logic -import at.petrak.hexcasting.api.spell.ConstMediaAction -import at.petrak.hexcasting.api.spell.asActionResult -import at.petrak.hexcasting.api.spell.casting.CastingContext -import at.petrak.hexcasting.api.spell.iota.Iota +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 class OpEquality(val invert: Boolean) : ConstMediaAction { override val argc = 2 diff --git a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/math/trig/OpArcCos.kt b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/math/trig/OpArcCos.kt index 94fddd24..42bb19ee 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/math/trig/OpArcCos.kt +++ b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/math/trig/OpArcCos.kt @@ -1,10 +1,10 @@ package at.petrak.hexcasting.common.casting.operators.math.trig -import at.petrak.hexcasting.api.spell.ConstMediaAction -import at.petrak.hexcasting.api.spell.asActionResult -import at.petrak.hexcasting.api.spell.casting.CastingContext -import at.petrak.hexcasting.api.spell.getDoubleBetween -import at.petrak.hexcasting.api.spell.iota.Iota +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.getDoubleBetween +import at.petrak.hexcasting.api.casting.iota.Iota import kotlin.math.acos object OpArcCos : ConstMediaAction { diff --git a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/math/trig/OpArcSin.kt b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/math/trig/OpArcSin.kt index 14219960..be2047be 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/math/trig/OpArcSin.kt +++ b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/math/trig/OpArcSin.kt @@ -1,10 +1,10 @@ package at.petrak.hexcasting.common.casting.operators.math.trig -import at.petrak.hexcasting.api.spell.ConstMediaAction -import at.petrak.hexcasting.api.spell.asActionResult -import at.petrak.hexcasting.api.spell.casting.CastingContext -import at.petrak.hexcasting.api.spell.getDoubleBetween -import at.petrak.hexcasting.api.spell.iota.Iota +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.getDoubleBetween +import at.petrak.hexcasting.api.casting.iota.Iota import kotlin.math.asin object OpArcSin : ConstMediaAction { diff --git a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/math/trig/OpArcTan.kt b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/math/trig/OpArcTan.kt index baec0ddb..99c7d099 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/math/trig/OpArcTan.kt +++ b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/math/trig/OpArcTan.kt @@ -1,10 +1,10 @@ package at.petrak.hexcasting.common.casting.operators.math.trig -import at.petrak.hexcasting.api.spell.ConstMediaAction -import at.petrak.hexcasting.api.spell.asActionResult -import at.petrak.hexcasting.api.spell.casting.CastingContext -import at.petrak.hexcasting.api.spell.getDouble -import at.petrak.hexcasting.api.spell.iota.Iota +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.getDouble +import at.petrak.hexcasting.api.casting.iota.Iota import kotlin.math.atan object OpArcTan : ConstMediaAction { diff --git a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/math/trig/OpArcTan2.kt b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/math/trig/OpArcTan2.kt index f41518a0..be950a52 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/math/trig/OpArcTan2.kt +++ b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/math/trig/OpArcTan2.kt @@ -1,10 +1,10 @@ package at.petrak.hexcasting.common.casting.operators.math.trig -import at.petrak.hexcasting.api.spell.ConstMediaAction -import at.petrak.hexcasting.api.spell.asActionResult -import at.petrak.hexcasting.api.spell.casting.CastingContext -import at.petrak.hexcasting.api.spell.getDouble -import at.petrak.hexcasting.api.spell.iota.Iota +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.getDouble +import at.petrak.hexcasting.api.casting.iota.Iota import kotlin.math.atan2 object OpArcTan2 : ConstMediaAction { diff --git a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/math/trig/OpCos.kt b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/math/trig/OpCos.kt index bff354b7..30991b65 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/math/trig/OpCos.kt +++ b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/math/trig/OpCos.kt @@ -1,10 +1,10 @@ package at.petrak.hexcasting.common.casting.operators.math.trig -import at.petrak.hexcasting.api.spell.ConstMediaAction -import at.petrak.hexcasting.api.spell.asActionResult -import at.petrak.hexcasting.api.spell.casting.CastingContext -import at.petrak.hexcasting.api.spell.getDouble -import at.petrak.hexcasting.api.spell.iota.Iota +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.getDouble +import at.petrak.hexcasting.api.casting.iota.Iota import kotlin.math.cos object OpCos : ConstMediaAction { diff --git a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/math/trig/OpSin.kt b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/math/trig/OpSin.kt index ee7e3900..14885311 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/math/trig/OpSin.kt +++ b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/math/trig/OpSin.kt @@ -1,10 +1,10 @@ package at.petrak.hexcasting.common.casting.operators.math.trig -import at.petrak.hexcasting.api.spell.ConstMediaAction -import at.petrak.hexcasting.api.spell.asActionResult -import at.petrak.hexcasting.api.spell.casting.CastingContext -import at.petrak.hexcasting.api.spell.getDouble -import at.petrak.hexcasting.api.spell.iota.Iota +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.getDouble +import at.petrak.hexcasting.api.casting.iota.Iota import kotlin.math.sin object OpSin : ConstMediaAction { diff --git a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/math/trig/OpTan.kt b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/math/trig/OpTan.kt index dd837e47..93516e0b 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/math/trig/OpTan.kt +++ b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/math/trig/OpTan.kt @@ -1,12 +1,12 @@ package at.petrak.hexcasting.common.casting.operators.math.trig -import at.petrak.hexcasting.api.spell.ConstMediaAction -import at.petrak.hexcasting.api.spell.asActionResult -import at.petrak.hexcasting.api.spell.casting.CastingContext -import at.petrak.hexcasting.api.spell.getDouble -import at.petrak.hexcasting.api.spell.iota.DoubleIota -import at.petrak.hexcasting.api.spell.iota.Iota -import at.petrak.hexcasting.api.spell.mishaps.MishapDivideByZero +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.getDouble +import at.petrak.hexcasting.api.casting.iota.DoubleIota +import at.petrak.hexcasting.api.casting.iota.Iota +import at.petrak.hexcasting.api.casting.mishaps.MishapDivideByZero import kotlin.math.cos import kotlin.math.tan diff --git a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/rw/OpRead.kt b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/rw/OpRead.kt index 41f90022..6a9a2728 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/rw/OpRead.kt +++ b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/rw/OpRead.kt @@ -1,9 +1,9 @@ package at.petrak.hexcasting.common.casting.operators.rw -import at.petrak.hexcasting.api.spell.ConstMediaAction -import at.petrak.hexcasting.api.spell.casting.CastingContext -import at.petrak.hexcasting.api.spell.iota.Iota -import at.petrak.hexcasting.api.spell.mishaps.MishapBadOffhandItem +import at.petrak.hexcasting.api.casting.ConstMediaAction +import at.petrak.hexcasting.api.casting.eval.CastingContext +import at.petrak.hexcasting.api.casting.iota.Iota +import at.petrak.hexcasting.api.casting.mishaps.MishapBadOffhandItem import at.petrak.hexcasting.xplat.IXplatAbstractions object OpRead : ConstMediaAction { diff --git a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/rw/OpReadable.kt b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/rw/OpReadable.kt index 35c0b6bc..03445006 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/rw/OpReadable.kt +++ b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/rw/OpReadable.kt @@ -1,9 +1,9 @@ package at.petrak.hexcasting.common.casting.operators.rw -import at.petrak.hexcasting.api.spell.ConstMediaAction -import at.petrak.hexcasting.api.spell.asActionResult -import at.petrak.hexcasting.api.spell.casting.CastingContext -import at.petrak.hexcasting.api.spell.iota.Iota +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.xplat.IXplatAbstractions object OpReadable : ConstMediaAction { diff --git a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/rw/OpTheCoolerRead.kt b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/rw/OpTheCoolerRead.kt index 489dc861..9b302e1e 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/rw/OpTheCoolerRead.kt +++ b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/rw/OpTheCoolerRead.kt @@ -1,10 +1,10 @@ package at.petrak.hexcasting.common.casting.operators.rw -import at.petrak.hexcasting.api.spell.ConstMediaAction -import at.petrak.hexcasting.api.spell.casting.CastingContext -import at.petrak.hexcasting.api.spell.getEntity -import at.petrak.hexcasting.api.spell.iota.Iota -import at.petrak.hexcasting.api.spell.mishaps.MishapBadEntity +import at.petrak.hexcasting.api.casting.ConstMediaAction +import at.petrak.hexcasting.api.casting.eval.CastingContext +import at.petrak.hexcasting.api.casting.getEntity +import at.petrak.hexcasting.api.casting.iota.Iota +import at.petrak.hexcasting.api.casting.mishaps.MishapBadEntity import at.petrak.hexcasting.xplat.IXplatAbstractions object OpTheCoolerRead : ConstMediaAction { diff --git a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/rw/OpTheCoolerReadable.kt b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/rw/OpTheCoolerReadable.kt index 733eb95e..2469cf53 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/rw/OpTheCoolerReadable.kt +++ b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/rw/OpTheCoolerReadable.kt @@ -1,10 +1,10 @@ package at.petrak.hexcasting.common.casting.operators.rw -import at.petrak.hexcasting.api.spell.ConstMediaAction -import at.petrak.hexcasting.api.spell.asActionResult -import at.petrak.hexcasting.api.spell.casting.CastingContext -import at.petrak.hexcasting.api.spell.getEntity -import at.petrak.hexcasting.api.spell.iota.Iota +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.getEntity +import at.petrak.hexcasting.api.casting.iota.Iota import at.petrak.hexcasting.xplat.IXplatAbstractions object OpTheCoolerReadable : ConstMediaAction { diff --git a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/rw/OpTheCoolerWritable.kt b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/rw/OpTheCoolerWritable.kt index 322db986..6318935f 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/rw/OpTheCoolerWritable.kt +++ b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/rw/OpTheCoolerWritable.kt @@ -1,11 +1,11 @@ package at.petrak.hexcasting.common.casting.operators.rw -import at.petrak.hexcasting.api.spell.ConstMediaAction -import at.petrak.hexcasting.api.spell.asActionResult -import at.petrak.hexcasting.api.spell.casting.CastingContext -import at.petrak.hexcasting.api.spell.getEntity -import at.petrak.hexcasting.api.spell.iota.Iota -import at.petrak.hexcasting.api.spell.iota.NullIota +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.getEntity +import at.petrak.hexcasting.api.casting.iota.Iota +import at.petrak.hexcasting.api.casting.iota.NullIota import at.petrak.hexcasting.xplat.IXplatAbstractions object OpTheCoolerWritable : ConstMediaAction { diff --git a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/rw/OpTheCoolerWrite.kt b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/rw/OpTheCoolerWrite.kt index f3f238f6..8d9c5d5a 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/rw/OpTheCoolerWrite.kt +++ b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/rw/OpTheCoolerWrite.kt @@ -1,14 +1,14 @@ package at.petrak.hexcasting.common.casting.operators.rw import at.petrak.hexcasting.api.addldata.ADIotaHolder -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.getEntity -import at.petrak.hexcasting.api.spell.iota.Iota -import at.petrak.hexcasting.api.spell.mishaps.MishapBadEntity -import at.petrak.hexcasting.api.spell.mishaps.MishapOthersName +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.getEntity +import at.petrak.hexcasting.api.casting.iota.Iota +import at.petrak.hexcasting.api.casting.mishaps.MishapBadEntity +import at.petrak.hexcasting.api.casting.mishaps.MishapOthersName import at.petrak.hexcasting.xplat.IXplatAbstractions import net.minecraft.world.entity.item.ItemEntity import net.minecraft.world.phys.Vec3 diff --git a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/rw/OpWritable.kt b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/rw/OpWritable.kt index 918595b8..f1bb59d2 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/rw/OpWritable.kt +++ b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/rw/OpWritable.kt @@ -1,10 +1,10 @@ package at.petrak.hexcasting.common.casting.operators.rw -import at.petrak.hexcasting.api.spell.ConstMediaAction -import at.petrak.hexcasting.api.spell.asActionResult -import at.petrak.hexcasting.api.spell.casting.CastingContext -import at.petrak.hexcasting.api.spell.iota.Iota -import at.petrak.hexcasting.api.spell.mishaps.MishapOthersName +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.casting.mishaps.MishapOthersName import at.petrak.hexcasting.xplat.IXplatAbstractions object OpWritable : ConstMediaAction { diff --git a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/rw/OpWrite.kt b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/rw/OpWrite.kt index 720749be..c0f22cf7 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/rw/OpWrite.kt +++ b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/rw/OpWrite.kt @@ -1,13 +1,13 @@ package at.petrak.hexcasting.common.casting.operators.rw import at.petrak.hexcasting.api.addldata.ADIotaHolder -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 at.petrak.hexcasting.api.spell.mishaps.MishapBadOffhandItem -import at.petrak.hexcasting.api.spell.mishaps.MishapOthersName +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.iota.Iota +import at.petrak.hexcasting.api.casting.mishaps.MishapBadOffhandItem +import at.petrak.hexcasting.api.casting.mishaps.MishapOthersName import at.petrak.hexcasting.xplat.IXplatAbstractions // we make this a spell cause imo it's a little ... anticlimactic for it to just make no noise diff --git a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/selectors/OpGetCaster.kt b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/selectors/OpGetCaster.kt index 33d167a4..354bd2cc 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/selectors/OpGetCaster.kt +++ b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/selectors/OpGetCaster.kt @@ -1,9 +1,9 @@ package at.petrak.hexcasting.common.casting.operators.selectors -import at.petrak.hexcasting.api.spell.ConstMediaAction -import at.petrak.hexcasting.api.spell.asActionResult -import at.petrak.hexcasting.api.spell.casting.CastingContext -import at.petrak.hexcasting.api.spell.iota.Iota +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 object OpGetCaster : ConstMediaAction { override val argc = 0 diff --git a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/selectors/OpGetEntitiesBy.kt b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/selectors/OpGetEntitiesBy.kt index 27a04439..b3438d83 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/selectors/OpGetEntitiesBy.kt +++ b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/selectors/OpGetEntitiesBy.kt @@ -1,12 +1,12 @@ package at.petrak.hexcasting.common.casting.operators.selectors -import at.petrak.hexcasting.api.spell.ConstMediaAction -import at.petrak.hexcasting.api.spell.asActionResult -import at.petrak.hexcasting.api.spell.casting.CastingContext -import at.petrak.hexcasting.api.spell.getPositiveDouble -import at.petrak.hexcasting.api.spell.getVec3 -import at.petrak.hexcasting.api.spell.iota.EntityIota -import at.petrak.hexcasting.api.spell.iota.Iota +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.getPositiveDouble +import at.petrak.hexcasting.api.casting.getVec3 +import at.petrak.hexcasting.api.casting.iota.EntityIota +import at.petrak.hexcasting.api.casting.iota.Iota import net.minecraft.world.entity.Entity import net.minecraft.world.entity.LivingEntity import net.minecraft.world.entity.animal.Animal diff --git a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/selectors/OpGetEntityAt.kt b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/selectors/OpGetEntityAt.kt index ed44271c..e0a335a7 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/selectors/OpGetEntityAt.kt +++ b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/selectors/OpGetEntityAt.kt @@ -1,10 +1,10 @@ package at.petrak.hexcasting.common.casting.operators.selectors -import at.petrak.hexcasting.api.spell.ConstMediaAction -import at.petrak.hexcasting.api.spell.asActionResult -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.api.casting.ConstMediaAction +import at.petrak.hexcasting.api.casting.asActionResult +import at.petrak.hexcasting.api.casting.eval.CastingContext +import at.petrak.hexcasting.api.casting.getVec3 +import at.petrak.hexcasting.api.casting.iota.Iota import net.minecraft.world.entity.Entity import net.minecraft.world.phys.AABB import net.minecraft.world.phys.Vec3 diff --git a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/spells/OpAddMotion.kt b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/spells/OpAddMotion.kt index b7a96cf4..4a6d72fd 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/spells/OpAddMotion.kt +++ b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/spells/OpAddMotion.kt @@ -1,9 +1,9 @@ package at.petrak.hexcasting.common.casting.operators.spells import at.petrak.hexcasting.api.misc.MediaConstants -import at.petrak.hexcasting.api.spell.* -import at.petrak.hexcasting.api.spell.casting.CastingContext -import at.petrak.hexcasting.api.spell.iota.Iota +import at.petrak.hexcasting.api.casting.* +import at.petrak.hexcasting.api.casting.eval.CastingContext +import at.petrak.hexcasting.api.casting.iota.Iota import net.minecraft.world.entity.Entity import net.minecraft.world.phys.Vec3 diff --git a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/spells/OpBeep.kt b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/spells/OpBeep.kt index a56c47d2..c7119516 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/spells/OpBeep.kt +++ b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/spells/OpBeep.kt @@ -1,9 +1,9 @@ package at.petrak.hexcasting.common.casting.operators.spells import at.petrak.hexcasting.api.misc.MediaConstants -import at.petrak.hexcasting.api.spell.* -import at.petrak.hexcasting.api.spell.casting.CastingContext -import at.petrak.hexcasting.api.spell.iota.Iota +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.common.network.MsgBeepAck import at.petrak.hexcasting.xplat.IXplatAbstractions import net.minecraft.world.level.block.state.properties.NoteBlockInstrument diff --git a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/spells/OpBlink.kt b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/spells/OpBlink.kt index 12366502..f938a0c6 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/spells/OpBlink.kt +++ b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/spells/OpBlink.kt @@ -3,11 +3,11 @@ package at.petrak.hexcasting.common.casting.operators.spells 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.spell.* -import at.petrak.hexcasting.api.spell.casting.CastingContext -import at.petrak.hexcasting.api.spell.iota.Iota -import at.petrak.hexcasting.api.spell.mishaps.MishapImmuneEntity -import at.petrak.hexcasting.api.spell.mishaps.MishapLocationTooFarAway +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.common.casting.operators.spells.great.OpTeleport import net.minecraft.world.entity.Entity import kotlin.math.roundToInt diff --git a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/spells/OpBreakBlock.kt b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/spells/OpBreakBlock.kt index a9d7102f..d55d9436 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/spells/OpBreakBlock.kt +++ b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/spells/OpBreakBlock.kt @@ -2,12 +2,12 @@ package at.petrak.hexcasting.common.casting.operators.spells import at.petrak.hexcasting.api.misc.MediaConstants import at.petrak.hexcasting.api.mod.HexConfig -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.getBlockPos -import at.petrak.hexcasting.api.spell.iota.Iota +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.getBlockPos +import at.petrak.hexcasting.api.casting.iota.Iota import at.petrak.hexcasting.xplat.IXplatAbstractions import net.minecraft.core.BlockPos import net.minecraft.world.phys.Vec3 diff --git a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/spells/OpColorize.kt b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/spells/OpColorize.kt index 04d08cac..3a558160 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/spells/OpColorize.kt +++ b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/spells/OpColorize.kt @@ -2,12 +2,12 @@ package at.petrak.hexcasting.common.casting.operators.spells import at.petrak.hexcasting.api.misc.FrozenColorizer 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.iota.Iota -import at.petrak.hexcasting.api.spell.SpellAction -import at.petrak.hexcasting.api.spell.casting.CastingContext -import at.petrak.hexcasting.api.spell.mishaps.MishapBadOffhandItem +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.mishaps.MishapBadOffhandItem import at.petrak.hexcasting.xplat.IXplatAbstractions import net.minecraft.world.item.ItemStack diff --git a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/spells/OpConjureBlock.kt b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/spells/OpConjureBlock.kt index 2fca411a..29f623dc 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/spells/OpConjureBlock.kt +++ b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/spells/OpConjureBlock.kt @@ -1,13 +1,13 @@ package at.petrak.hexcasting.common.casting.operators.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.getBlockPos -import at.petrak.hexcasting.api.spell.iota.Iota -import at.petrak.hexcasting.api.spell.mishaps.MishapBadBlock +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.getBlockPos +import at.petrak.hexcasting.api.casting.iota.Iota +import at.petrak.hexcasting.api.casting.mishaps.MishapBadBlock import at.petrak.hexcasting.common.blocks.BlockConjured import at.petrak.hexcasting.common.lib.HexBlocks import at.petrak.hexcasting.xplat.IXplatAbstractions 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 50d6c449..20181419 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 @@ -1,11 +1,11 @@ package at.petrak.hexcasting.common.casting.operators.spells -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.getBlockPos -import at.petrak.hexcasting.api.spell.iota.Iota +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.getBlockPos +import at.petrak.hexcasting.api.casting.iota.Iota import at.petrak.hexcasting.xplat.IXplatAbstractions import net.minecraft.core.BlockPos import net.minecraft.world.item.BucketItem diff --git a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/spells/OpDestroyFluid.kt b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/spells/OpDestroyFluid.kt index d8102dbb..25998415 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/spells/OpDestroyFluid.kt +++ b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/spells/OpDestroyFluid.kt @@ -1,12 +1,12 @@ package at.petrak.hexcasting.common.casting.operators.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.getBlockPos -import at.petrak.hexcasting.api.spell.iota.Iota +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.getBlockPos +import at.petrak.hexcasting.api.casting.iota.Iota import at.petrak.hexcasting.xplat.IXplatAbstractions import net.minecraft.core.BlockPos import net.minecraft.core.Direction diff --git a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/spells/OpEdifySapling.kt b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/spells/OpEdifySapling.kt index 13832a4b..a9287457 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/spells/OpEdifySapling.kt +++ b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/spells/OpEdifySapling.kt @@ -1,13 +1,13 @@ package at.petrak.hexcasting.common.casting.operators.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.getBlockPos -import at.petrak.hexcasting.api.spell.iota.Iota -import at.petrak.hexcasting.api.spell.mishaps.MishapBadBlock +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.getBlockPos +import at.petrak.hexcasting.api.casting.iota.Iota +import at.petrak.hexcasting.api.casting.mishaps.MishapBadBlock import at.petrak.hexcasting.common.misc.AkashicTreeGrower import at.petrak.hexcasting.xplat.IXplatAbstractions import net.minecraft.core.BlockPos diff --git a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/spells/OpErase.kt b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/spells/OpErase.kt index b7eea8cf..c02f9241 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/spells/OpErase.kt +++ b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/spells/OpErase.kt @@ -1,12 +1,12 @@ package at.petrak.hexcasting.common.casting.operators.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.iota.Iota -import at.petrak.hexcasting.api.spell.mishaps.MishapBadOffhandItem +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.iota.Iota +import at.petrak.hexcasting.api.casting.mishaps.MishapBadOffhandItem import at.petrak.hexcasting.xplat.IXplatAbstractions import net.minecraft.world.item.ItemStack diff --git a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/spells/OpExplode.kt b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/spells/OpExplode.kt index c6aeaae9..f8067d47 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/spells/OpExplode.kt +++ b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/spells/OpExplode.kt @@ -1,9 +1,9 @@ package at.petrak.hexcasting.common.casting.operators.spells import at.petrak.hexcasting.api.misc.MediaConstants -import at.petrak.hexcasting.api.spell.* -import at.petrak.hexcasting.api.spell.casting.CastingContext -import at.petrak.hexcasting.api.spell.iota.Iota +import at.petrak.hexcasting.api.casting.* +import at.petrak.hexcasting.api.casting.eval.CastingContext +import at.petrak.hexcasting.api.casting.iota.Iota import net.minecraft.core.BlockPos import net.minecraft.util.Mth import net.minecraft.world.level.Explosion diff --git a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/spells/OpExtinguish.kt b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/spells/OpExtinguish.kt index d0bdd14e..91d4a615 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/spells/OpExtinguish.kt +++ b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/spells/OpExtinguish.kt @@ -1,12 +1,12 @@ package at.petrak.hexcasting.common.casting.operators.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.getBlockPos -import at.petrak.hexcasting.api.spell.iota.Iota +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.getBlockPos +import at.petrak.hexcasting.api.casting.iota.Iota import at.petrak.hexcasting.ktxt.UseOnContext import at.petrak.hexcasting.xplat.IXplatAbstractions import net.minecraft.core.BlockPos diff --git a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/spells/OpIgnite.kt b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/spells/OpIgnite.kt index 47f70a20..89e56e7c 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/spells/OpIgnite.kt +++ b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/spells/OpIgnite.kt @@ -1,12 +1,12 @@ package at.petrak.hexcasting.common.casting.operators.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.getBlockPos -import at.petrak.hexcasting.api.spell.iota.Iota +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.getBlockPos +import at.petrak.hexcasting.api.casting.iota.Iota import at.petrak.hexcasting.ktxt.UseOnContext import at.petrak.hexcasting.xplat.IXplatAbstractions import net.minecraft.core.BlockPos 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 12f5ccc8..1bfc5af8 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 @@ -2,14 +2,14 @@ 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.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.getItemEntity -import at.petrak.hexcasting.api.spell.iota.Iota -import at.petrak.hexcasting.api.spell.mishaps.MishapBadItem -import at.petrak.hexcasting.api.spell.mishaps.MishapBadOffhandItem +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.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.utils.extractMedia import at.petrak.hexcasting.api.utils.isMediaItem import at.petrak.hexcasting.common.items.magic.ItemMediaHolder diff --git a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/spells/OpMakePackagedSpell.kt b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/spells/OpMakePackagedSpell.kt index d1a75565..8b39069a 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/spells/OpMakePackagedSpell.kt +++ b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/spells/OpMakePackagedSpell.kt @@ -1,11 +1,11 @@ package at.petrak.hexcasting.common.casting.operators.spells -import at.petrak.hexcasting.api.spell.* -import at.petrak.hexcasting.api.spell.casting.CastingContext -import at.petrak.hexcasting.api.spell.iota.Iota -import at.petrak.hexcasting.api.spell.mishaps.MishapBadItem -import at.petrak.hexcasting.api.spell.mishaps.MishapBadOffhandItem -import at.petrak.hexcasting.api.spell.mishaps.MishapOthersName +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.MishapBadItem +import at.petrak.hexcasting.api.casting.mishaps.MishapBadOffhandItem +import at.petrak.hexcasting.api.casting.mishaps.MishapOthersName import at.petrak.hexcasting.api.utils.extractMedia import at.petrak.hexcasting.api.utils.isMediaItem import at.petrak.hexcasting.common.items.magic.ItemPackagedHex diff --git a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/spells/OpPlaceBlock.kt b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/spells/OpPlaceBlock.kt index aac4bb6d..e887bad1 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/spells/OpPlaceBlock.kt +++ b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/spells/OpPlaceBlock.kt @@ -1,13 +1,13 @@ package at.petrak.hexcasting.common.casting.operators.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.getBlockPos -import at.petrak.hexcasting.api.spell.iota.Iota -import at.petrak.hexcasting.api.spell.mishaps.MishapBadBlock +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.getBlockPos +import at.petrak.hexcasting.api.casting.iota.Iota +import at.petrak.hexcasting.api.casting.mishaps.MishapBadBlock import at.petrak.hexcasting.xplat.IXplatAbstractions import net.minecraft.core.BlockPos import net.minecraft.core.particles.BlockParticleOption 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 87247d40..f52a3d82 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 @@ -1,8 +1,8 @@ package at.petrak.hexcasting.common.casting.operators.spells -import at.petrak.hexcasting.api.spell.* -import at.petrak.hexcasting.api.spell.casting.CastingContext -import at.petrak.hexcasting.api.spell.iota.Iota +import at.petrak.hexcasting.api.casting.* +import at.petrak.hexcasting.api.casting.eval.CastingContext +import at.petrak.hexcasting.api.casting.iota.Iota import net.minecraft.world.effect.MobEffect import net.minecraft.world.effect.MobEffectInstance import net.minecraft.world.entity.LivingEntity diff --git a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/spells/OpPrint.kt b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/spells/OpPrint.kt index 19aa205b..a1641041 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/spells/OpPrint.kt +++ b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/spells/OpPrint.kt @@ -1,13 +1,13 @@ package at.petrak.hexcasting.common.casting.operators.spells -import at.petrak.hexcasting.api.spell.Action -import at.petrak.hexcasting.api.spell.OperationResult -import at.petrak.hexcasting.api.spell.RenderedSpell -import at.petrak.hexcasting.api.spell.casting.CastingContext -import at.petrak.hexcasting.api.spell.casting.eval.SpellContinuation -import at.petrak.hexcasting.api.spell.casting.sideeffects.OperatorSideEffect -import at.petrak.hexcasting.api.spell.iota.Iota -import at.petrak.hexcasting.api.spell.mishaps.MishapNotEnoughArgs +import at.petrak.hexcasting.api.casting.Action +import at.petrak.hexcasting.api.casting.OperationResult +import at.petrak.hexcasting.api.casting.RenderedSpell +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.iota.Iota +import at.petrak.hexcasting.api.casting.mishaps.MishapNotEnoughArgs // TODO should this dump the whole stack object OpPrint : Action { diff --git a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/spells/OpRecharge.kt b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/spells/OpRecharge.kt index 17bc66eb..6ef3bf63 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/spells/OpRecharge.kt +++ b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/spells/OpRecharge.kt @@ -1,14 +1,14 @@ package at.petrak.hexcasting.common.casting.operators.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.getItemEntity -import at.petrak.hexcasting.api.spell.iota.Iota -import at.petrak.hexcasting.api.spell.mishaps.MishapBadItem -import at.petrak.hexcasting.api.spell.mishaps.MishapBadOffhandItem +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.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.utils.extractMedia import at.petrak.hexcasting.api.utils.isMediaItem import at.petrak.hexcasting.xplat.IXplatAbstractions diff --git a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/spells/OpTheOnlyReasonAnyoneDownloadedPsi.kt b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/spells/OpTheOnlyReasonAnyoneDownloadedPsi.kt index 30afc5d0..835f9507 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/spells/OpTheOnlyReasonAnyoneDownloadedPsi.kt +++ b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/spells/OpTheOnlyReasonAnyoneDownloadedPsi.kt @@ -1,12 +1,12 @@ package at.petrak.hexcasting.common.casting.operators.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.getBlockPos -import at.petrak.hexcasting.api.spell.iota.Iota +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.getBlockPos +import at.petrak.hexcasting.api.casting.iota.Iota import net.minecraft.core.BlockPos import net.minecraft.core.Direction import net.minecraft.world.InteractionHand 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 d9e3d9b0..8906eafa 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.spell.* -import at.petrak.hexcasting.api.spell.casting.CastingContext -import at.petrak.hexcasting.api.spell.iota.Iota -import at.petrak.hexcasting.api.spell.mishaps.MishapAlreadyBrainswept -import at.petrak.hexcasting.api.spell.mishaps.MishapBadBrainsweep +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.common.recipe.BrainsweepRecipe import at.petrak.hexcasting.common.recipe.HexRecipeStuffRegistry import at.petrak.hexcasting.ktxt.tellWitnessesThatIWasMurdered 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 a4c614e3..cf588d88 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 @@ -2,9 +2,9 @@ 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.spell.* -import at.petrak.hexcasting.api.spell.casting.CastingContext -import at.petrak.hexcasting.api.spell.iota.Iota +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.xplat.IXplatAbstractions import net.minecraft.server.level.ServerLevel import net.minecraft.server.level.ServerPlayer 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 45b0a0c8..6bd53a24 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.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.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 net.minecraft.core.BlockPos import net.minecraft.world.entity.EntityType import net.minecraft.world.entity.LightningBolt 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 1e27e3ea..add6032f 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 @@ -3,11 +3,11 @@ 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.spell.* -import at.petrak.hexcasting.api.spell.casting.CastingContext -import at.petrak.hexcasting.api.spell.iota.Iota -import at.petrak.hexcasting.api.spell.mishaps.MishapImmuneEntity -import at.petrak.hexcasting.api.spell.mishaps.MishapLocationTooFarAway +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.common.network.MsgBlinkAck import at.petrak.hexcasting.xplat.IXplatAbstractions import net.minecraft.core.BlockPos 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 d81a12fe..73273c32 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,11 +1,11 @@ package at.petrak.hexcasting.common.casting.operators.spells.great 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.iota.Iota -import at.petrak.hexcasting.api.spell.SpellAction -import at.petrak.hexcasting.api.spell.casting.CastingContext +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 class OpWeather(val rain: Boolean) : SpellAction { override val argc = 0 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 b1a97ca2..72062551 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 @@ -2,12 +2,12 @@ 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.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.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.xplat.IXplatAbstractions import net.minecraft.world.phys.Vec3 diff --git a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/spells/sentinel/OpDestroySentinel.kt b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/spells/sentinel/OpDestroySentinel.kt index 876aceee..16a73361 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/spells/sentinel/OpDestroySentinel.kt +++ b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/spells/sentinel/OpDestroySentinel.kt @@ -3,12 +3,12 @@ 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.spell.ParticleSpray -import at.petrak.hexcasting.api.spell.RenderedSpell -import at.petrak.hexcasting.api.spell.iota.Iota -import at.petrak.hexcasting.api.spell.SpellAction -import at.petrak.hexcasting.api.spell.casting.CastingContext -import at.petrak.hexcasting.api.spell.mishaps.MishapLocationInWrongDimension +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.mishaps.MishapLocationInWrongDimension import at.petrak.hexcasting.xplat.IXplatAbstractions object OpDestroySentinel : SpellAction { diff --git a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/spells/sentinel/OpGetSentinelPos.kt b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/spells/sentinel/OpGetSentinelPos.kt index 089d8d5d..6a32e48f 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/spells/sentinel/OpGetSentinelPos.kt +++ b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/spells/sentinel/OpGetSentinelPos.kt @@ -1,12 +1,12 @@ package at.petrak.hexcasting.common.casting.operators.spells.sentinel import at.petrak.hexcasting.api.misc.MediaConstants -import at.petrak.hexcasting.api.spell.ConstMediaAction -import at.petrak.hexcasting.api.spell.asActionResult -import at.petrak.hexcasting.api.spell.casting.CastingContext -import at.petrak.hexcasting.api.spell.iota.Iota -import at.petrak.hexcasting.api.spell.iota.NullIota -import at.petrak.hexcasting.api.spell.mishaps.MishapLocationInWrongDimension +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.casting.iota.NullIota +import at.petrak.hexcasting.api.casting.mishaps.MishapLocationInWrongDimension import at.petrak.hexcasting.xplat.IXplatAbstractions object OpGetSentinelPos : ConstMediaAction { diff --git a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/spells/sentinel/OpGetSentinelWayfind.kt b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/spells/sentinel/OpGetSentinelWayfind.kt index 30b0a161..959b223f 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/spells/sentinel/OpGetSentinelWayfind.kt +++ b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/spells/sentinel/OpGetSentinelWayfind.kt @@ -1,13 +1,13 @@ package at.petrak.hexcasting.common.casting.operators.spells.sentinel import at.petrak.hexcasting.api.misc.MediaConstants -import at.petrak.hexcasting.api.spell.ConstMediaAction -import at.petrak.hexcasting.api.spell.asActionResult -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.api.spell.iota.NullIota -import at.petrak.hexcasting.api.spell.mishaps.MishapLocationInWrongDimension +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.getVec3 +import at.petrak.hexcasting.api.casting.iota.Iota +import at.petrak.hexcasting.api.casting.iota.NullIota +import at.petrak.hexcasting.api.casting.mishaps.MishapLocationInWrongDimension import at.petrak.hexcasting.xplat.IXplatAbstractions // TODO I don't think anyone has ever used this operation in the history of the world. diff --git a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/stack/OpAlwinfyHasAscendedToABeingOfPureMath.kt b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/stack/OpAlwinfyHasAscendedToABeingOfPureMath.kt index 6a4c4136..1bbb868a 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/stack/OpAlwinfyHasAscendedToABeingOfPureMath.kt +++ b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/stack/OpAlwinfyHasAscendedToABeingOfPureMath.kt @@ -1,12 +1,12 @@ package at.petrak.hexcasting.common.casting.operators.stack -import at.petrak.hexcasting.api.spell.Action -import at.petrak.hexcasting.api.spell.OperationResult -import at.petrak.hexcasting.api.spell.casting.CastingContext -import at.petrak.hexcasting.api.spell.casting.eval.SpellContinuation -import at.petrak.hexcasting.api.spell.getPositiveInt -import at.petrak.hexcasting.api.spell.iota.Iota -import at.petrak.hexcasting.api.spell.mishaps.MishapNotEnoughArgs +import at.petrak.hexcasting.api.casting.Action +import at.petrak.hexcasting.api.casting.OperationResult +import at.petrak.hexcasting.api.casting.eval.CastingContext +import at.petrak.hexcasting.api.casting.eval.vm.SpellContinuation +import at.petrak.hexcasting.api.casting.getPositiveInt +import at.petrak.hexcasting.api.casting.iota.Iota +import at.petrak.hexcasting.api.casting.mishaps.MishapNotEnoughArgs import it.unimi.dsi.fastutil.ints.IntArrayList // "lehmer code" diff --git a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/stack/OpBitMask.kt b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/stack/OpBitMask.kt index 8483bfc6..8dc36510 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/stack/OpBitMask.kt +++ b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/stack/OpBitMask.kt @@ -1,12 +1,12 @@ package at.petrak.hexcasting.common.casting.operators.stack -import at.petrak.hexcasting.api.spell.Action -import at.petrak.hexcasting.api.spell.OperationResult -import at.petrak.hexcasting.api.spell.casting.CastingContext -import at.petrak.hexcasting.api.spell.casting.eval.SpellContinuation -import at.petrak.hexcasting.api.spell.getPositiveInt -import at.petrak.hexcasting.api.spell.iota.Iota -import at.petrak.hexcasting.api.spell.mishaps.MishapNotEnoughArgs +import at.petrak.hexcasting.api.casting.Action +import at.petrak.hexcasting.api.casting.OperationResult +import at.petrak.hexcasting.api.casting.eval.CastingContext +import at.petrak.hexcasting.api.casting.eval.vm.SpellContinuation +import at.petrak.hexcasting.api.casting.getPositiveInt +import at.petrak.hexcasting.api.casting.iota.Iota +import at.petrak.hexcasting.api.casting.mishaps.MishapNotEnoughArgs // Yes this is weird in that 1=remove, 0=keep, but i think the UX is better // todo this is untested diff --git a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/stack/OpDuplicateN.kt b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/stack/OpDuplicateN.kt index 9e1b8285..92e77934 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/stack/OpDuplicateN.kt +++ b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/stack/OpDuplicateN.kt @@ -1,10 +1,10 @@ package at.petrak.hexcasting.common.casting.operators.stack -import at.petrak.hexcasting.api.spell.ConstMediaAction -import at.petrak.hexcasting.api.spell.casting.CastingContext -import at.petrak.hexcasting.api.spell.getPositiveInt -import at.petrak.hexcasting.api.spell.iota.Iota -import at.petrak.hexcasting.api.spell.mishaps.MishapShameOnYou +import at.petrak.hexcasting.api.casting.ConstMediaAction +import at.petrak.hexcasting.api.casting.eval.CastingContext +import at.petrak.hexcasting.api.casting.getPositiveInt +import at.petrak.hexcasting.api.casting.iota.Iota +import at.petrak.hexcasting.api.casting.mishaps.MishapShameOnYou object OpDuplicateN : ConstMediaAction { override val argc: Int diff --git a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/stack/OpFisherman.kt b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/stack/OpFisherman.kt index 22909d89..650ed54a 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/stack/OpFisherman.kt +++ b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/stack/OpFisherman.kt @@ -1,13 +1,13 @@ package at.petrak.hexcasting.common.casting.operators.stack -import at.petrak.hexcasting.api.spell.Action -import at.petrak.hexcasting.api.spell.OperationResult -import at.petrak.hexcasting.api.spell.casting.CastingContext -import at.petrak.hexcasting.api.spell.casting.eval.SpellContinuation -import at.petrak.hexcasting.api.spell.iota.DoubleIota -import at.petrak.hexcasting.api.spell.iota.Iota -import at.petrak.hexcasting.api.spell.mishaps.MishapInvalidIota -import at.petrak.hexcasting.api.spell.mishaps.MishapNotEnoughArgs +import at.petrak.hexcasting.api.casting.Action +import at.petrak.hexcasting.api.casting.OperationResult +import at.petrak.hexcasting.api.casting.eval.CastingContext +import at.petrak.hexcasting.api.casting.eval.vm.SpellContinuation +import at.petrak.hexcasting.api.casting.iota.DoubleIota +import at.petrak.hexcasting.api.casting.iota.Iota +import at.petrak.hexcasting.api.casting.mishaps.MishapInvalidIota +import at.petrak.hexcasting.api.casting.mishaps.MishapNotEnoughArgs import kotlin.math.abs import kotlin.math.roundToInt diff --git a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/stack/OpFishermanButItCopies.kt b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/stack/OpFishermanButItCopies.kt index f78fe7be..70066b2d 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/stack/OpFishermanButItCopies.kt +++ b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/stack/OpFishermanButItCopies.kt @@ -1,12 +1,12 @@ package at.petrak.hexcasting.common.casting.operators.stack -import at.petrak.hexcasting.api.spell.Action -import at.petrak.hexcasting.api.spell.OperationResult -import at.petrak.hexcasting.api.spell.casting.CastingContext -import at.petrak.hexcasting.api.spell.casting.eval.SpellContinuation -import at.petrak.hexcasting.api.spell.getPositiveIntUnderInclusive -import at.petrak.hexcasting.api.spell.iota.Iota -import at.petrak.hexcasting.api.spell.mishaps.MishapNotEnoughArgs +import at.petrak.hexcasting.api.casting.Action +import at.petrak.hexcasting.api.casting.OperationResult +import at.petrak.hexcasting.api.casting.eval.CastingContext +import at.petrak.hexcasting.api.casting.eval.vm.SpellContinuation +import at.petrak.hexcasting.api.casting.getPositiveIntUnderInclusive +import at.petrak.hexcasting.api.casting.iota.Iota +import at.petrak.hexcasting.api.casting.mishaps.MishapNotEnoughArgs object OpFishermanButItCopies : Action { override fun operate( diff --git a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/stack/OpMask.kt b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/stack/OpMask.kt index 797d860d..2cf5289c 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/stack/OpMask.kt +++ b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/stack/OpMask.kt @@ -1,12 +1,9 @@ package at.petrak.hexcasting.common.casting.operators.stack -import at.petrak.hexcasting.api.spell.ConstMediaAction -import at.petrak.hexcasting.api.spell.iota.Iota -import at.petrak.hexcasting.api.spell.casting.CastingContext -import at.petrak.hexcasting.api.utils.asTranslatedComponent -import at.petrak.hexcasting.api.utils.lightPurple +import at.petrak.hexcasting.api.casting.ConstMediaAction +import at.petrak.hexcasting.api.casting.eval.CastingContext +import at.petrak.hexcasting.api.casting.iota.Iota import it.unimi.dsi.fastutil.booleans.BooleanList -import net.minecraft.network.chat.Component import net.minecraft.resources.ResourceLocation class OpMask(val mask: BooleanList, val key: ResourceLocation) : ConstMediaAction { @@ -21,7 +18,4 @@ class OpMask(val mask: BooleanList, val key: ResourceLocation) : ConstMediaActio } return out } - - override val displayName: Component - get() = "hexcasting.spell.$key".asTranslatedComponent(mask.map { if (it) '-' else 'v' }.joinToString("")).lightPurple } diff --git a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/stack/OpStackSize.kt b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/stack/OpStackSize.kt index a53fc0c5..75c8a687 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/stack/OpStackSize.kt +++ b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/stack/OpStackSize.kt @@ -1,11 +1,11 @@ package at.petrak.hexcasting.common.casting.operators.stack -import at.petrak.hexcasting.api.spell.Action -import at.petrak.hexcasting.api.spell.OperationResult -import at.petrak.hexcasting.api.spell.casting.CastingContext -import at.petrak.hexcasting.api.spell.casting.eval.SpellContinuation -import at.petrak.hexcasting.api.spell.iota.DoubleIota -import at.petrak.hexcasting.api.spell.iota.Iota +import at.petrak.hexcasting.api.casting.Action +import at.petrak.hexcasting.api.casting.OperationResult +import at.petrak.hexcasting.api.casting.eval.CastingContext +import at.petrak.hexcasting.api.casting.eval.vm.SpellContinuation +import at.petrak.hexcasting.api.casting.iota.DoubleIota +import at.petrak.hexcasting.api.casting.iota.Iota object OpStackSize : Action { override fun operate( diff --git a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/stack/OpTwiddling.kt b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/stack/OpTwiddling.kt index 76103535..d1191871 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/stack/OpTwiddling.kt +++ b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/stack/OpTwiddling.kt @@ -1,8 +1,8 @@ package at.petrak.hexcasting.common.casting.operators.stack -import at.petrak.hexcasting.api.spell.ConstMediaAction -import at.petrak.hexcasting.api.spell.casting.CastingContext -import at.petrak.hexcasting.api.spell.iota.Iota +import at.petrak.hexcasting.api.casting.ConstMediaAction +import at.petrak.hexcasting.api.casting.eval.CastingContext +import at.petrak.hexcasting.api.casting.iota.Iota class OpTwiddling(val argumentCount: Int, val lookup: IntArray) : ConstMediaAction { override val argc: Int diff --git a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/stack/SpecialHandlerMask.kt b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/stack/SpecialHandlerMask.kt new file mode 100644 index 00000000..6f71a36b --- /dev/null +++ b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/stack/SpecialHandlerMask.kt @@ -0,0 +1,84 @@ +package at.petrak.hexcasting.common.casting.operators.stack + +import at.petrak.hexcasting.api.HexAPI +import at.petrak.hexcasting.api.HexAPI.modLoc +import at.petrak.hexcasting.api.casting.Action +import at.petrak.hexcasting.api.casting.ConstMediaAction +import at.petrak.hexcasting.api.casting.SpecialHandler +import at.petrak.hexcasting.api.casting.eval.CastingContext +import at.petrak.hexcasting.api.casting.iota.Iota +import at.petrak.hexcasting.api.casting.math.HexAngle +import at.petrak.hexcasting.api.casting.math.HexPattern +import at.petrak.hexcasting.api.utils.asTranslatedComponent +import at.petrak.hexcasting.api.utils.lightPurple +import it.unimi.dsi.fastutil.booleans.BooleanArrayList +import it.unimi.dsi.fastutil.booleans.BooleanList +import net.minecraft.network.chat.Component +import net.minecraft.resources.ResourceLocation + +class SpecialHandlerMask(val mask: BooleanList) : SpecialHandler() { + override fun act(): Action { + return InnerAction(this.mask) + } + + override fun getName(): Component { + return HexAPI.instance().getActionI18nKey(NAME) + .asTranslatedComponent(mask.map { if (it) '-' else 'v' }.joinToString("")) + .lightPurple + } + + class InnerAction(val mask: BooleanList) : ConstMediaAction { + override val argc: Int + get() = this.mask.size + + override fun execute(args: List, ctx: CastingContext): List { + val out = ArrayList(this.mask.size) + for ((i, include) in this.mask.withIndex()) { + if (include) + out.add(args[i]) + } + return out + } + } + + class Factory : SpecialHandler.Factory { + override fun tryMatch(pat: HexPattern): SpecialHandlerMask? { + val directions = pat.directions() + + var flatDir = pat.startDir + if (pat.angles.isNotEmpty() && pat.angles[0] == HexAngle.LEFT_BACK) { + flatDir = directions[0].rotatedBy(HexAngle.LEFT); + } + + // TODO: we could probably definitely do this with a long to make it faster + val mask = BooleanArrayList() + var i = 0; + while (i < directions.size) { + // Angle with respect to the *start direction* + val angle = directions[i].angleFrom(flatDir); + if (angle == HexAngle.FORWARD) { + mask.add(true) + i++ + continue; + } + if (i >= directions.size - 1) { + // then we're out of angles! + return null + } + val angle2 = directions[i + 1].angleFrom(flatDir); + if (angle == HexAngle.RIGHT && angle2 == HexAngle.LEFT) { + mask.add(false) + // skip both segments of the dip + i += 2 + continue + } + return null + } + return SpecialHandlerMask(mask) + } + } + + companion object { + public val NAME: ResourceLocation = modLoc("mask") + } +} \ No newline at end of file diff --git a/Common/src/main/java/at/petrak/hexcasting/common/command/ListPatternsCommand.java b/Common/src/main/java/at/petrak/hexcasting/common/command/ListPatternsCommand.java index 3114896c..9895cbb1 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/command/ListPatternsCommand.java +++ b/Common/src/main/java/at/petrak/hexcasting/common/command/ListPatternsCommand.java @@ -1,8 +1,8 @@ package at.petrak.hexcasting.common.command; -import at.petrak.hexcasting.api.PatternRegistry; -import at.petrak.hexcasting.api.spell.iota.PatternIota; -import at.petrak.hexcasting.api.spell.math.HexPattern; +import at.petrak.hexcasting.common.casting.PatternRegistryManifest; +import at.petrak.hexcasting.api.casting.iota.PatternIota; +import at.petrak.hexcasting.api.casting.math.HexPattern; import at.petrak.hexcasting.common.items.ItemScroll; import at.petrak.hexcasting.common.lib.HexItems; import com.mojang.brigadier.builder.LiteralArgumentBuilder; @@ -57,7 +57,7 @@ public class ListPatternsCommand { } private static int list(CommandSourceStack source) { - var lookup = PatternRegistry.getPerWorldPatterns(source.getLevel()); + var lookup = PatternRegistryManifest.getPerWorldPatterns(source.getLevel()); var listing = lookup.entrySet() .stream() .sorted((a, b) -> compareResLoc(a.getValue().getFirst(), b.getValue().getFirst())) @@ -77,7 +77,7 @@ public class ListPatternsCommand { private static int giveAll(CommandSourceStack source, Collection targets) { if (!targets.isEmpty()) { - var lookup = PatternRegistry.getPerWorldPatterns(source.getLevel()); + var lookup = PatternRegistryManifest.getPerWorldPatterns(source.getLevel()); lookup.forEach((sig, entry) -> { var opId = entry.getFirst(); diff --git a/Common/src/main/java/at/petrak/hexcasting/common/command/PatternResLocArgument.java b/Common/src/main/java/at/petrak/hexcasting/common/command/PatternResLocArgument.java index baaeca6c..901dd7a5 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/command/PatternResLocArgument.java +++ b/Common/src/main/java/at/petrak/hexcasting/common/command/PatternResLocArgument.java @@ -1,7 +1,7 @@ package at.petrak.hexcasting.common.command; -import at.petrak.hexcasting.api.PatternRegistry; -import at.petrak.hexcasting.api.spell.math.HexPattern; +import at.petrak.hexcasting.common.casting.PatternRegistryManifest; +import at.petrak.hexcasting.api.casting.math.HexPattern; import com.mojang.brigadier.context.CommandContext; import com.mojang.brigadier.exceptions.CommandSyntaxException; import com.mojang.brigadier.exceptions.DynamicCommandExceptionType; @@ -28,13 +28,13 @@ public class PatternResLocArgument extends ResourceLocationArgument { @Override public CompletableFuture listSuggestions(CommandContext context, SuggestionsBuilder builder) { return SharedSuggestionProvider.suggest( - PatternRegistry.getAllPerWorldPatternNames().stream().map(Object::toString), builder); + PatternRegistryManifest.getAllPerWorldPatternNames().stream().map(Object::toString), builder); } public static HexPattern getPattern( CommandContext ctx, String pName) throws CommandSyntaxException { var targetId = ctx.getArgument(pName, ResourceLocation.class); - var lookup = PatternRegistry.getPerWorldPatterns(ctx.getSource().getLevel()); + var lookup = PatternRegistryManifest.getPerWorldPatterns(ctx.getSource().getLevel()); HexPattern foundPat = null; for (var sig : lookup.keySet()) { var rhs = lookup.get(sig); diff --git a/Common/src/main/java/at/petrak/hexcasting/common/command/RecalcPatternsCommand.java b/Common/src/main/java/at/petrak/hexcasting/common/command/RecalcPatternsCommand.java index 936130e0..500f71d4 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/command/RecalcPatternsCommand.java +++ b/Common/src/main/java/at/petrak/hexcasting/common/command/RecalcPatternsCommand.java @@ -1,6 +1,6 @@ package at.petrak.hexcasting.common.command; -import at.petrak.hexcasting.api.PatternRegistry; +import at.petrak.hexcasting.common.casting.PatternRegistryManifest; import com.mojang.brigadier.builder.LiteralArgumentBuilder; import net.minecraft.commands.CommandSourceStack; import net.minecraft.commands.Commands; @@ -13,7 +13,8 @@ public class RecalcPatternsCommand { .executes(ctx -> { var world = ctx.getSource().getServer().overworld(); var ds = world.getDataStorage(); - ds.set(PatternRegistry.TAG_SAVED_DATA, PatternRegistry.Save.create(world.getSeed())); + ds.set(PatternRegistryManifest.TAG_SAVED_DATA, + PatternRegistryManifest.ScrungledPatternsSave.create(world.getSeed())); ctx.getSource().sendSuccess( Component.translatable("command.hexcasting.recalc"), true); diff --git a/Common/src/main/java/at/petrak/hexcasting/common/entities/EntityWallScroll.java b/Common/src/main/java/at/petrak/hexcasting/common/entities/EntityWallScroll.java index f9b6ef14..116247cc 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/entities/EntityWallScroll.java +++ b/Common/src/main/java/at/petrak/hexcasting/common/entities/EntityWallScroll.java @@ -1,6 +1,6 @@ package at.petrak.hexcasting.common.entities; -import at.petrak.hexcasting.api.spell.math.HexPattern; +import at.petrak.hexcasting.api.casting.math.HexPattern; import at.petrak.hexcasting.api.utils.HexUtils; import at.petrak.hexcasting.api.utils.NBTHelper; import at.petrak.hexcasting.client.RenderLib; diff --git a/Common/src/main/java/at/petrak/hexcasting/common/impl/HexAPIImpl.java b/Common/src/main/java/at/petrak/hexcasting/common/impl/HexAPIImpl.java new file mode 100644 index 00000000..4e60c933 --- /dev/null +++ b/Common/src/main/java/at/petrak/hexcasting/common/impl/HexAPIImpl.java @@ -0,0 +1,6 @@ +package at.petrak.hexcasting.common.impl; + +import at.petrak.hexcasting.api.HexAPI; + +public class HexAPIImpl implements HexAPI { +} diff --git a/Common/src/main/java/at/petrak/hexcasting/common/items/ItemAbacus.java b/Common/src/main/java/at/petrak/hexcasting/common/items/ItemAbacus.java index 39f30c25..8c933e68 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/items/ItemAbacus.java +++ b/Common/src/main/java/at/petrak/hexcasting/common/items/ItemAbacus.java @@ -1,8 +1,8 @@ package at.petrak.hexcasting.common.items; import at.petrak.hexcasting.api.item.IotaHolderItem; -import at.petrak.hexcasting.api.spell.iota.DoubleIota; -import at.petrak.hexcasting.api.spell.iota.Iota; +import at.petrak.hexcasting.api.casting.iota.DoubleIota; +import at.petrak.hexcasting.api.casting.iota.Iota; import at.petrak.hexcasting.api.utils.NBTHelper; import at.petrak.hexcasting.common.lib.hex.HexIotaTypes; import at.petrak.hexcasting.common.lib.HexSounds; diff --git a/Common/src/main/java/at/petrak/hexcasting/common/items/ItemFocus.java b/Common/src/main/java/at/petrak/hexcasting/common/items/ItemFocus.java index 1fb7bc66..a736e40d 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/items/ItemFocus.java +++ b/Common/src/main/java/at/petrak/hexcasting/common/items/ItemFocus.java @@ -1,8 +1,8 @@ package at.petrak.hexcasting.common.items; import at.petrak.hexcasting.api.item.IotaHolderItem; -import at.petrak.hexcasting.api.spell.iota.Iota; -import at.petrak.hexcasting.api.spell.iota.NullIota; +import at.petrak.hexcasting.api.casting.iota.Iota; +import at.petrak.hexcasting.api.casting.iota.NullIota; import at.petrak.hexcasting.api.utils.NBTHelper; import at.petrak.hexcasting.common.lib.hex.HexIotaTypes; import net.minecraft.nbt.CompoundTag; diff --git a/Common/src/main/java/at/petrak/hexcasting/common/items/ItemScroll.java b/Common/src/main/java/at/petrak/hexcasting/common/items/ItemScroll.java index f045f14a..64f57c77 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/items/ItemScroll.java +++ b/Common/src/main/java/at/petrak/hexcasting/common/items/ItemScroll.java @@ -1,9 +1,9 @@ package at.petrak.hexcasting.common.items; import at.petrak.hexcasting.api.item.IotaHolderItem; -import at.petrak.hexcasting.api.spell.iota.Iota; -import at.petrak.hexcasting.api.spell.iota.PatternIota; -import at.petrak.hexcasting.api.spell.math.HexPattern; +import at.petrak.hexcasting.api.casting.iota.Iota; +import at.petrak.hexcasting.api.casting.iota.PatternIota; +import at.petrak.hexcasting.api.casting.math.HexPattern; import at.petrak.hexcasting.api.utils.NBTHelper; import at.petrak.hexcasting.client.gui.PatternTooltipComponent; import at.petrak.hexcasting.common.entities.EntityWallScroll; diff --git a/Common/src/main/java/at/petrak/hexcasting/common/items/ItemSlate.java b/Common/src/main/java/at/petrak/hexcasting/common/items/ItemSlate.java index c40fe80a..8d388139 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/items/ItemSlate.java +++ b/Common/src/main/java/at/petrak/hexcasting/common/items/ItemSlate.java @@ -3,9 +3,9 @@ package at.petrak.hexcasting.common.items; import at.petrak.hexcasting.annotations.SoftImplement; import at.petrak.hexcasting.api.HexAPI; import at.petrak.hexcasting.api.item.IotaHolderItem; -import at.petrak.hexcasting.api.spell.iota.Iota; -import at.petrak.hexcasting.api.spell.iota.PatternIota; -import at.petrak.hexcasting.api.spell.math.HexPattern; +import at.petrak.hexcasting.api.casting.iota.Iota; +import at.petrak.hexcasting.api.casting.iota.PatternIota; +import at.petrak.hexcasting.api.casting.math.HexPattern; import at.petrak.hexcasting.api.utils.NBTHelper; import at.petrak.hexcasting.client.gui.PatternTooltipComponent; import at.petrak.hexcasting.common.blocks.circles.BlockEntitySlate; diff --git a/Common/src/main/java/at/petrak/hexcasting/common/items/ItemSpellbook.java b/Common/src/main/java/at/petrak/hexcasting/common/items/ItemSpellbook.java index a639241b..f05bcc4b 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/items/ItemSpellbook.java +++ b/Common/src/main/java/at/petrak/hexcasting/common/items/ItemSpellbook.java @@ -1,8 +1,8 @@ package at.petrak.hexcasting.common.items; import at.petrak.hexcasting.api.item.IotaHolderItem; -import at.petrak.hexcasting.api.spell.iota.Iota; -import at.petrak.hexcasting.api.spell.iota.NullIota; +import at.petrak.hexcasting.api.casting.iota.Iota; +import at.petrak.hexcasting.api.casting.iota.NullIota; import at.petrak.hexcasting.api.utils.NBTHelper; import at.petrak.hexcasting.common.lib.hex.HexIotaTypes; import net.minecraft.ChatFormatting; diff --git a/Common/src/main/java/at/petrak/hexcasting/common/items/magic/ItemPackagedHex.java b/Common/src/main/java/at/petrak/hexcasting/common/items/magic/ItemPackagedHex.java index 9963a9d3..cb83ddc2 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/items/magic/ItemPackagedHex.java +++ b/Common/src/main/java/at/petrak/hexcasting/common/items/magic/ItemPackagedHex.java @@ -1,9 +1,9 @@ package at.petrak.hexcasting.common.items.magic; import at.petrak.hexcasting.api.item.HexHolderItem; -import at.petrak.hexcasting.api.spell.casting.CastingContext; -import at.petrak.hexcasting.api.spell.casting.CastingHarness; -import at.petrak.hexcasting.api.spell.iota.Iota; +import at.petrak.hexcasting.api.casting.eval.CastingContext; +import at.petrak.hexcasting.api.casting.eval.CastingHarness; +import at.petrak.hexcasting.api.casting.iota.Iota; import at.petrak.hexcasting.api.utils.NBTHelper; import at.petrak.hexcasting.common.lib.hex.HexIotaTypes; import net.minecraft.nbt.CompoundTag; 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 f3ff1ee6..eabd4769 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 @@ -1,14 +1,14 @@ package at.petrak.hexcasting.common.lib.hex; import at.petrak.hexcasting.api.misc.MediaConstants; -import at.petrak.hexcasting.api.spell.Action; -import at.petrak.hexcasting.api.spell.ActionRegistryEntry; -import at.petrak.hexcasting.api.spell.iota.BooleanIota; -import at.petrak.hexcasting.api.spell.iota.DoubleIota; -import at.petrak.hexcasting.api.spell.iota.NullIota; -import at.petrak.hexcasting.api.spell.iota.Vec3Iota; -import at.petrak.hexcasting.api.spell.math.HexDir; -import at.petrak.hexcasting.api.spell.math.HexPattern; +import at.petrak.hexcasting.api.casting.Action; +import at.petrak.hexcasting.api.casting.ActionRegistryEntry; +import at.petrak.hexcasting.api.casting.iota.BooleanIota; +import at.petrak.hexcasting.api.casting.iota.DoubleIota; +import at.petrak.hexcasting.api.casting.iota.NullIota; +import at.petrak.hexcasting.api.casting.iota.Vec3Iota; +import at.petrak.hexcasting.api.casting.math.HexDir; +import at.petrak.hexcasting.api.casting.math.HexPattern; import at.petrak.hexcasting.api.utils.HexUtils; import at.petrak.hexcasting.common.casting.operators.*; import at.petrak.hexcasting.common.casting.operators.akashic.OpAkashicRead; diff --git a/Common/src/main/java/at/petrak/hexcasting/common/lib/hex/HexEvalSounds.java b/Common/src/main/java/at/petrak/hexcasting/common/lib/hex/HexEvalSounds.java index 2c9cf99f..a711146b 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/lib/hex/HexEvalSounds.java +++ b/Common/src/main/java/at/petrak/hexcasting/common/lib/hex/HexEvalSounds.java @@ -1,6 +1,6 @@ package at.petrak.hexcasting.common.lib.hex; -import at.petrak.hexcasting.api.spell.casting.sideeffects.EvalSound; +import at.petrak.hexcasting.api.casting.eval.sideeffects.EvalSound; import at.petrak.hexcasting.common.lib.HexSounds; import at.petrak.hexcasting.xplat.IXplatAbstractions; import net.minecraft.core.Registry; diff --git a/Common/src/main/java/at/petrak/hexcasting/common/lib/hex/HexIotaTypes.java b/Common/src/main/java/at/petrak/hexcasting/common/lib/hex/HexIotaTypes.java index cb1548fd..5109c087 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/lib/hex/HexIotaTypes.java +++ b/Common/src/main/java/at/petrak/hexcasting/common/lib/hex/HexIotaTypes.java @@ -1,7 +1,7 @@ package at.petrak.hexcasting.common.lib.hex; import at.petrak.hexcasting.api.HexAPI; -import at.petrak.hexcasting.api.spell.iota.*; +import at.petrak.hexcasting.api.casting.iota.*; import at.petrak.hexcasting.api.utils.HexUtils; import at.petrak.hexcasting.xplat.IXplatAbstractions; import com.mojang.datafixers.util.Pair; diff --git a/Common/src/main/java/at/petrak/hexcasting/common/lib/hex/HexSpecialHandlers.java b/Common/src/main/java/at/petrak/hexcasting/common/lib/hex/HexSpecialHandlers.java new file mode 100644 index 00000000..f31f3044 --- /dev/null +++ b/Common/src/main/java/at/petrak/hexcasting/common/lib/hex/HexSpecialHandlers.java @@ -0,0 +1,42 @@ +package at.petrak.hexcasting.common.lib.hex; + +import at.petrak.hexcasting.api.casting.SpecialHandler; +import at.petrak.hexcasting.common.casting.operators.math.SpecialHandlerNumberLiteral; +import at.petrak.hexcasting.common.casting.operators.stack.SpecialHandlerMask; +import at.petrak.hexcasting.xplat.IXplatAbstractions; +import net.minecraft.core.Registry; +import net.minecraft.resources.ResourceLocation; + +import java.util.LinkedHashMap; +import java.util.Map; +import java.util.function.BiConsumer; + +import static at.petrak.hexcasting.api.HexAPI.modLoc; + +public class HexSpecialHandlers { + public static final Registry> REGISTRY = + IXplatAbstractions.INSTANCE.getSpecialHandlerRegistry(); + + private static final Map> SPECIAL_HANDLERS = new LinkedHashMap<>(); + + public static final SpecialHandler.Factory NUMBER = make("number", + new SpecialHandlerNumberLiteral.Factory()); + public static final SpecialHandler.Factory MASK = make("mask", + new SpecialHandlerMask.Factory()); + + private static SpecialHandler.Factory make(String name, + SpecialHandler.Factory handler) { + var old = SPECIAL_HANDLERS.put(modLoc(name), handler); + if (old != null) { + throw new IllegalArgumentException("Typo? Duplicate id " + name); + } + return handler; + } + + public static void register() { + BiConsumer, ResourceLocation> r = (type, id) -> Registry.register(REGISTRY, id, type); + for (var e : SPECIAL_HANDLERS.entrySet()) { + r.accept(e.getValue(), e.getKey()); + } + } +} diff --git a/Common/src/main/java/at/petrak/hexcasting/common/loot/PatternScrollFunc.java b/Common/src/main/java/at/petrak/hexcasting/common/loot/PatternScrollFunc.java index 78f48955..06cc8287 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/loot/PatternScrollFunc.java +++ b/Common/src/main/java/at/petrak/hexcasting/common/loot/PatternScrollFunc.java @@ -1,7 +1,7 @@ package at.petrak.hexcasting.common.loot; -import at.petrak.hexcasting.api.PatternRegistry; -import at.petrak.hexcasting.api.spell.math.HexPattern; +import at.petrak.hexcasting.common.casting.PatternRegistryManifest; +import at.petrak.hexcasting.api.casting.math.HexPattern; import at.petrak.hexcasting.common.items.ItemScroll; import at.petrak.hexcasting.common.lib.HexLootFunctions; import com.google.gson.JsonDeserializationContext; @@ -22,7 +22,7 @@ public class PatternScrollFunc extends LootItemConditionalFunction { @Override protected ItemStack run(ItemStack stack, LootContext ctx) { var rand = ctx.getRandom(); - var worldLookup = PatternRegistry.getPerWorldPatterns(ctx.getLevel()); + var worldLookup = PatternRegistryManifest.getPerWorldPatterns(ctx.getLevel()); var keys = worldLookup.keySet().stream().toList(); var sig = keys.get(rand.nextInt(keys.size())); diff --git a/Common/src/main/java/at/petrak/hexcasting/common/misc/PatternTooltip.java b/Common/src/main/java/at/petrak/hexcasting/common/misc/PatternTooltip.java index 5d4e0dd5..0ed28e13 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/misc/PatternTooltip.java +++ b/Common/src/main/java/at/petrak/hexcasting/common/misc/PatternTooltip.java @@ -1,6 +1,6 @@ package at.petrak.hexcasting.common.misc; -import at.petrak.hexcasting.api.spell.math.HexPattern; +import at.petrak.hexcasting.api.casting.math.HexPattern; import net.minecraft.resources.ResourceLocation; import net.minecraft.world.inventory.tooltip.TooltipComponent; diff --git a/Common/src/main/java/at/petrak/hexcasting/common/network/MsgCastParticleAck.java b/Common/src/main/java/at/petrak/hexcasting/common/network/MsgCastParticleAck.java index a9d68b86..3a16b176 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/network/MsgCastParticleAck.java +++ b/Common/src/main/java/at/petrak/hexcasting/common/network/MsgCastParticleAck.java @@ -1,7 +1,7 @@ package at.petrak.hexcasting.common.network; import at.petrak.hexcasting.api.misc.FrozenColorizer; -import at.petrak.hexcasting.api.spell.ParticleSpray; +import at.petrak.hexcasting.api.casting.ParticleSpray; import at.petrak.hexcasting.common.particles.ConjureParticleOptions; import io.netty.buffer.ByteBuf; import net.minecraft.client.Minecraft; diff --git a/Common/src/main/java/at/petrak/hexcasting/common/network/MsgNewSpellPatternAck.java b/Common/src/main/java/at/petrak/hexcasting/common/network/MsgNewSpellPatternAck.java index 3b9388be..125bec2a 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/network/MsgNewSpellPatternAck.java +++ b/Common/src/main/java/at/petrak/hexcasting/common/network/MsgNewSpellPatternAck.java @@ -1,7 +1,7 @@ package at.petrak.hexcasting.common.network; -import at.petrak.hexcasting.api.spell.casting.ControllerInfo; -import at.petrak.hexcasting.api.spell.casting.ResolvedPatternType; +import at.petrak.hexcasting.api.casting.eval.ControllerInfo; +import at.petrak.hexcasting.api.casting.eval.ResolvedPatternType; import at.petrak.hexcasting.client.gui.GuiSpellcasting; import at.petrak.hexcasting.common.lib.HexSounds; import io.netty.buffer.ByteBuf; diff --git a/Common/src/main/java/at/petrak/hexcasting/common/network/MsgNewSpellPatternSyn.java b/Common/src/main/java/at/petrak/hexcasting/common/network/MsgNewSpellPatternSyn.java index 08736209..4b89d8a2 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/network/MsgNewSpellPatternSyn.java +++ b/Common/src/main/java/at/petrak/hexcasting/common/network/MsgNewSpellPatternSyn.java @@ -2,12 +2,12 @@ package at.petrak.hexcasting.common.network; import at.petrak.hexcasting.api.mod.HexStatistics; import at.petrak.hexcasting.api.mod.HexTags; -import at.petrak.hexcasting.api.spell.casting.ControllerInfo; -import at.petrak.hexcasting.api.spell.casting.ResolvedPattern; -import at.petrak.hexcasting.api.spell.casting.ResolvedPatternType; -import at.petrak.hexcasting.api.spell.iota.PatternIota; -import at.petrak.hexcasting.api.spell.math.HexCoord; -import at.petrak.hexcasting.api.spell.math.HexPattern; +import at.petrak.hexcasting.api.casting.eval.ControllerInfo; +import at.petrak.hexcasting.api.casting.eval.ResolvedPattern; +import at.petrak.hexcasting.api.casting.eval.ResolvedPatternType; +import at.petrak.hexcasting.api.casting.iota.PatternIota; +import at.petrak.hexcasting.api.casting.math.HexCoord; +import at.petrak.hexcasting.api.casting.math.HexPattern; import at.petrak.hexcasting.xplat.IXplatAbstractions; import io.netty.buffer.ByteBuf; import net.minecraft.network.FriendlyByteBuf; diff --git a/Common/src/main/java/at/petrak/hexcasting/common/network/MsgOpenSpellGuiAck.java b/Common/src/main/java/at/petrak/hexcasting/common/network/MsgOpenSpellGuiAck.java index 40062a51..f03b1c6c 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/network/MsgOpenSpellGuiAck.java +++ b/Common/src/main/java/at/petrak/hexcasting/common/network/MsgOpenSpellGuiAck.java @@ -1,6 +1,6 @@ package at.petrak.hexcasting.common.network; -import at.petrak.hexcasting.api.spell.casting.ResolvedPattern; +import at.petrak.hexcasting.api.casting.eval.ResolvedPattern; import at.petrak.hexcasting.client.gui.GuiSpellcasting; import io.netty.buffer.ByteBuf; import net.minecraft.client.Minecraft; diff --git a/Common/src/main/java/at/petrak/hexcasting/interop/patchouli/AbstractPatternComponent.java b/Common/src/main/java/at/petrak/hexcasting/interop/patchouli/AbstractPatternComponent.java index 36a2187c..47c36f18 100644 --- a/Common/src/main/java/at/petrak/hexcasting/interop/patchouli/AbstractPatternComponent.java +++ b/Common/src/main/java/at/petrak/hexcasting/interop/patchouli/AbstractPatternComponent.java @@ -1,7 +1,7 @@ package at.petrak.hexcasting.interop.patchouli; -import at.petrak.hexcasting.api.spell.math.HexCoord; -import at.petrak.hexcasting.api.spell.math.HexPattern; +import at.petrak.hexcasting.api.casting.math.HexCoord; +import at.petrak.hexcasting.api.casting.math.HexPattern; import at.petrak.hexcasting.client.RenderLib; import at.petrak.hexcasting.interop.utils.PatternDrawingUtil; import at.petrak.hexcasting.interop.utils.PatternEntry; diff --git a/Common/src/main/java/at/petrak/hexcasting/interop/patchouli/LookupPatternComponent.java b/Common/src/main/java/at/petrak/hexcasting/interop/patchouli/LookupPatternComponent.java index 32bb06fc..e8126b9d 100644 --- a/Common/src/main/java/at/petrak/hexcasting/interop/patchouli/LookupPatternComponent.java +++ b/Common/src/main/java/at/petrak/hexcasting/interop/patchouli/LookupPatternComponent.java @@ -1,8 +1,8 @@ package at.petrak.hexcasting.interop.patchouli; -import at.petrak.hexcasting.api.PatternRegistry; -import at.petrak.hexcasting.api.spell.math.HexCoord; -import at.petrak.hexcasting.api.spell.math.HexPattern; +import at.petrak.hexcasting.common.casting.PatternRegistryManifest; +import at.petrak.hexcasting.api.casting.math.HexCoord; +import at.petrak.hexcasting.api.casting.math.HexPattern; import com.google.gson.annotations.SerializedName; import com.mojang.datafixers.util.Pair; import net.minecraft.resources.ResourceLocation; @@ -23,7 +23,7 @@ public class LookupPatternComponent extends AbstractPatternComponent { @Override public List> getPatterns(UnaryOperator lookup) { - var entry = PatternRegistry.lookupPattern(this.opName); + var entry = PatternRegistryManifest.lookupPattern(this.opName); this.strokeOrder = !entry.isPerWorld(); return List.of(new Pair<>(entry.prototype(), HexCoord.getOrigin())); } diff --git a/Common/src/main/java/at/petrak/hexcasting/interop/patchouli/ManualPatternComponent.java b/Common/src/main/java/at/petrak/hexcasting/interop/patchouli/ManualPatternComponent.java index fa97bcd6..f0394638 100644 --- a/Common/src/main/java/at/petrak/hexcasting/interop/patchouli/ManualPatternComponent.java +++ b/Common/src/main/java/at/petrak/hexcasting/interop/patchouli/ManualPatternComponent.java @@ -1,8 +1,8 @@ package at.petrak.hexcasting.interop.patchouli; -import at.petrak.hexcasting.api.spell.math.HexCoord; -import at.petrak.hexcasting.api.spell.math.HexDir; -import at.petrak.hexcasting.api.spell.math.HexPattern; +import at.petrak.hexcasting.api.casting.math.HexCoord; +import at.petrak.hexcasting.api.casting.math.HexDir; +import at.petrak.hexcasting.api.casting.math.HexPattern; import com.google.gson.Gson; import com.google.gson.JsonElement; import com.google.gson.annotations.SerializedName; diff --git a/Common/src/main/java/at/petrak/hexcasting/interop/pehkui/OpGetScale.kt b/Common/src/main/java/at/petrak/hexcasting/interop/pehkui/OpGetScale.kt index da1102b1..83acb6ec 100644 --- a/Common/src/main/java/at/petrak/hexcasting/interop/pehkui/OpGetScale.kt +++ b/Common/src/main/java/at/petrak/hexcasting/interop/pehkui/OpGetScale.kt @@ -1,10 +1,10 @@ package at.petrak.hexcasting.interop.pehkui -import at.petrak.hexcasting.api.spell.ConstMediaAction -import at.petrak.hexcasting.api.spell.asActionResult -import at.petrak.hexcasting.api.spell.casting.CastingContext -import at.petrak.hexcasting.api.spell.getEntity -import at.petrak.hexcasting.api.spell.iota.Iota +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.getEntity +import at.petrak.hexcasting.api.casting.iota.Iota import at.petrak.hexcasting.xplat.IXplatAbstractions object OpGetScale : ConstMediaAction { diff --git a/Common/src/main/java/at/petrak/hexcasting/interop/pehkui/OpSetScale.kt b/Common/src/main/java/at/petrak/hexcasting/interop/pehkui/OpSetScale.kt index 24faa34c..98e0f199 100644 --- a/Common/src/main/java/at/petrak/hexcasting/interop/pehkui/OpSetScale.kt +++ b/Common/src/main/java/at/petrak/hexcasting/interop/pehkui/OpSetScale.kt @@ -1,8 +1,8 @@ package at.petrak.hexcasting.interop.pehkui -import at.petrak.hexcasting.api.spell.* -import at.petrak.hexcasting.api.spell.casting.CastingContext -import at.petrak.hexcasting.api.spell.iota.Iota +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.xplat.IXplatAbstractions import net.minecraft.world.entity.Entity diff --git a/Common/src/main/java/at/petrak/hexcasting/interop/pehkui/PehkuiInterop.java b/Common/src/main/java/at/petrak/hexcasting/interop/pehkui/PehkuiInterop.java index cc83edf7..a54ad467 100644 --- a/Common/src/main/java/at/petrak/hexcasting/interop/pehkui/PehkuiInterop.java +++ b/Common/src/main/java/at/petrak/hexcasting/interop/pehkui/PehkuiInterop.java @@ -1,8 +1,8 @@ package at.petrak.hexcasting.interop.pehkui; -import at.petrak.hexcasting.api.PatternRegistry; -import at.petrak.hexcasting.api.spell.math.HexDir; -import at.petrak.hexcasting.api.spell.math.HexPattern; +import at.petrak.hexcasting.common.casting.PatternRegistryManifest; +import at.petrak.hexcasting.api.casting.math.HexDir; +import at.petrak.hexcasting.api.casting.math.HexPattern; import net.minecraft.world.entity.Entity; import static at.petrak.hexcasting.api.HexAPI.modLoc; @@ -10,11 +10,11 @@ import static at.petrak.hexcasting.api.HexAPI.modLoc; public class PehkuiInterop { public static void init() { try { - PatternRegistry.mapPattern(HexPattern.fromAngles("aawawwawwa", HexDir.NORTH_WEST), + PatternRegistryManifest.mapPattern(HexPattern.fromAngles("aawawwawwa", HexDir.NORTH_WEST), modLoc("interop/pehkui/get"), OpGetScale.INSTANCE); - PatternRegistry.mapPattern(HexPattern.fromAngles("ddwdwwdwwd", HexDir.NORTH_EAST), + PatternRegistryManifest.mapPattern(HexPattern.fromAngles("ddwdwwdwwd", HexDir.NORTH_EAST), modLoc("interop/pehkui/set"), OpSetScale.INSTANCE); - } catch (PatternRegistry.RegisterPatternException e) { + } catch (PatternRegistryManifest.RegisterPatternException e) { e.printStackTrace(); } } diff --git a/Common/src/main/java/at/petrak/hexcasting/interop/utils/PatternDrawingUtil.java b/Common/src/main/java/at/petrak/hexcasting/interop/utils/PatternDrawingUtil.java index e60c63a9..382b0a07 100644 --- a/Common/src/main/java/at/petrak/hexcasting/interop/utils/PatternDrawingUtil.java +++ b/Common/src/main/java/at/petrak/hexcasting/interop/utils/PatternDrawingUtil.java @@ -1,7 +1,7 @@ package at.petrak.hexcasting.interop.utils; -import at.petrak.hexcasting.api.spell.math.HexCoord; -import at.petrak.hexcasting.api.spell.math.HexPattern; +import at.petrak.hexcasting.api.casting.math.HexCoord; +import at.petrak.hexcasting.api.casting.math.HexPattern; import at.petrak.hexcasting.api.utils.HexUtils; import at.petrak.hexcasting.client.RenderLib; import com.mojang.blaze3d.platform.GlStateManager; diff --git a/Common/src/main/java/at/petrak/hexcasting/interop/utils/PatternEntry.java b/Common/src/main/java/at/petrak/hexcasting/interop/utils/PatternEntry.java index a7ed8616..b2c717d1 100644 --- a/Common/src/main/java/at/petrak/hexcasting/interop/utils/PatternEntry.java +++ b/Common/src/main/java/at/petrak/hexcasting/interop/utils/PatternEntry.java @@ -1,7 +1,7 @@ package at.petrak.hexcasting.interop.utils; -import at.petrak.hexcasting.api.spell.math.HexCoord; -import at.petrak.hexcasting.api.spell.math.HexPattern; +import at.petrak.hexcasting.api.casting.math.HexCoord; +import at.petrak.hexcasting.api.casting.math.HexPattern; import net.minecraft.world.phys.Vec2; import java.util.List; diff --git a/Common/src/main/java/at/petrak/hexcasting/xplat/IXplatAbstractions.java b/Common/src/main/java/at/petrak/hexcasting/xplat/IXplatAbstractions.java index d00284ee..30364f4c 100644 --- a/Common/src/main/java/at/petrak/hexcasting/xplat/IXplatAbstractions.java +++ b/Common/src/main/java/at/petrak/hexcasting/xplat/IXplatAbstractions.java @@ -1,18 +1,18 @@ package at.petrak.hexcasting.xplat; import at.petrak.hexcasting.api.HexAPI; -import at.petrak.hexcasting.api.SpecialHandler; import at.petrak.hexcasting.api.addldata.ADHexHolder; import at.petrak.hexcasting.api.addldata.ADIotaHolder; import at.petrak.hexcasting.api.addldata.ADMediaHolder; +import at.petrak.hexcasting.api.casting.ActionRegistryEntry; +import at.petrak.hexcasting.api.casting.SpecialHandler; +import at.petrak.hexcasting.api.casting.eval.CastingHarness; +import at.petrak.hexcasting.api.casting.eval.ResolvedPattern; +import at.petrak.hexcasting.api.casting.eval.sideeffects.EvalSound; +import at.petrak.hexcasting.api.casting.iota.IotaType; import at.petrak.hexcasting.api.misc.FrozenColorizer; import at.petrak.hexcasting.api.player.FlightAbility; import at.petrak.hexcasting.api.player.Sentinel; -import at.petrak.hexcasting.api.spell.ActionRegistryEntry; -import at.petrak.hexcasting.api.spell.casting.CastingHarness; -import at.petrak.hexcasting.api.spell.casting.ResolvedPattern; -import at.petrak.hexcasting.api.spell.casting.sideeffects.EvalSound; -import at.petrak.hexcasting.api.spell.iota.IotaType; import at.petrak.hexcasting.common.network.IMessage; import at.petrak.hexcasting.interop.pehkui.PehkuiInterop; import net.minecraft.core.BlockPos; @@ -153,7 +153,7 @@ public interface IXplatAbstractions { */ Registry getActionRegistry(); - Registry getSpecialHandlerRegistry(); + Registry> getSpecialHandlerRegistry(); Registry> getIotaTypeRegistry(); diff --git a/Common/src/main/resources/assets/hexcasting/lang/en_us.json b/Common/src/main/resources/assets/hexcasting/lang/en_us.json index 8690ad72..558f0c97 100644 --- a/Common/src/main/resources/assets/hexcasting/lang/en_us.json +++ b/Common/src/main/resources/assets/hexcasting/lang/en_us.json @@ -68,12 +68,12 @@ "item.hexcasting.creative_unlocker.for_emphasis": "INFINITE MEDIA", "item.hexcasting.creative_unlocker.tooltip": "Consume to unlock all %s knowledge.", "item.hexcasting.creative_unlocker.mod_name": "Hexcasting", - + "item.hexcasting.lore_fragment": "Lore Fragment", "item.hexcasting.lore_fragment.all": "It seems I have found all the lore this world has to offer.", - + "entity.hexcasting.wall_scroll": "Hanging Scroll", - + "block.hexcasting.conjured": "Conjured Block", "block.hexcasting.slate.blank": "Blank Slate", "block.hexcasting.slate.written": "Patterned Slate", @@ -86,7 +86,7 @@ "block.hexcasting.akashic_record": "Akashic Record", "block.hexcasting.akashic_bookshelf": "Akashic Bookshelf", "block.hexcasting.akashic_connector": "Akashic Ligature", - + "block.hexcasting.slate_block": "Block of Slate", "block.hexcasting.amethyst_dust_block": "Block of Amethyst Dust", "block.hexcasting.amethyst_tiles": "Amethyst Tiles", @@ -111,10 +111,10 @@ "block.hexcasting.amethyst_edified_leaves": "Amethyst Edified Leaves", "block.hexcasting.aventurine_edified_leaves": "Aventurine Edified Leaves", "block.hexcasting.citrine_edified_leaves": "Citrine Edified Leaves", - + "itemGroup.hexcasting": "Hexcasting", "itemGroup.hexcasting.creative_tab": "Hexcasting", - + "hexcasting.tooltip.spellbook.page": "Selected Page %d/%d", "hexcasting.tooltip.spellbook.page.sealed": "Selected Page %d/%d (%s)", "hexcasting.tooltip.spellbook.page_with_name": "Selected Page %d/%d (\"%s\")", @@ -141,17 +141,17 @@ "hexcasting.spelldata.unknown": "A broken iota", "hexcasting.spelldata.entity.whoknows": "An unknown entity", "hexcasting.spelldata.akashic.nopos": "The owning record does not know of any iota here (this is a bug)", - + "hexcasting.tooltip.media": "%s dust", "hexcasting.tooltip.media_amount": "Contains: %s (%s)", "hexcasting.tooltip.media_amount.advanced": "Contains: %s/%s (%s)", - + "hexcasting.tooltip.list_contents": "[%s]", "hexcasting.tooltip.pattern_iota": "HexPattern(%s)", "hexcasting.tooltip.null_iota": "NULL", "hexcasting.tooltip.boolean_true": "True", "hexcasting.tooltip.boolean_false": "False", - + "hexcasting.iota.hexcasting:null": "Null", "hexcasting.iota.hexcasting:double": "Number", "hexcasting.iota.hexcasting:boolean": "Boolean", @@ -160,7 +160,7 @@ "hexcasting.iota.hexcasting:pattern": "Pattern", "hexcasting.iota.hexcasting:garbage": "Garbage", "hexcasting.iota.hexcasting:vec3": "Vector", - + "gui.hexcasting.spellcasting": "Hex Grid", "tag.hexcasting.staves": "Hex Staves", "tag.hexcasting.edified_logs": "Edified Logs", @@ -171,7 +171,7 @@ "emi.category.hexcasting.edify": "Edify Sapling", "emi.category.hexcasting.villager_leveling": "Trade Leveling", "emi.category.hexcasting.villager_profession": "Villager Profession", - + "text.autoconfig.hexcasting.title": "Hexcasting Config", "text.autoconfig.hexcasting.category.common": "Common", "text.autoconfig.hexcasting.category.client": "Client", @@ -210,8 +210,8 @@ "text.autoconfig.hexcasting.option.server.fewScrollTables.@Tooltip": "Loot tables that a small number of Ancient Scrolls are injected into", "text.autoconfig.hexcasting.option.server.someScrollTables.@Tooltip": "Loot tables that a decent number of Ancient Scrolls are injected into", "text.autoconfig.hexcasting.option.server.manyScrollTables.@Tooltip": "Loot tables that a huge number of Ancient Scrolls are injected into", - - + + "advancement.hexcasting:root": "Hexcasting Research", "advancement.hexcasting:root.desc": "Find and mine a concentrated form of media growing deep beneath the earth.", "advancement.hexcasting:enlightenment": "Achieve Enlightenment", @@ -239,15 +239,15 @@ "advancement.hexcasting:lore/experiment1": "Wooleye Instance Notes", "advancement.hexcasting:lore/experiment2": "Wooleye Interview Logs", "advancement.hexcasting:lore/inventory": "Restoration Log 72", - + "stat.hexcasting.media_used": "Media Consumed (in dust)", "stat.hexcasting.media_overcasted": "Media Overcast (in dust)", "stat.hexcasting.patterns_drawn": "Patterns Drawn", "stat.hexcasting.spells_cast": "Spells Cast", - + "death.attack.hexcasting.overcast": "%s's mind was subsumed into energy", "death.attack.hexcasting.shame": "Shame on %s!", - + "command.hexcasting.pats.listing": "Patterns in this world:", "command.hexcasting.pats.all": "Gave all %d scrolls to %s", "command.hexcasting.pats.specific.success": "Gave %s with id %s to %s", @@ -262,10 +262,10 @@ "hexcasting.debug.media_inserted.with_dust": "%s - Media inserted: %s (%s in dust)", "hexcasting.debug.all_media": "Entire contents", "hexcasting.debug.infinite_media": "Infinite", - + "hexcasting.message.cant_overcast": "That Hex needed more media than I had... I should double-check my math.", "hexcasting.message.cant_great_spell": "The spell failed, somehow... am I not skilled enough?", - + "hexcasting.subtitles.start_pattern": "Starting pattern", "hexcasting.subtitles.add_line": "Adding line", "hexcasting.subtitles.add_pattern": "Adding pattern", @@ -282,9 +282,9 @@ "hexcasting.subtitles.impetus.fletcher.tick": "Fletcher Impetus ticks", "hexcasting.subtitles.impetus.cleric.register": "Cleric Impetus dings", "hexcasting.subtitles.lore_fragment.read": "Read lore fragment", - + "_comment": "hexcasting.spell.book keys override the name of a pattern in the patchouli book if present", - + "hexcasting.spell.book.hexcasting:get_entity_height": "Stadiometer's Prfn.", "hexcasting.spell.book.hexcasting:get_entity/animal": "Entity Prfn.: Animal", "hexcasting.spell.book.hexcasting:get_entity/monster": "Entity Prfn.: Monster", @@ -313,7 +313,7 @@ "hexcasting.spell.book.hexcasting:read/entity": "Chronicler's Prfn.", "hexcasting.spell.book.hexcasting:number": "Numerical Reflection", "hexcasting.spell.book.hexcasting:mask": "Bookkeeper's Gambit", - + "hexcasting.spell.hexcasting:const/null": "Nullary Reflection", "hexcasting.spell.hexcasting:const/vec/px": "Vector Reflection +X", "hexcasting.spell.hexcasting:const/vec/py": "Vector Reflection +Y", @@ -327,7 +327,7 @@ "hexcasting.spell.hexcasting:const/double/pi": "Arc's Reflection", "hexcasting.spell.hexcasting:const/double/tau": "Circle's Reflection", "hexcasting.spell.hexcasting:const/double/e": "Euler's Reflection", - + "hexcasting.spell.hexcasting:get_caster": "Mind's Reflection", "hexcasting.spell.hexcasting:entity_pos/eye": "Compass' Purification", "hexcasting.spell.hexcasting:entity_pos/foot": "Compass' Purification II", @@ -341,7 +341,7 @@ "hexcasting.spell.hexcasting:circle/impetus_dir": "Lodestone Reflection", "hexcasting.spell.hexcasting:circle/bounds/min": "Lesser Fold Reflection", "hexcasting.spell.hexcasting:circle/bounds/max": "Greater Fold Reflection", - + "hexcasting.spell.hexcasting:append": "Integration Distillation", "hexcasting.spell.hexcasting:concat": "Combination Distillation", "hexcasting.spell.hexcasting:index": "Selection Distillation", @@ -357,7 +357,7 @@ "hexcasting.spell.hexcasting:modify_in_place": "Surgeon's Exaltation", "hexcasting.spell.hexcasting:construct": "Speaker's Distillation", "hexcasting.spell.hexcasting:deconstruct": "Speaker's Decomposition", - + "hexcasting.spell.hexcasting:get_entity": "Entity Purification", "hexcasting.spell.hexcasting:get_entity/animal": "Entity Purification: Animal", "hexcasting.spell.hexcasting:get_entity/monster": "Entity Purification: Monster", @@ -375,7 +375,7 @@ "hexcasting.spell.hexcasting:zone_entity/not_item": "Zone Distillation: Non-Item", "hexcasting.spell.hexcasting:zone_entity/not_player": "Zone Distillation: Non-Player", "hexcasting.spell.hexcasting:zone_entity/not_living": "Zone Distillation: Non-Living", - + "hexcasting.spell.hexcasting:swap": "Jester's Gambit", "hexcasting.spell.hexcasting:rotate": "Rotation Gambit", "hexcasting.spell.hexcasting:rotate_reverse": "Rotation Gambit II", @@ -388,7 +388,7 @@ "hexcasting.spell.hexcasting:fisherman": "Fisherman's Gambit", "hexcasting.spell.hexcasting:fisherman/copy": "Fisherman's Gambit II", "hexcasting.spell.hexcasting:swizzle": "Swindler's Gambit", - + "hexcasting.spell.hexcasting:and_bit": "Intersection Distillation", "hexcasting.spell.hexcasting:or_bit": "Unifying Distillation", "hexcasting.spell.hexcasting:xor_bit": "Exclusionary Distillation", @@ -397,7 +397,7 @@ "hexcasting.spell.hexcasting:and": "Conjunction Distillation", "hexcasting.spell.hexcasting:or": "Disjunction Distillation", "hexcasting.spell.hexcasting:xor": "Exclusion Distillation", - + "hexcasting.spell.hexcasting:greater": "Maximus Distillation", "hexcasting.spell.hexcasting:less": "Minimus Distillation", "hexcasting.spell.hexcasting:greater_eq": "Maximus Distillation II", @@ -407,7 +407,7 @@ "hexcasting.spell.hexcasting:not": "Negation Purification", "hexcasting.spell.hexcasting:bool_coerce": "Augur's Purification", "hexcasting.spell.hexcasting:if": "Augur's Exaltation", - + "hexcasting.spell.hexcasting:add": "Additive Distillation", "hexcasting.spell.hexcasting:sub": "Subtractive Distillation", "hexcasting.spell.hexcasting:mul_dot": "Multiplicative Dstl.", @@ -428,7 +428,7 @@ "hexcasting.spell.hexcasting:random": "Entropy Reflection", "hexcasting.spell.hexcasting:logarithm": "Logarithmic Distillation", "hexcasting.spell.hexcasting:coerce_axial": "Axial Purification", - + "hexcasting.spell.hexcasting:read": "Scribe's Reflection", "hexcasting.spell.hexcasting:read/entity": "Chronicler's Purification", "hexcasting.spell.hexcasting:write": "Scribe's Gambit", @@ -441,7 +441,7 @@ "hexcasting.spell.hexcasting:akashic/write": "Akasha's Gambit", "hexcasting.spell.hexcasting:read/local": "Muninn's Reflection", "hexcasting.spell.hexcasting:write/local": "Huginn's Gambit", - + "hexcasting.spell.hexcasting:print": "Reveal", "hexcasting.spell.hexcasting:beep": "Make Note", "hexcasting.spell.hexcasting:explode": "Explosion", @@ -474,7 +474,7 @@ "hexcasting.spell.hexcasting:potion/wither": "Black Sun's Nadir", "hexcasting.spell.hexcasting:potion/poison": "Red Sun's Nadir", "hexcasting.spell.hexcasting:potion/slowness": "Green Sun's Nadir", - + "hexcasting.spell.hexcasting:potion/regeneration": "White Sun's Zenith", "hexcasting.spell.hexcasting:potion/night_vision": "Blue Sun's Zenith", "hexcasting.spell.hexcasting:potion/absorption": "Black Sun's Zenith", @@ -488,7 +488,7 @@ "hexcasting.spell.hexcasting:teleport": "Greater Teleport", "hexcasting.spell.hexcasting:brainsweep": "Flay Mind", "hexcasting.spell.hexcasting:sentinel/create/great": "Summon Greater Sentinel", - + "hexcasting.spell.hexcasting:open_paren": "Introspection", "hexcasting.spell.hexcasting:close_paren": "Retrospection", "hexcasting.spell.hexcasting:escape": "Consideration", @@ -498,15 +498,15 @@ "hexcasting.spell.hexcasting:number": "Numerical Reflection: %s", "hexcasting.spell.hexcasting:mask": "Bookkeeper's Gambit: %s", "hexcasting.spell.null": "Unknown Pattern", - + "hexcasting.spell.hexcasting:interop/gravity/get": "Gravitational Purification", "hexcasting.spell.hexcasting:interop/gravity/set": "Alter Gravity", "hexcasting.spell.hexcasting:interop/pehkui/get": "Gulliver's Purification", "hexcasting.spell.hexcasting:interop/pehkui/set": "Alter Scale", - + "hexcasting.mishap.invalid_pattern": "That pattern isn't associated with any action", "hexcasting.mishap.unescaped": "Expected to evaluate a pattern, but evaluated %s instead", - "hexcasting.mishap.invalid_value": "%s expected %s at index %s of the stack, but got %s", + "hexcasting.mishap.invalid_value": "expected %s at index %s of the stack, but got %s", "hexcasting.mishap.invalid_value.class.double": "a number", "hexcasting.mishap.invalid_value.class.boolean": "a boolean", "hexcasting.mishap.invalid_value.class.vector": "a vector", @@ -532,22 +532,22 @@ "hexcasting.mishap.invalid_value.int.positive.less.equal": "a positive integer less than or equal to %d", "hexcasting.mishap.invalid_value.int.between": "an integer between %d and %d", "hexcasting.mishap.invalid_value.evaluatable": "something evaluatable", - "hexcasting.mishap.not_enough_args": "%s expected %s or more arguments but the stack was only %s tall", - "hexcasting.mishap.no_args": "%s expected %s or more arguments but the stack was empty", + "hexcasting.mishap.not_enough_args": "expected %s or more arguments but the stack was only %s tall", + "hexcasting.mishap.no_args": "expected %s or more arguments but the stack was empty", "hexcasting.mishap.too_many_close_parens": "Used Retrospection without first using Introspection", - "hexcasting.mishap.location_too_far": "%s is out of range for %s", + "hexcasting.mishap.location_too_far": "%s is out of range", "hexcasting.mishap.location_out_of_world": "%s is not within the world", "hexcasting.mishap.location_too_close_to_out": "%s is too close to the boundary of the world", "hexcasting.mishap.location_bad_dimension": "It is impossible to teleport in this dimension", - "hexcasting.mishap.wrong_dimension": "%s cannot see %s from %s", - "hexcasting.mishap.entity_too_far": "%s is out of range for %s", - "hexcasting.mishap.immune_entity": "%s cannot alter %s", + "hexcasting.mishap.wrong_dimension": "cannot see %s from %s", + "hexcasting.mishap.entity_too_far": "%s is out of range", + "hexcasting.mishap.immune_entity": "cannot alter %s", "hexcasting.mishap.eval_too_deep": "Recursively evaluated too deep", - "hexcasting.mishap.no_item": "%s needs %s but got nothing", - "hexcasting.mishap.no_item.offhand": "%s needs %s in the other hand but got nothing", - "hexcasting.mishap.bad_entity": "%s needs %s but got %s", - "hexcasting.mishap.bad_item": "%s needs %s but got %dx %s", - "hexcasting.mishap.bad_item.offhand": "%s needs %s in the other hand but got %dx %s", + "hexcasting.mishap.no_item": "needs %s but got nothing", + "hexcasting.mishap.no_item.offhand": "needs %s in the other hand but got nothing", + "hexcasting.mishap.bad_entity": "needs %s but got %s", + "hexcasting.mishap.bad_item": "needs %s but got %dx %s", + "hexcasting.mishap.bad_item.offhand": "needs %s in the other hand but got %dx %s", "hexcasting.mishap.bad_item.iota": "a place to store iotas", "hexcasting.mishap.bad_item.iota.read": "a place to read iotas from", "hexcasting.mishap.bad_item.iota.write": "a place to write iotas to", @@ -578,65 +578,65 @@ "hexcasting.mishap.divide_by_zero.sin": "the sine of %s", "hexcasting.mishap.divide_by_zero.cos": "the cosine of %s", "hexcasting.mishap.no_akashic_record": "No Akashic Record at %s", - "hexcasting.mishap.disallowed": "%s has been disallowed by the server admins", - "hexcasting.mishap.disallowed_circle": "%s has been disallowed in spell circles by the server admins", + "hexcasting.mishap.disallowed": "has been disallowed by the server admins", + "hexcasting.mishap.disallowed_circle": "has been disallowed in spell circles by the server admins", "hexcasting.mishap.invalid_spell_datum_type": "Tried to use a value of invalid type as a SpellDatum: %s (class %s). This is a bug in the mod.", - "hexcasting.mishap.unknown": "%s threw an exception (%s). This is a bug in the mod.", + "hexcasting.mishap.unknown": "threw an exception (%s). This is a bug in the mod.", "hexcasting.mishap.shame": "Shame on you!", - + "_comment": "Patchi stuff", - + "hexcasting.landing": "I seem to have discovered a new method of magical arts, in which one draws patterns strange and wild onto a hexagonal grid. It fascinates me. I've decided to start a journal of my thoughts and findings.$(br2)$(l:https://discord.gg/4xxHGYteWk)Discord Server Link/$", - + "hexcasting.entry.basics": "Getting Started", "hexcasting.entry.basics.desc": "The practitioners of this art would cast their so-called _Hexes by drawing strange patterns in the air with a $(l:items/staff)$(item)staff/$-- or craft $(l:items/hexcasting)$(item)powerful magical items/$ to do the casting for them. How might I do the same?", - + "hexcasting.entry.casting": "Hex Casting", "hexcasting.entry.casting.desc": "I've started to understand how the old masters cast their _Hexes! It's a bit complicated, but I'm sure I can figure it out. Let's see...", - + "hexcasting.entry.items": "Items", "hexcasting.entry.items.desc": "I devote this section to the magical and mysterious items I might encounter in my studies.$(br2)It seems like many of these items have uses when held alongside my $(l:items/staff)$(item)staff/$. I suppose I will have to choose what goes in my other hand carefully.", - + "hexcasting.entry.greatwork": "The Great Work", "hexcasting.entry.greatwork.desc": "I have seen... so much. I have... experienced... annihilation and deconstruction and reconstruction. I have seen the atoms of the world screaming as they were inverted and subverted and demoted to energy. I have seen I have seen I have s$(k)get stick bugged lmao/$", - + "hexcasting.entry.patterns": "Patterns", "hexcasting.entry.patterns.desc": "A list of all the patterns I've discovered, as well as what they do.", - + "hexcasting.entry.spells": "Spells", "hexcasting.entry.spells.desc": "Patterns and actions that perform a magical effect on the world.", - + "hexcasting.entry.great_spells": "Great Spells", "hexcasting.entry.great_spells.desc": "The spells catalogued here are purported to be of legendary difficulty and power. They seem to have been recorded only sparsely (for good reason, the texts claim). It's probably just the hogwash of extinct traditionalists, though-- a pattern's a pattern. What could possibly go wrong?", - - + + "_comment": "Basics", - + "hexcasting.entry.media": "Media", "hexcasting.page.media.1": "_Media is a form of mental energy external to a mind. All living creatures generate trace amounts of _media when thinking about anything; after the thought is finished, the media is released into the environment.$(br2)The art of casting _Hexes is all about manipulating _media to do your bidding.", "hexcasting.page.media.2": "_Media can exert influences on other media-- the strength and type of influence can be manipulated by drawing _media out into patterns.$(p)Scholars of the art used a concentrated blob of _media on the end of a stick: by waving it in the air in precise configurations, they were able to manipulate enough _media with enough precision to influence the world itself, in the form of a _Hex.", "hexcasting.page.media.3": "Sadly, even a fully sentient being (like myself, presumably) can only generate miniscule amounts of _media. It would be quite impractical to try and use my own brainpower to cast Hexes.$(br2)But legend has it that there are underground deposits where _media slowly accumulates, growing into crystalline forms.$(p)If I could just find one of those...", - + "hexcasting.entry.geodes": "Geodes", "hexcasting.page.geodes.1": "Aha! While mining deep underground, I found an enormous geode resonating with energy-- energy which pressed against my skull and my thoughts. And now, I hold that pressure in my hand, in solid form. That proves it. This $(italic)must/$ be the place spoken about in legends where _media accumulates.$(br2)These $(l:items/amethyst)$(item)amethyst crystals/$ must be a $(l:items/amethyst)$(thing)convenient, solidified form of _Media/$.", "hexcasting.page.geodes.2": "It appears that, in addition to the $(l:items/amethyst)$(item)Amethyst Shards/$ I have seen in the past, these crystals can also drop bits of powdered $(l:items/amethyst)$(item)Amethyst Dust/$, as well as these $(l:items/amethyst)$(item)Charged Amethyst Crystals/$. It looks like I'll have a better chance of finding the $(l:items/amethyst)$(item)Charged Amethyst Crystals/$ by using a Fortune pickaxe.", "hexcasting.page.geodes.3": "As I take the beauty of the crystal in, I can feel connections flashing wildly in my mind. It's like the _media in the air is entering me, empowering me, elucidating me... It feels wonderful.$(br2)Finally, my study into the arcane is starting to make some sense!$(p)Let me reread those old legends again, now that I know what I'm looking at.", - + "hexcasting.entry.couldnt_cast": "A Frustration", "hexcasting.page.couldnt_cast.1": "Argh! Why won't it let me cast the spell?!$(br2)The scroll I found rings with authenticity. I can $(italic)feel/$ it humming in the scroll-- the pattern is true, or as true as it can be. The spell is $(italic)right there/$.$(p)But it feels as if it's on the other side of some thin membrane. I called it-- it tried to manifest-- yet it $(italic)COULD NOT/$.", "hexcasting.page.couldnt_cast.2": "It felt like the barrier may have weakened ever so slightly from the force that I exerted on the spell; yet despite my greatest efforts-- my deepest focus, my finest amethyst, my precisest drawings-- it $(italic)refuses/$ to cross the barrier. It's maddening.$(p)$(italic)This/$ is where my arcane studies end? Cursed by impotence, cursed to lose my rightful powers?$(br2)I should take a deep breath. I should meditate on what I have learned, even if it wasn't very much...", "hexcasting.page.couldnt_cast.3": "...After careful reflection... I have discovered a change in myself.$(p)It seems... in lieu of $(l:items/amethyst)$(item)amethyst/$, I've unlocked the ability to cast spells using my own mind and life energy-- just as I read of in the legends of old.$(p)I'm not sure why I can now. It's just... the truth-knowledge-burden was always there, and I see it now. I know it. I bear it.$(br2)Fortunately, I feel my limits as well-- I would get approximately two $(l:items/amethyst)$(item)Charged Amethyst/$'s worth of _media out of my health at its prime.", "hexcasting.page.couldnt_cast.4": "I shudder to even consider it-- I've kept my mind mostly intact so far, in my studies. But the fact is-- I form one side of a tenuous link.$(p)I'm connected to some other side-- a side whose boundary has thinned from that trauma. A place where simple actions spell out eternal glory.$(p)Is it so wrong, to want it for myself?", - + "hexcasting.entry.start_to_see": "WHAT DID I SEE", "hexcasting.page.start_to_see.1": "The texts weren't lying. Nature took its due.", "hexcasting.page.start_to_see.2": "That... that was...$(p)...that was one of the $(italic)worst/$ things I've $(italic)ever/$ experienced. I offered my plan to Nature, and got a firm smile and a tearing sensation in return-- a piece of myself breaking away, like amethyst dust in the rain.$(p)I feel lucky to have $(italic)survived/$, much less have the sagacity to write this-- I should declare the matter closed, double-check my math before I cast any more _Hexes, and never make such a mistake again.", "hexcasting.page.start_to_see.3": "...But.$(br2)But for the scarcest instant, that part of myself... it $(italic)saw/$... $(l:greatwork/the_work)$(thing)something/$. A place-- a design, perhaps? (Such distinctions didn't seem to matter in the face of... that.)$(p)And a... a membrane-barrier-skin-border, separating myself from a realm of raw thought-flow-light-energy. I remember-- I saw-thought-recalled-felt-- the barrier fuzzing at its edges, just so slightly.$(p)I wanted $(italic)through./$", "hexcasting.page.start_to_see.4": "I shouldn't. I $(italic)know/$ I shouldn't. It's dangerous. It's too dangerous. The force required... I'd have to bring myself within a hair's breadth of Death itself with a $(italic)single stroke/$.$(br2)But I'm. So. $(italic)Close/$.$(p)$(italic)This/$ is the culmination of my art. This is the $(#54398a)Enlightenment/$ I've been seeking. $(br2)I want more. I need to see it again. I $(italic)will/$ see it.$(p)What is my mortal mind against immortal glory?", - - + + "_comment": "Casting", - + "hexcasting.entry.101": "Hexing 101", "hexcasting.page.101.1": "Casting a _Hex is quite difficult-- no wonder this art was lost to time! I'll have to re-read my notes carefully.$(br2)I can start a _Hex by pressing $(k:use) with a $(l:items/staff)$(item)Staff/$ in my hand-- this will cause a hexagonal grid of dots to appear in front of me. Then I can click and drag from dot to dot to draw patterns in the _media of the grid; finishing a pattern will run its corresponding action (more on that later).", "hexcasting.page.101.2": "Once I've drawn enough patterns to cast a spell, the grid will disappear as the _media I've stored up is released. Holding $(k:sneak) while using my $(l:items/staff)$(item)staff/$ will also clear the grid, if I don't mind the chance of mishap. (It seems that the more _media I've built up, the more likely I'll meet misfortune.)$(br2)So how do patterns work? In short:$(li)$(italic)Patterns/$ will execute...$(li)$(italic)Actions/$, which manipulate...$(li)$(l:casting/stack)$(italic)The Stack/$, which is a list of...$(li)$(italic)Iotas/$, which are simply units of information.", @@ -655,14 +655,14 @@ "hexcasting.page.101.14": "I have also found an amusing tidbit on why so many practitioners of magic in general seem to go mad, which I may like as some light and flavorful reading not canonical to my world.$(br2)$(italic)Content Warning: some body horror and suggestive elements./$", "hexcasting.page.101.14.link_text": "Goblin Punch", "hexcasting.page.101.15": "Finally, it seems spells have a maximum range of influence, about 32 blocks from my position. Trying to affect anything outside of that will cause the spell to fail.$(br2)Despite this, if I have a player's reference, I can affect them from anywhere. This only applies to affecting them directly, though; I cannot use this to affect the world around them if they're outside of my range.$(br)I ought to be careful when giving out a reference like that. While friendly _Hexcasters could use them to great effect and utility, I shudder to think of what someone malicious might do with this.", - + "hexcasting.entry.vectors": "A Primer on Vectors", "hexcasting.page.vectors.1": "It seems I will need to be adroit with vectors if I am to get anywhere in my studies. I have compiled some resources here on vectors if I find I do not know how to work with them.$(br2)First off, an enlightening video on the topic.", "hexcasting.page.vectors.1.link_text": "3blue1brown", "hexcasting.page.vectors.2": "Additionally, it seems that the mages who manipulated $(thing)Psi energy/$ (the so-called \"spellslingers\"), despite their poor naming sense, had some quite-effective lessons on vectors to teach their acolytes. I've taken the liberty of linking to one of their texts on the next page.$(br2)They seem to have used different language for their spellcasting:$(li)A \"Spell Piece\" was their name for an action;$(li)a \"Trick\" was their name for a spell; and$(li)an \"Operator\" was their name for a non-spell action.", "hexcasting.page.vectors.3": "Link here.", "hexcasting.page.vectors.3.link_text": "Psi Codex", - + "hexcasting.entry.mishaps": "Mishaps", "hexcasting.page.mishaps.1": "Unfortunately, I am not (yet) a perfect being. I make mistakes from time to time in my study and casting of _Hexes; for example, misdrawing a pattern, or trying to an invoke an action with the wrong iotas. And Nature usually doesn't look too kindly on my mistakes-- causing what is called a $(italic)mishap/$.", "hexcasting.page.mishaps.2": "A pattern that causes a mishap will glow red in my grid. Depending on the type of mistake, I can also expect a certain deleterious effect and a spray of red and colorful sparks as the mishandled _media curdles into light of a given color.$(br2)I also get a helpful error message in my chat, but a nagging feeling tells that will change once the \"mod updates,\" whatever that means. I shouldn't rely on always having it.", @@ -695,23 +695,23 @@ "hexcasting.page.mishaps.disabled": "I tried to cast an action that has been disallowed by a server administrator.$(br2)Causes black sparks.", "hexcasting.page.mishaps.other.title": "Catastrophic Failure", "hexcasting.page.mishaps.other": "A bug in the mod caused an iota of an invalid type or otherwise caused the spell to crash. $(l:https://github.com/gamma-delta/HexMod/issues)Please open a bug report!/$$(br2)Causes black sparks.", - + "hexcasting.entry.stack": "Stacks", "hexcasting.page.stack.1": "A $(thing)Stack/$, also known as a \"LIFO\", is a concept borrowed from computer science. In short, it's a collection of things designed so that you can only interact with the most recently used thing.$(br2)Think of a stack of plates, where new plates are added to the top: if you want to interact with a plate halfway down the stack, you have to remove the plates above it in order to get ahold of it.", "hexcasting.page.stack.2": "Because a stack is so simple, there's only so many things you can do with it:$(li)$(italic)Adding something to it/$, known formally as pushing,$(li)$(italic)Removing the last added element/$, known as popping, or$(li)$(italic)Examining or modifying the last added element/$, known as peeking.$(br)We call the last-added element the \"top\" of the stack, in accordance with the dinner plate analogy.$(p)As an example, if we push 1 to a stack, then push 2, then pop, the top of the stack is now 1.", "hexcasting.page.stack.3": "Actions are (on the most part) restricted to interacting with the casting stack in these ways. They will pop some iotas they're interested in (known as \"arguments\" or \"parameters\"), process them, and push some number of results.$(br2)Of course, some actions (e.g. $(l:patterns/basics#hexcasting:get_caster)$(action)Mind's Reflection/$) might pop no arguments, and some actions (particularly spells) might push nothing afterwards.", "hexcasting.page.stack.4": "Even more complicated actions can be expressed in terms of pushing, popping, and peeking. For example, $(l:patterns/stackmanip#hexcasting:swap)$(action)Jester's Gambit/$ swaps the top two items of the stack. This can be thought of as popping two items and pushing them in opposite order. For another, $(l:patterns/stackmanip#hexcasting:duplicate)$(action)Gemini Decomposition/$ duplicates the top of the stack-- in other words, it peeks the stack and pushes a copy of what it finds.", - + "hexcasting.entry.naming": "Naming Actions", "hexcasting.page.naming.1": "The names given to actions by the ancients were certainly peculiar, but I think there's a certain kind of logic to them.$(br2)There seem to be certain groups of actions with common names, named for the number of iotas they remove from and add to the stack.", "hexcasting.page.naming.2": "$(li)A $(thing)Reflection/$ pops nothing and pushes one iota.$(li)A $(thing)Purification/$ pops one and pushes one.$(li)A $(thing)Distillation/$ pops two and pushes one.$(li)An $(thing)Exaltation/$ pops three or more and pushes one.$(li)A $(thing)Decomposition/$ pops one argument and pushes two.$(li)A $(thing)Disintegration/$ pops one and pushes three or more.$(li)Finally, a $(thing)Gambit/$ pushes or pops some other number (or rearranges the stack in some other manner).", "hexcasting.page.naming.3": "Spells seem to be exempt from this nomenclature and are more or less named after what they do-- after all, why call it a $(action)Demoman's Gambit/$ when you could just say $(l:patterns/spells/basic#hexcasting:explode)$(action)Explosion/$?", - + "hexcasting.entry.influences": "Influences", "hexcasting.page.influences.1": "Influences are ... strange, to say the least. Whereas most iotas seem to represent something about the world, influences represent something more... abstract, or formless.$(br2)For example, one influence I've named $(l:casting/influences)$(thing)Null/$ seems to represent nothing at all. It's created when there isn't a suitable answer to a question asked, such as an $(l:patterns/basics#hexcasting:raycast)$(action)Archer's Distillation/$ facing the sky.", "hexcasting.page.influences.2": "In addition, I've discovered a curious triplet of influences I've named $(l:patterns/patterns_as_iotas#hexcasting:escape)$(action)Consideration/$, $(l:patterns/patterns_as_iotas#hexcasting:open_paren)$(action)Introspection/$, and $(l:patterns/patterns_as_iotas#hexcasting:close_paren)$(action)Retrospection/$. They seem to have properties of both patterns and other influences, yet act very differently. I can use these to add patterns to my stack as iotas, instead of matching them to actions. $(l:patterns/patterns_as_iotas)My notes on the subject are here/$.", "hexcasting.page.influences.3": "Finally, there seems to be an infinite family of influences that just seem to be a tangled mess of _media. I've named them $(l:casting/influences)$(action)Garbage/$, as they are completely useless. They seem to appear in my stack at various places in response to $(l:casting/mishaps)$(thing)mishaps/$, and appear to my senses as a nonsense jumble.", - + "hexcasting.entry.mishaps2": "Enlightened Mishaps", "hexcasting.page.mishaps2.1": "I have discovered new and horrifying modes of failure. I must not succumb to them.", "hexcasting.page.mishaps2.bad_mindflay.title": "Inert Mindflay", @@ -720,53 +720,53 @@ "hexcasting.page.mishaps2.no_circle": "Tried to cast an action requiring a spell circle without a spell circle.$(br2)Causes light blue sparks, and upends my inventory onto the ground.", "hexcasting.page.mishaps2.no_record.title": "Lack Akashic Record", "hexcasting.page.mishaps2.no_record": "Tried to access an $(l:greatwork/akashiclib)$(item)Akashic Record/$ at a location where there isn't one.$(br2)Causes purple sparks, and steals away some of my experience.", - - + + "_comment": "Items", - + "hexcasting.entry.amethyst": "Amethyst", "hexcasting.page.amethyst.dust": "It seems that I'll find three different forms of amethyst when breaking a crystal inside a geode. The smallest denomination seems to be a small pile of shimmering dust, worth a relatively small amount of _media.", "hexcasting.page.amethyst.shard": "The second is a whole shard of amethyst, of the type non-_Hexcasters might be used to. This has about as much _media inside as five $(l:items/amethyst)$(item)Amethyst Dust/$.", "hexcasting.page.amethyst.crystal": "Finally, I'll rarely find a large crystal crackling with energy. This has about as much _media inside as ten units of $(l:items/amethyst)$(item)Amethyst Dust/$ (or two $(l:items/amethyst)$(item)Amethyst Shards/$).", "hexcasting.page.amethyst.lore": "$(italic)The old man sighed and raised a hand toward the fire. He unlocked a part of his brain that held the memories of the mountains around them. He pulled the energies from those lands, as he learned to do in Terisia City with Drafna, Hurkyl, the archimandrite, and the other mages of the Ivory Towers. He concentrated, and the flames writhed as they rose from the logs, twisting upon themselves until they finally formed a soft smile./$", - + "hexcasting.entry.staff": "Staff", "hexcasting.page.staff.1": "A $(l:items/staff)$(item)Staff/$ is my entry point into casting all _Hexes, large and small. By holding it and pressing $(thing)$(k:use)/$, I begin casting a _Hex; then I can click and drag to draw patterns.$(br2)It's little more than a chunk of _media on the end of a stick; that's all that's needed, after all.", "hexcasting.page.staff.crafting.header": "Staves", "hexcasting.page.staff.crafting.desc": "$(italic)Don't fight; flame, light; ignite; burn bright./$", - + "hexcasting.entry.lens": "Scrying Lens", "hexcasting.page.lens.1": "_Media can have peculiar effects on any type of information, in specific circumstances. Coating a glass in a thin film of it can lead to ... elucidating insights.$(br2)By holding a $(l:items/lens)$(item)Scrying Lens/$ in my hand, certain blocks will display additional information when I look at them.", "hexcasting.page.lens.2": "For example, looking at a piece of $(item)Redstone/$ will display its signal strength. I suspect I will discover other blocks with additional insight as my studies into my art progress.$(br2)In addition, holding it while casting using a $(l:items/staff)$(item)Staff/$ will shrink the spacing between dots, allowing me to draw more on my grid.$(br2)I can also wear it on my head as a strange sort of monocle. This reveals information, but won't shrink my grid. No matter. There must be a way to have both...", "hexcasting.page.lens.crafting.desc": "$(italic)You must learn... to see what you are looking at./$", - + "hexcasting.entry.focus": "Focus", "hexcasting.page.focus.1": "A $(l:items/focus)$(item)Focus/$ can store a single iota.$(br2)When I craft it, it holds the $(l:casting/influences)$(thing)Null/$ influence by default. Using $(l:patterns/readwrite#hexcasting:write)$(action)Scribe's Gambit/$ while holding a $(l:items/focus)$(item)Focus/$ in my other hand will remove the top of the stack and save it into the $(l:items/focus)$(item)Focus/$. Using $(l:patterns/readwrite#hexcasting:read)$(action)Scribe's Reflection/$ will copy whatever iota's in the $(l:items/focus)$(item)Focus/$ and add it to the stack.", "hexcasting.page.focus.2": "It occurs to me that I could conceivably store a whole list of patterns in a $(l:items/focus)$(item)Focus/$, then recall them and evaluate them with $(l:patterns/meta#hexcasting:eval)$(action)Hermes' Gambit/$. This way I can cast complex spells, or parts of spells, without having to draw them over and over.$(br2)I could use this like a slightly less convenient $(l:items/hexcasting#artifact)$(item)Artifact/$, but I think I could get much better dividends by putting common \"phrases\" in a $(l:items/focus)$(item)Focus/$, like the patterns for figuring out where I'm looking.", "hexcasting.page.focus.3": "Also, if I store an entity in a $(l:items/focus)$(item)Focus/$ and try to recall it after the referenced entity has died or otherwise disappeared, the $(l:patterns/readwrite#hexcasting:read)$(action)Scribe's Reflection/$ will add $(l:casting/influences)$(thing)Null/$ to the stack instead.$(br2)Finally, it seems if I wish to protect a $(l:items/focus)$(item)focus/$ from accidentally being overwritten, I can seal it with wax by crafting it with a $(item)Honeycomb/$. Attempting to use $(l:patterns/readwrite#hexcasting:write)$(action)Scribe's Gambit/$ on a sealed focus will fail. $(l:patterns/spells/hexcasting#hexcasting:erase)$(action)Erase Item/$ will remove this seal along with the contents.", "hexcasting.page.focus.crafting.desc": "$(italic)Poison apples, poison worms./$", - + "hexcasting.entry.abacus": "Abacus", "hexcasting.page.abacus.1": "Although there are $(l:patterns/numbers)$(action)patterns for drawing numbers/$, I find them ... cumbersome, to say the least.$(br2)Fortunately, the old masters of my craft invented an ingenious device called an $(l:items/abacus)$(item)Abacus/$ to provide numbers to my casting. I simply set the number to what I want, then read the value using $(l:patterns/readwrite#hexcasting:read)$(action)Scribe's Reflection/$, just like I would read a $(l:items/focus)$(item)Focus/$.", "hexcasting.page.abacus.2": "To operate one, I simply hold it, sneak, and scroll. If in my main hand, the number will increment or decrement by 1, or 10 if I am also holding Control/Command. If in my off hand, the number will increment or decrement by 0.1, or 0.001 if I am also holding Control/Command.$(br2)I can shake the abacus to reset it to zero by sneak-right-clicking.", "hexcasting.page.abacus.crafting.desc": "$(italic)Mathematics? That's for eggheads!/$", - + "hexcasting.entry.spellbook": "Spellbook", "hexcasting.page.spellbook.1": "A $(l:items/spellbook)$(item)Spellbook/$ is the culmination of my art-- it acts like an entire library of $(l:items/focus)$(item)Foci/$. Up to $(thing)sixty-four/$ of them, to be exact.$(br2)Each page can hold a single iota, and I can select the active page (the page that iotas are saved to and copied from) by sneak-scrolling while holding it, or simply holding it in my off-hand and scrolling while casting a _Hex.", "hexcasting.page.spellbook.2": "Like a $(l:items/focus)$(item)Focus/$, there exists a simple method to prevent accidental overwriting. Crafting it with a $(item)Honeycomb/$ will lacquer the current page, preventing $(l:patterns/readwrite#hexcasting:write)$(action)Scribe's Gambit/$ from modifying its contents. Also like a $(l:items/focus)$(item)Focus/$, using $(l:patterns/spells/hexcasting#hexcasting:erase)$(action)Erase Item/$ will remove the lacquer along with the page's contents.$(br2)I can also name each page individually in an anvil. Naming it will change only the name of the currently selected page, for easy browsing.", "hexcasting.page.spellbook.crafting.desc": "$(italic)Wizards love words. Most of them read a great deal, and indeed one strong sign of a potential wizard is the inability to get to sleep without reading something first.", - + "hexcasting.entry.scroll": "Scrolls", "hexcasting.page.scroll.1": "A $(l:items/scroll)$(item)Scroll/$ is a convenient method of sharing a pattern with others. I can copy a pattern onto one with $(l:patterns/readwrite#hexcasting:write)$(action)Scribe's Gambit/$, after which it will display in a tooltip.$(br2)I can also place them on the wall as decoration or edification, like a painting, in sizes from 1x1 to 3x3 blocks. Using $(l:items/amethyst)$(item)Amethyst Dust/$ on such a scroll will have it display the stroke order.", "hexcasting.page.scroll.2": "In addition, I can also find so-called $(l:items/scroll)$(item)Ancient Scrolls/$ in the dungeons and strongholds of the world. These contain the stroke order of $(thing)Great Spells/$, powerful magicks rumored to be too powerful for the hands and minds of mortals...$(br2)If those \"mortals\" couldn't cast them, I'm not sure they deserve to know them.", "hexcasting.page.scroll.crafting.desc": "$(italic)I write upon clean white parchment with a sharp quill and the blood of my students, divining their secrets./$", - + "hexcasting.entry.slate": "Slates", "hexcasting.page.slate.1": "$(l:items/slate)$(item)Slates/$ are similar to $(l:items/scroll)$(item)Scrolls/$; I can copy a pattern to them and place them in the world to display the pattern.$(br2)However, I have read vague tales of grand assemblies of $(l:items/slate)$(item)Slates/$, used to cast $(l:greatwork/spellcircles)$(thing)great rituals/$ more powerful than can be handled by a $(l:items/staff)$(item)Staff/$.", "hexcasting.page.slate.2": "Perhaps this knowledge will be revealed to me with time. But for now, I suppose they make a quaint piece of decor.$(br2)At the least, they can be placed on any side of a block, unlike $(l:items/scroll)$(item)Scrolls/$.", "hexcasting.page.slate.crafting.desc": "$(italic)This is the letter \"a.\" Learn it./$", "hexcasting.page.slate.3": "I'm also aware of other types of $(l:items/slate)$(item)Slates/$, slates that do not contain patterns but seem to be inlaid with other ... strange ... oddities. It hurts my brain to think about them, as if my thoughts get bent around their designs, following their pathways, bending and wefting through their labyrinthine depths, through and through and through channeled through and processed and--$(br2)... I almost lost myself. Maybe I should postpone my studies of those.", - + "hexcasting.entry.hexcasting": "Casting Items", "hexcasting.page.hexcasting.1": "Although the flexibility of casting _Hexes \"on the go\" with my $(l:items/staff)$(item)Staff/$ is quite helpful, it's a huge pain to have to wave it around repeatedly just to accomplish a basic task. If I could save a common spell for later reuse, it would simplify things a lot-- and allow me to share my _Hexes with friends, too.", "hexcasting.page.hexcasting.2": "To do this, I can craft one of three types of magic items: $(l:items/hexcasting)$(item)Cyphers/$, $(l:items/hexcasting)$(item)Trinkets/$, or $(l:items/hexcasting)$(item)Artifacts/$. All of them hold the patterns of a given _Hex inside, along with a small battery containing _media.$(br2)Simply holding one and pressing $(thing)$(k:use)/$ will cast the patterns inside, as if the holder had cast them out of a staff, using its internal battery.", @@ -774,48 +774,48 @@ "hexcasting.page.hexcasting.4": "$(l:items/hexcasting)$(item)Artifacts/$ are the most powerful of all-- after their _media is depleted, they can use $(l:items/amethyst)$(item)Amethyst/$ from the holder's inventory to pay for the _Hex, just as I do when casting with a $(l:items/staff)$(item)Staff/$. Of course, this also means the spell might consume their mind if there's not enough $(l:items/amethyst)$(item)Amethyst/$.$(br2)Once I've made an empty magic item in a mundane crafting bench, I infuse the _Hex into it using (what else but) a spell appropriate to the item. $(l:patterns/spells/hexcasting)I've catalogued the patterns here./$", "hexcasting.page.hexcasting.5": "Each infusion spell requires an entity and a list of patterns on the stack. The entity must be a _media-holding item entity (i.e. $(l:items/amethyst)$(item)amethyst/$ crystals, dropped on the ground); the entity is consumed and forms the battery.$(br2)Usefully, it seems that the _media in the battery is not consumed in chunks as it is when casting with a $(l:items/staff)$(item)Staff/$-- rather, the _media \"melts down\" into one continuous pool. Thus, if I store a _Hex that only costs one $(l:items/amethyst)$(item)Amethyst Dust/$'s worth of media, a $(l:items/amethyst)$(item)Charged Crystal/$ used as the battery will allow me to cast it 10 times.", "hexcasting.page.hexcasting.crafting.desc": "$(italic)We have a saying in our field: \"Magic isn't\". It doesn't \"just work,\" it doesn't respond to your thoughts, you can't throw fireballs or create a roast dinner from thin air or turn a bunch of muggers into frogs and snails./$", - + "hexcasting.entry.phials": "Phials of Media", "hexcasting.page.phials.1": "I find it quite ... irritating, how Nature refuses to give me change for my work. If all I have on hand is $(l:items/amethyst)$(item)Charged Amethyst/$, even the tiniest $(l:patterns/basics#hexcasting:raycast)$(action)Archer's Purification/$ will consume the entire crystal, wasting the remaining _media.$(br2)Fortunately, it seems I've found a way to somewhat allay this problem.", "hexcasting.page.phials.2": "I've found old scrolls describing a $(item)Glass Bottle/$ infused with _media. When casting _Hexes, my spells would then draw _media out of the phial. The liquid form of the _media would let me take exact change, so to speak; nothing would be wasted. It's quite like the internal battery of a $(l:items/hexcasting)$(item)Trinket/$, or similar; I can even $(l:patterns/spells/hexcasting#hexcasting:recharge)$(action)Recharge/$ them in the same manner.", "hexcasting.page.phials.3": "Unfortunately, the art of actually $(italic)making/$ the things seems to have been lost to time. I've found a $(l:patterns/great_spells/make_battery#hexcasting:craft/battery)$(thing)hint at the pattern used to craft it/$, but the technique is irritatingly elusive, and I can't seem to do it successfully. I suspect I will figure it out with study and practice, though. For now, I will simply deal with the wasted _media...$(br2)But I won't settle for it forever.", "hexcasting.page.phials.desc": "$(italic)Drink the milk./$", - + "hexcasting.entry.pigments": "Pigments", "hexcasting.page.pigments.1": "Although their names were lost to time, the old practitioners of my art seem to have identified themselves by a color, emblematic of them and their spells. It seems a special kind of pigment, offered to Nature in the right way, would \"[...] paint one's thoughts in a manner pleasing to Nature, inducing a miraculous change in personal colour.\"", "hexcasting.page.pigments.2": "I'm not certain on the specifics of how it works, but I believe I have isolated the formulae for many different colors of pigments. To use a pigment, I hold it in one hand while casting $(l:patterns/spells/colorize)$(action)Internalize Pigment/$ with the other, consuming the pigment and marking my mind with its color.$(br2)The pigments seem to affect the color of the sparks of media emitted out of a staff when I cast a _Hex, as well as my $(l:patterns/spells/sentinels)$(thing)sentinel/$.", "hexcasting.page.pigments.colored.crafting.header": "Chromatic Pigments", "hexcasting.page.pigments.colored.crafting.desc": "Pigments in all the colors of the rainbow.", "hexcasting.page.pigments.uuid.crafting.desc": "And finally, a pigment with a color wholly unique to me.$(br2)$(italic)And all the colors I am inside have not been invented yet./$", - + "hexcasting.entry.edified": "Edified Trees", "hexcasting.page.edified.1": "By infusing _media into a sapling via the use of $(l:patterns/spells/blockworks#hexcasting:edify)$(action)Edify Sapling/$, I can create what is called an $(l:items/edified)$(thing)Edified Tree/$. They tend to be tall and pointy, with ridged bark and wood that grows in a strange spiral pattern. Their leaves come in three pretty colors.", "hexcasting.page.edified.2": "I would assume the wood would have some properties relevant to _Hexcasting. But, if it does, I cannot seem to find them. For all intents and purposes it appears to be just wood, albeit of a very strange color.$(br2)I suppose for now I will use it for decoration; the full suite of standard wood blocks can be crafted from them.$(br2)Of course, I can strip them with an axe as well.", "hexcasting.page.edified.crafting.desc": "$(italic)Their smooth trunks, with white bark, gave the effect of enormous columns sustaining the weight of an immense foliage, full of shade and silence./$", - + "hexcasting.entry.jeweler_hammer": "Jeweler's Hammer", "hexcasting.page.jeweler_hammer.1": "After being careless with the sources of my _media one too many times, I have devised a tool to work around my clumsiness.$(br2)Using the delicate nature of crystallized _media as a fixture for a pickaxe, I can create the $(l:items/jeweler_hammer)$(item)Jeweler's Hammer/$. It acts like an $(item)Iron Pickaxe/$, for the most part, but can't break anything that takes up an entire block's space.", "hexcasting.page.jeweler_hammer.crafting.desc": "$(italic)Carefully, she cracked the half ruby, letting the spren escape./$", - + "hexcasting.entry.decoration": "Decorative Blocks", "hexcasting.page.decoration.1": "In the course of my studies I have discovered some building blocks and trifles that I may find aesthetically pleasing. I've compiled the methods of making them here.", "hexcasting.page.decoration.ancient_scroll.crafting.desc": "Brown dye works well enough to simulate the look of an $(l:items/scroll)$(item)ancient scroll/$.", "hexcasting.page.decoration.tiles.crafting.desc": "$(l:items/decoration)$(item)Amethyst Tiles/$ can also be made in a Stonecutter.$(br2)$(l:items/decoration)$(item)Blocks of Amethyst Dust/$ (next page) will fall like sand.", "hexcasting.page.decoration.sconce.crafting.desc": "$(l:items/decoration)$(item)Amethyst Sconces/$ emit light and particles, as well as a pleasing chiming sound.", - - + + "_comment": "The Work", - + "hexcasting.entry.the_work": "The Work", "hexcasting.page.the_work.1": "I have seen so many things. Unspeakable things. Innumerable things. I could write three words and turn my mind inside-out and smear my brains across the shadowed walls of my skull to decay into fluff and nothing.", "hexcasting.page.the_work.2": "I have seen staccato-needle patterns and acid-etched schematics written on the inside of my eyelids. They smolder there-- they dance, they taunt, they $(italic)ache/$. I'm possessed by an intense $(italic)need/$ to draw them, create them. Form them. Liberate them from the gluey shackles of my mortal mind-- present them in their Glory to the world for all to see.$(p)All shall see.$(p)All will see.", - + "hexcasting.entry.brainsweeping": "On the Flaying of Minds", "hexcasting.page.brainsweeping.1": "A secret was revealed to me. I saw it. I cannot forget its horror. The idea skitters across my brain.$(br2)I believed-- oh, foolishly, I $(italic)believed/$ --that _Media is the spare energy left over by thought. But now I $(italic)know/$ what it is: the energy $(italic)of/$ thought.", "hexcasting.page.brainsweeping.2": "It is produced by thinking sentience and allows sentience to think. It is a knot tying that braids into its own string. The Entity I naively anthromorphized as Nature is simply a grand such tangle, or perhaps the set of all tangles, or ... if I think it hurts I have so many synapses and all of them can think pain at once ALL OF THEM CAN SEE$(br2)I am not holding on. My notes. Quickly.", "hexcasting.page.brainsweeping.3": "The villagers of this world have enough consciousness left to be extracted. Place it into a block, warp it, change it. Intricate patterns caused by different patterns of thought, the abstract neural pathways of their jobs and lives mapped into the cold physic of solid atoms.$(br2)This is what $(l:patterns/great_spells/brainsweep)$(action)Flay Mind/$ does, the extraction. Target the villager entity and the destination block. Ten $(l:items/amethyst)$(item)Charged Amethyst/$ for this perversion of will.", "hexcasting.page.brainsweeping.budding_amethyst": "And an application. For this flaying, any sort of villager will do, if it has developed enough. Other recipes require more specific types. NO MORE must I descend into the hellish earth for my _media.", - + "hexcasting.entry.spellcircles": "Spell Circles", "hexcasting.page.spellcircles.1": "I KNOW what the $(l:items/slate)$(item)slates/$ are for. The grand assemblies lost to time. The patterns scribed on them can be actuated in sequence, automatically. Thought and power ricocheting through, one by one by one by one by one by through and through and THROUGH AND -- I must not I must not I should know better than to think that way.", "hexcasting.page.spellcircles.2": "To start the ritual I need an $(l:greatwork/impetus)$(item)Impetus/$ to create a self-sustaining wave of _media. That wave travels along a track of $(l:items/slate)$(item)slates/$ or other blocks suitable for the energies, one by one, collecting any patterns it finds. Once the wave circles back around to the $(l:greatwork/impetus)$(item)Impetus/$, all the patterns encountered are cast in order.$(br2)The direction the _media exits any given block MUST be unambiguous, or the casting will fail at the block with too many neighbors.", @@ -825,7 +825,7 @@ "hexcasting.page.spellcircles.6": "There is also a limit on the number of blocks the wave can travel through before it disintegrates, but it is large enough I doubt I will have any trouble.$(br2)Conversely, there are some actions that can only be cast from a circle. Fortunately, none of them are spells; they all seem to deal with components of the circle itself. My notes on the subject are $(l:patterns/circle)here/$.", "hexcasting.page.spellcircles.7": "I also found a sketch of a spell circle used by the ancients buried in my notes. Facing this page is my (admittedly poor) copy of it.$(br2)The patterns there would have been executed counter-clockwise, starting with $(l:patterns/basics#hexcasting:get_caster)$(action)Mind's Reflection/$ and ending with $(l:patterns/great_spells/teleport#hexcasting:teleport)$(action)Greater Teleport/$.", "hexcasting.page.spellcircles.teleport_circle.title": "Teleportation Circle", - + "hexcasting.entry.impetus": "Impetuses", "hexcasting.page.impetus.1": "The fluctuation of _media required to actuate a spell circle is complex. Even the mortal with sharpest eyes and steadiest hands could not serve as an $(l:greatwork/impetus)$(item)Impetus/$ and weave _media into the self-sustaining oroboros required.$(br2)The problem is that the mind is too full of other useless $(italics)garbage/$.", "hexcasting.page.impetus.2": "At a ... metaphysical level-- I must be careful with these thoughts, I cannot lose myself, I have become too valuable --moving _media moves the mind, and the mind must be moved for the process to work. But, the mind is simply too $(italic)heavy/$ with other thoughts to move nimbly enough.$(br2)It is like an artisan trying to repair a watch while wearing mittens.", @@ -836,27 +836,27 @@ "hexcasting.page.impetus.impetus_storedplayer.1": "A $(l:greatwork/impetus)$(item)Cleric Impetus/$ must be bound to a player by using an item with a reference to that player, like a $(l:items/focus)$(item)Focus/$, on the block. Then, it activates when receiving a redstone signal.", "hexcasting.page.impetus.impetus_storedplayer.2": "Peculiarly to this $(l:greatwork/impetus)$(item)Impetus/$, the bound player, as well as a small region around them, are always accessible to the spell circle. It's as if they were standing within the bounds of the circle, no matter how far away they might stand.$(br2)The bound player is shown when looking at a $(l:greatwork/impetus)$(item)Cleric Impetus/$ through a $(l:items/lens)$(item)Scrying Lens/$.", "hexcasting.page.impetus.impetus_look": "A $(l:greatwork/impetus)$(item)Fletcher Impetus/$ activates when looked at for a short time.", - + "hexcasting.entry.directrix": "Directrices", "hexcasting.page.directrix.1": "Simpler than the task of creating a self-sustaining wave of _media is the task of directing it. Ordinarily the wave disintegrates when coming upon a crossroads, but with a mind to guide it, an exit direction can be controlled.$(br2)This manipulation is not nearly so fine as the delicacy of actuating a spell circle. In fact, it might be possible to do it by hand... but the packaged minds I have access to now would be so very convenient.", "hexcasting.page.directrix.2": "A $(l:greatwork/directrix)$(item)Directrix/$ accepts a wave of _media and determines to which of the arrows it will exit from, depending on the villager mind inside.$(br2)I am not certain if this idea was bestowed upon me, or if my mind is bent around the barrier enough to splint off its own ideas now... but if the idea came from my own mind, if I thought it, can it be said it was bestowed? The brain is a vessel for the mind and the mind is a vessel for ideas and the ideas vessel thought and thought sees all and knows all-- I MUST N O T", "hexcasting.page.directrix.empty_directrix": "Firstly, a design for the cradle ... although, perhaps \"substrate\" would be more accurate a word. Without a mind guiding it, the output direction is determined by microscopic fluctuations in the _media wave and surroundings, making it effectively random.", "hexcasting.page.directrix.directrix_redstone": "A $(l:greatwork/directrix)$(item)Mason Directrix/$ switches output side based on a redstone signal. Without a signal, the exit is the _media-color side; with a signal, the exit is the redstone-color side.", - + "hexcasting.entry.akashiclib": "Akashic Libraries", "hexcasting.page.akashiclib.1": "I KNOW SO MUCH it is ONLY RIGHT to have a place to store it all. Information can be stored in books but it is oh so so so so $(italic)slow/$ to write by hand and read by eye. I demand BETTER. And so I shall MAKE better.$(br2)... I am getting worse ... do not know if I have time to write everything bursting through my head before expiring.", "hexcasting.page.akashiclib.2": "The library. Here. My plans.$(br2)Like how patterns are associated with actions, I can associate my own patterns with iotas in any way I choose. An $(l:greatwork/akashiclib)$(item)Akashic Record/$ controls the library, and each $(l:greatwork/akashiclib)$(item)Akashic Bookshelf/$ stores one pattern mapped to one iota. These must all be directly connected together, touching, within 32 blocks. An $(l:greatwork/akashiclib)$(item)Akashic Ligature/$ doesn't do anything but count as a connecting block, to extend the size of my library.", "hexcasting.page.akashiclib.akashic_record": "Allocating and assigning patterns is simple but oh so boring. I have better things to do. I will need a mind well-used to its work for the extraction to stay sound.", "hexcasting.page.akashiclib.3": "Then to operate the library is simple, the patterns are routed through the librarian and it looks them up and returns the iota to you. Two actions do the work. $(l:patterns/akashic_patterns)Notes here/$.$(br2)Using an empty $(l:items/scroll)$(item)scroll/$ on a bookshelf copies the pattern there onto the $(l:items/scroll)$(item)scroll/$. Sneaking and using an empty hand clears the datum in the shelf.", - + "_comment": "Patterns", - + "hexcasting.entry.readers_guide": "How to Read this Section", "hexcasting.page.readers_guide.1": "I've divided all the valid patterns I've found into sections based on what they do, more or less. I've written down the stroke order of the patterns as well, if I managed to find it in my studies, with the start of the pattern marked with a red dot.$(br2)If an action is cast by multiple patterns, as is the case with some, I'll write them all side-by-side.", "hexcasting.page.readers_guide.2": "For a few patterns, however, I was $(italic)not/$ able to find the stroke order, just the shape. I suspect the order to draw them in are out there, locked away in the ancient libraries and dungeons of the world.$(br2)In such cases I just draw the pattern without any information on the order to draw it in.", "hexcasting.page.readers_guide.3": "I also write the types of iota that the action will consume or modify, a \"\u2192\", and the types of iota the action will create.$(p)For example, \"$(n)vector, number/$ \u2192 $(n)vector/$\" means the action will remove a vector and a number from the top of the stack, and then add a vector; or, put another way, will remove a number from the stack, and then modify the vector at the top of the stack. (The number needs to be on the top of the stack, with the vector right below it.)", "hexcasting.page.readers_guide.4": "\"\u2192 $(n)entity/$\" means it'll just push an entity. \"$(n)entity, vector/$ \u2192\" means it removes an entity and a vector, and doesn't push anything.$(br2)Finally, if I find the little dot marking the stroke order too slow or confusing, I can press $(thing)Control/Command/$ to display a gradient, where the start of the pattern is darkest and the end is lightest. This works on scrolls and when casting, too!", - + "hexcasting.entry.basics_pattern": "Basic Patterns", "hexcasting.page.basics_pattern.get_caster": "Adds me, the caster, to the stack.", "hexcasting.page.basics_pattern.entity_pos/eye": "Transforms an entity on the stack into the position of its eyes. I should probably use this on myself.", @@ -870,7 +870,7 @@ "hexcasting.page.basics_pattern.raycast/entity": "Like $(l:patterns/basics#hexcasting:raycast)$(action)Archer's Distillation/$, but instead returns the $(italic)entity/$ I am looking at. Costs a negligible amount of _media.", "hexcasting.page.basics_pattern.get_entity_height": "Transforms an entity on the stack into its height.", "hexcasting.page.basics_pattern.get_entity_velocity": "Transforms an entity on the stack into the direction in which it's moving, with the speed of that movement as that direction's magnitude.", - + "hexcasting.entry.numbers": "Number Literals", "hexcasting.page.numbers.1": "Irritatingly, there is no easy way to draw numbers. Here is the method Nature deigned to give us.", "hexcasting.page.numbers.2": "First, I draw one of the two shapes shown on the other page. Next, the $(italic)angles/$ following will modify a running count starting at 0.$(li)Forward: Add 1$(li)Left: Add 5$(li)Right: Add 10$(li)Sharp Left: Multiply by 2$(li)Sharp Right: Divide by 2.$(br)The clockwise version of the pattern, on the right of the other page, will negate the value at the very end. (The left-hand counter-clockwise version keeps the number positive).$(p)Once I finish drawing, the number's pushed to the top of the stack.", @@ -883,7 +883,7 @@ "hexcasting.page.numbers.example.4.5.header": "Example 4", "hexcasting.page.numbers.example.4.5": "This pattern pushes 4.5: 5 / 2 + 1 + 1.", "hexcasting.page.numbers.3": "In certain cases it might be easier to just use an $(l:items/abacus)$(item)Abacus/$. But, it's worth knowing the \"proper\" way to do things.", - + "hexcasting.entry.math": "Mathematics", "hexcasting.page.math.numvec": "Many mathematical operations function on both numbers and vectors. Such arguments are written as \"num/vec\".", "hexcasting.page.math.add.1": "Perform addition.", @@ -905,7 +905,7 @@ "hexcasting.page.math.modulo": "Takes the modulus of two numbers. This is the amount $(italics)remaining/$ after division - for example, 5 %% 2 is 1, and 5 %% 3 is 2.", "hexcasting.page.math.coerce_axial": "Coerces a vector to its nearest axial direction, a unit vector. The zero vector is unaffected.", "hexcasting.page.math.random": "Creates a random number between 0 and 1.", - + "hexcasting.entry.advanced_math": "Advanced Mathematics", "hexcasting.page.advanced_math.sin": "Takes the sine of an angle in radians, yielding the vertical component of that angle drawn on a unit circle. Related to the values of $(l:patterns/consts#hexcasting:const/double/pi)$(thing)π/$ and $(l:patterns/consts#hexcasting:const/double/tau)$(thing)τ/$.", "hexcasting.page.advanced_math.cos": "Takes the cosine of an angle in radians, yielding the horizontal component of that angle drawn on a unit circle. Related to the values of $(l:patterns/consts#hexcasting:const/double/pi)$(thing)π/$ and $(l:patterns/consts#hexcasting:const/double/tau)$(thing)τ/$.", @@ -914,7 +914,7 @@ "hexcasting.page.advanced_math.arccos": "Takes the inverse cosine of a value with absolute value 1 or less, yielding the angle whose cosine is that value. Related to the values of $(l:patterns/consts#hexcasting:const/double/pi)$(thing)π/$ and $(l:patterns/consts#hexcasting:const/double/tau)$(thing)τ/$.", "hexcasting.page.advanced_math.arctan": "Takes the inverse tangent of a value, yielding the angle whose tangent is that value. Related to the values of $(l:patterns/consts#hexcasting:const/double/pi)$(thing)π/$ and $(l:patterns/consts#hexcasting:const/double/tau)$(thing)τ/$.", "hexcasting.page.advanced_math.logarithm": "Removes the number at the top of the stack, then takes the logarithm of the number at the top using the other number as its base. Related to the value of $(l:patterns/consts#hexcasting:const/double/e)$(thing)$(italic)e/$.", - + "hexcasting.entry.sets": "Sets", "hexcasting.page.sets.numlist": "Set operations are odd, in that some of them can accept two numbers or two lists, but not a combination thereof. Such arguments will be written as \"num, num/list, list\".$(br2)When numbers are used in those operations, they are being used as so-called binary \"bitsets\", lists of 1 and 0, true and false, \"on\" and \"off\".", "hexcasting.page.sets.or.1": "Unifies two sets.", @@ -925,7 +925,7 @@ "hexcasting.page.sets.xor.2": "As such:$(li)With two numbers at the top of the stack, combines them into a bitset containing every \"on\" bit present in $(italics)exactly one/$ of the bitsets.$(li)With two lists, this creates a list of every element in both lists that is $(italics)not/$ in the other list.", "hexcasting.page.sets.not": "Takes the inversion of a bitset, changing all \"on\" bits to \"off\" and vice versa. In my experience, this will take the form of that number negated and decreased by one. For example, 0 will become -1, and -100 will become 99.", "hexcasting.page.sets.to_set": "Removes duplicate entries from a list.", - + "hexcasting.entry.consts": "Constants", "hexcasting.page.consts.const/null": "Adds the $(l:casting/influences)$(thing)Null/$ influence to the top of the stack.", "hexcasting.page.consts.const/true": "Adds $(thing)True/$ to the top of the stack.", @@ -937,7 +937,7 @@ "hexcasting.page.consts.const/double/tau": "Adds τ, the radial representation of a complete circle, to the stack.", "hexcasting.page.consts.const/double/pi": "Adds π, the radial representation of half a circle, to the stack.", "hexcasting.page.consts.const/double/e": "Adds $(italic)e/$, the base of natural logarithms, to the stack.", - + "hexcasting.entry.stackmanip": "Stack Manipulation", "hexcasting.page.stackmanip.pseudo-novice.title": "Novice's Gambit", "hexcasting.page.stackmanip.pseudo-novice": "Removes the first iota from the stack.$(br2)This seems to be a special case of $(l:patterns/stackmanip#hexcasting:mask)$(action)Bookkeeper's Gambit/$.", @@ -957,7 +957,7 @@ "hexcasting.page.stackmanip.swizzle.1": "Rearranges the top elements of the stack based on the given numerical code, which is the index of the permutation wanted.", "hexcasting.page.stackmanip.swizzle.2": "Although I can't pretend to know the mathematics behind calculating this permutation code, I have managed to dig up an extensive chart of them, enumerating all permutations of up to six elements.$(br2)If I wish to do further study, the key word is \"Lehmer Code.\"", "hexcasting.page.stackmanip.swizzle.link": "Table of Codes", - + "hexcasting.entry.logic": "Logical Operators", "hexcasting.page.logic.bool_coerce": "Convert an argument to a boolean. The number $(thing)0/$, $(l:influences#null)$(thing)Null/$, and the empty list become False; everything else becomes True.", "hexcasting.page.logic.not": "If the argument is True, return False; if it is False, return True.", @@ -971,7 +971,7 @@ "hexcasting.page.logic.less": "If the first argument is less than the second, return True. Otherwise, return False.", "hexcasting.page.logic.greater_eq": "If the first argument is greater than or equal to the second, return True. Otherwise, return False.", "hexcasting.page.logic.less_eq": "If the first argument is less than or equal to the second, return True. Otherwise, return False.", - + "hexcasting.entry.entities": "Entities", "hexcasting.page.entities.get_entity": "Transform the position on the stack into the entity at that location (or $(l:casting/influences)$(thing)Null/$ if there isn't one).", "hexcasting.page.entities.get_entity/animal": "Transform the position on the stack into the animal at that location (or $(l:casting/influences)$(thing)Null/$ if there isn't one).", @@ -990,7 +990,7 @@ "hexcasting.page.entities.zone_entity/living": "Take a position and maximum distance on the stack, and combine them into a list of living creatures near the position.", "hexcasting.page.entities.zone_entity/not_living": "Take a position and maximum distance on the stack, and combine them into a list of non-living entities near the position.", "hexcasting.page.entities.zone_entity": "Take a position and maximum distance on the stack, and combine them into a list of all entities near the position.", - + "hexcasting.entry.lists": "List Manipulation", "hexcasting.page.lists.index": "Remove the number at the top of the stack, then replace the list at the top with the nth element of that list (where n is the number you removed). Replaces the list with $(l:casting/influences)$(thing)Null/$ if the number is out of bounds.", "hexcasting.page.lists.slice": "Remove the two numbers at the top of the stack, then take a sublist of the list at the top of the stack between those indices, lower bound inclusive, upper bound exclusive. For example, the 0, 2 sublist of [0, 1, 2, 3, 4] would be [0, 1].", @@ -1007,7 +1007,7 @@ "hexcasting.page.lists.splat": "Remove the list at the top of the stack, then push its contents to the stack.", "hexcasting.page.lists.construct": "Remove the top iota, then add it as the first element to the list at the top of the stack.", "hexcasting.page.lists.deconstruct": "Remove the first iota from the list at the top of the stack, then push that iota to the stack.", - + "hexcasting.entry.patterns_as_iotas": "Patterns as Iotas", "hexcasting.page.patterns_as_iotas.1": "One of the many peculiarities of this art is that $(italic)patterns themselves/$ can act as iotas-- I can even put them onto my stack when casting.$(br2)This raises a fairly obvious question: how do I express them? If I simply drew a pattern, it would hardly tell Nature to add it to my stack-- rather, it would simply be matched to an action.", "hexcasting.page.patterns_as_iotas.2": "Fortunately, Nature has provided me with a set of $(l:casting/influences)influences/$ that I can use to work with patterns directly.$(br2)In short, $(l:patterns/patterns_as_iotas#hexcasting:escape)$(action)Consideration/$ lets me add one pattern to the stack, and $(l:patterns/patterns_as_iotas#hexcasting:open_paren)$(action)Introspection/$ and $(l:patterns/patterns_as_iotas#hexcasting:close_paren)$(action)Retrospection/$ let me add a whole list.", @@ -1016,7 +1016,7 @@ "hexcasting.page.patterns_as_iotas.parens.1": "Drawing $(l:patterns/patterns_as_iotas#hexcasting:open_paren)$(action)Introspection/$ makes my drawing of patterns act differently, for a time. Until I draw $(l:patterns/patterns_as_iotas#hexcasting:open_paren)$(action)Retrospection/$, the patterns I draw are saved. Then, when I draw $(l:patterns/patterns_as_iotas#hexcasting:close_paren)$(action)Retrospection/$, they are added to the stack as a list iota.", "hexcasting.page.patterns_as_iotas.parens.2": "If I draw another $(l:patterns/patterns_as_iotas#hexcasting:close_paren)$(action)Introspection/$, it'll still be saved to the list, but I'll then have to draw $(italic)two/$ $(l:patterns/patterns_as_iotas#hexcasting:close_paren)$(action)Retrospections/$ to get back to normal casting.", "hexcasting.page.patterns_as_iotas.parens.3": "Also, I can escape the special behavior of $(l:patterns/patterns_as_iotas#hexcasting:open_paren)$(action)Intro-/$ and $(l:patterns/patterns_as_iotas#hexcasting:close_paren)$(action)Retrospection/$ by drawing a $(l:patterns/patterns_as_iotas#hexcasting:escape)$(action)Consideration/$ before them, which will simply add them to the list without affecting which the number of $(l:patterns/patterns_as_iotas#hexcasting:close_paren)$(action)Retrospections/$ I need to return to casting.$(br2)If I draw two $(l:patterns/patterns_as_iotas#hexcasting:escape)$(action)Considerations/$ in a row while $(l:patterns/patterns_as_iotas#hexcasting:open_paren)$(action)introspecting/$, it will add a single $(l:patterns/patterns_as_iotas#hexcasting:escape)$(action)Consideration/$ to the list.", - + "hexcasting.entry.readwrite": "Reading and Writing", "hexcasting.page.readwrite.1": "This section deals with the storage of $(thing)Iotas/$ in a more permanent medium. Nearly any iota can be stored to a suitable item, such as a $(l:items/focus)$(item)Focus/$ or $(l:items/spellbook)$(item)Spellbook/$), and read back later. Certain items, such as an $(l:items/abacus)$(item)Abacus/$, can only be read from.$(br2)Iotas are usually read and written from the other hand, but it is also possible to read and write with an item when it is sitting on the ground as an item entity, or when in an item frame.", "hexcasting.page.readwrite.2": "There may be other entities I can interact with in this way. For example, a $(l:items/scroll)$(item)Scroll/$ hung on the wall can have its pattern read off of it.$(br2)However, it seems I am unable to save a reference to another player, only me. I suppose an entity reference is similar to the idea of a True Name; perhaps Nature is helping to keep our Names out of the hands of enemies. If I want a friend to have my Name I can make a $(l:items/focus)$(item)Focus/$ for them.", @@ -1032,7 +1032,7 @@ "hexcasting.page.readwrite.local": "Items are not the only places I can store information, however. I am also able to store that information in the _media of the _Hex itself, much like the stack, but separate. Texts refer to this as the $(l:patterns/readwrite#hexcasting:local)$(thing)ravenmind/$. It holds a single iota, much like a $(l:items/focus)$(item)Focus/$, and begins with $(l:casting/influences)$(thing)Null/$ like the same. It is preserved between iterations of $(l:patterns/meta#hexcasting:for_each)$(action)Thoth's Gambit/$, but only lasts as long as the _Hex it's a part of. Once I stop casting, the value will be lost.", "hexcasting.page.readwrite.write/local": "Removes the top iota from the stack, and saves it to my $(l:patterns/readwrite#hexcasting:local)$(thing)ravenmind/$, storing it there until I stop casting the _Hex.", "hexcasting.page.readwrite.read/local": "Copy the iota out of my $(l:patterns/readwrite#hexcasting:local)$(thing)ravenmind/$, which I likely just wrote with $(l:patterns/readwrite#hexcasting:write/local)$(action)Huginn's Gambit/$.", - + "hexcasting.entry.meta": "Meta-evaluation", "hexcasting.page.meta.eval.1": "Remove a pattern or list of patterns from the stack, then cast them as if I had drawn them myself with my $(l:items/staff)$(item)Staff/$ (until a $(l:patterns/meta#hexcasting:halt)$(action)Charon's Gambit/$ is encountered). If an iota is escaped with $(l:patterns/patterns_as_iotas#hexcasting:escape)$(action)Consideration/$ or $(l:patterns/patterns_as_iotas#hexcasting:open_paren)$(action)its ilk/$, it will be pushed to the stack. Otherwise, non-patterns will fail.", "hexcasting.page.meta.eval.2": "This can be $(italic)very/$ powerful in tandem with $(l:items/focus)$(item)Foci/$.$(br2)It also makes the bureaucracy of Nature a \"Turing-complete\" system, according to one esoteric scroll I found.$(br2)However, it seems there's a limit to how many times a _Hex can cast itself-- Nature doesn't look kindly on runaway spells!$(br2)In addition, with the energies of the patterns occurring without me to guide them, any mishap will cause the remaining actions to become too unstable and immediately unravel.", @@ -1040,25 +1040,25 @@ "hexcasting.page.meta.for_each.2": "More specifically, for each element in the second list, it will:$(li)Create a new stack, with everything on the current stack plus that element$(li)Draw all the patterns in the first list$(li)Save all the iotas remaining on the stack to a list$(br)Then, after all is said and done, pushes the list of saved iotas onto the main stack.$(br2)No wonder all the practitioners of this art go mad.", "hexcasting.page.meta.halt.1": "This pattern forcibly halts a _Hex. This is mostly useless on its own, as I could simply just stop writing patterns, or put down my staff.", "hexcasting.page.meta.halt.2": "But when combined with $(l:patterns/meta#hexcasting:eval)$(action)Hermes'/$ or $(l:patterns/meta#hexcasting:for_each)$(action)Thoth's Gambits/$, it becomes $(italics)far/$ more interesting. Those patterns serve to 'contain' that halting, and rather than ending the entire _Hex, those gambits end instead. This can be used to cause $(l:patterns/meta#hexcasting:for_each)$(action)Thoth's Gambit/$ not to operate on every iota it's given. An escape from the madness, as it were.", - + "hexcasting.entry.circle_patterns": "Spell Circle Patterns", "hexcasting.page.circle_patterns.disclaimer": "These patterns must be cast from a $(l:greatwork/spellcircles)$(item)Spell Circle/$; trying to cast them through a $(l:items/staff)$(item)Staff/$ will fail rather spectacularly.", "hexcasting.page.circle_patterns.circle/impetus_pos": "Returns the position of the $(l:greatwork/impetus)$(item)Impetus/$ of this spell circle.", "hexcasting.page.circle_patterns.circle/impetus_dir": "Returns the direction the $(l:greatwork/impetus)$(item)Impetus/$ of this spell circle is facing as a unit vector.", "hexcasting.page.circle_patterns.circle/bounds/min": "Returns the position of the lower-north-west corner of the bounds of this spell circle.", "hexcasting.page.circle_patterns.circle/bounds/max": "Returns the position of the upper-south-east corner of the bounds of this spell circle.", - + "hexcasting.entry.akashic_patterns": "Akashic Patterns", "hexcasting.page.akashic_patterns.akashic/read": "Read the iota associated with the given pattern out of the $(l:greatwork/akashiclib)$(item)Akashic Library/$ with its $(l:greatwork/akashiclib)$(item)Record/$ at the given position. This has no range limit. Costs about one $(l:items/amethyst)$(item)Amethyst Dust/$.", "hexcasting.page.akashic_patterns.akashic/write": "Associate the iota with the given pattern in the $(l:greatwork/akashiclib)$(item)Akashic Library/$ with its $(l:greatwork/akashiclib)$(item)Record/$ at the given position. This $(italic)does/$ have a range limit. Costs about one $(l:items/amethyst)$(item)Amethyst Dust/$.", - + "_comment": "Normal Spells", - + "hexcasting.entry.itempicking": "Working with Items", "hexcasting.page.itempicking.1": "Certain spells, such as $(l:patterns/spells/blockworks#hexcasting:place_block)$(action)Place Block/$, will consume additional items from my inventory. When this happens, the spell will first look for the item to use, and then draw from all such items in my inventory.$(br2)This process is called \"picking an item.\"", "hexcasting.page.itempicking.2": "More specifically:$(li)First, the spell will search for the first valid item in my hotbar to the $(italic)right of my $(l:items/staff)$(item)staff/$, wrapping around at the right-hand side, and starting at the first slot if my $(l:items/staff)$(item)staff/$ is in my off-hand.$(li)Second, the spell will draw that item from as $(italic)far back in my inventory/$ as possible, prioritizing the main inventory over the hotbar.", "hexcasting.page.itempicking.3": "This way, I can keep a \"chooser\" item on my hotbar to tell the spell what to use, and fill the rest of my inventory with that item to keep the spell well-stocked.", - + "hexcasting.entry.basic_spell": "Basic Spells", "hexcasting.page.basic_spell.explode.1": "Remove a number and vector from the stack, then create an explosion at the given location with the given power.", "hexcasting.page.basic_spell.explode.2": "A power of 3 is about as much as a Creeper's blast; 4 is about as much as a TNT blast. Nature refuses to give me a blast of more than 10 power, though.$(br2)Strangely, this explosion doesn't seem to harm me. Perhaps it's because $(italic)I/$ am the one exploding?$(br2)Costs a negligible amount at power 0, plus 3 extra $(l:items/amethyst)$(item)Amethyst Dust/$ per point of explosion power.", @@ -1068,7 +1068,7 @@ "hexcasting.page.basic_spell.blink": "Remove an entity and length from the stack, then teleport the given entity along its look vector by the given length.$(br)Costs about one $(l:items/amethyst)$(item)Amethyst Shard/$ per two blocks travelled.", "hexcasting.page.basic_spell.beep.1": "Remove a vector and two numbers from the stack. Plays an $(thing)instrument/$ defined by the first number at the given location, with a $(thing)note/$ defined by the second number. Costs a negligible amount of _media.", "hexcasting.page.basic_spell.beep.2": "There appear to be 16 different $(thing)instruments/$ and 25 different $(thing)notes/$. Both are indexed by zero.$(br2)These seem to be the same instruments I can produce with a $(item)Note Block/$, though the reason for each instrument's number being what it is eludes me.$(br2)Either way, I can find the numbers I need to use by inspecting a $(item)Note Block/$ through a $(l:items/lens)$(item)Scrying Lens/$.", - + "hexcasting.entry.blockworks": "Blockworks", "hexcasting.page.blockworks.place_block": "Remove a location from the stack, then pick a block item and place it at the given location.$(br)Costs a negligible amount of _media.", "hexcasting.page.blockworks.break_block": "Remove a location from the stack, then break the block at the given location. This spell can break nearly anything a Diamond Pickaxe can break.$(br)Costs a bit more than one $(l:items/amethyst)$(item)Amethyst Dust/$.", @@ -1080,7 +1080,7 @@ "hexcasting.page.blockworks.edify": "Forcibly infuse _media into the sapling at the target position, causing it to grow into an $(l:items/edified)$(thing)Edified Tree/$. Costs about one $(l:items/amethyst)$(item)Charged Amethyst/$.", "hexcasting.page.blockworks.ignite": "Start a fire on top of the given location, as if a $(item)Fire Charge/$ was applied. Costs about one $(l:items/amethyst)$(item)Amethyst Dust/$.", "hexcasting.page.blockworks.extinguish": "Extinguish blocks in a large area. Costs about six $(l:items/amethyst)$(item)Amethyst Dust/$.", - + "hexcasting.entry.nadirs": "Nadirs", "hexcasting.page.nadirs.1": "This family of spells all impart a negative potion effect upon an entity. They all take an entity, the recipient, and one or two numbers, the first being the duration and the second, if present, being the potency (starting at 1).$(br2)Each one has a \"base cost;\" the actual cost is equal to that base cost, multiplied by the potency squared.", "hexcasting.page.nadirs.2": "According to certain legends, these spells and their sisters, the $(l:patterns/great_spells/zeniths)$(action)Zeniths/$, were \"[...] inspired by a world near to this one, where powerful wizards would gather magic from the land and hold duels to the death. Unfortunately, much was lost in translation...\"$(br2)Perhaps that is the reason for their peculiar names.", @@ -1089,7 +1089,7 @@ "hexcasting.page.nadirs.potion/wither": "Inflicts $(thing)withering/$. Base cost is one $(l:items/amethyst)$(item)Amethyst Dust/$ per second.", "hexcasting.page.nadirs.potion/poison": "Inflicts $(thing)poison/$. Base cost is one $(l:items/amethyst)$(item)Amethyst Dust/$ per 3 seconds.", "hexcasting.page.nadirs.potion/slowness": "Inflicts $(thing)slowness/$. Base cost is one $(l:items/amethyst)$(item)Amethyst Dust/$ per 5 seconds.", - + "hexcasting.entry.hexcasting_spell": "Crafting Casting Items", "hexcasting.page.hexcasting_spell.basics": "These three spells each create an $(l:items/hexcasting)$(thing)item that casts a _Hex./$$(br)They all require me to hold the empty item in my off-hand, and require two things: the list of patterns to be cast, and an entity representing a dropped stack of $(l:items/amethyst)$(item)Amethyst/$ to form the item's battery.$(br2)See $(l:items/hexcasting)this entry/$ for more information.", "hexcasting.page.hexcasting_spell.craft/cypher": "Costs about one $(l:items/amethyst)$(item)Charged Amethyst/$.", @@ -1099,7 +1099,7 @@ "hexcasting.page.hexcasting_spell.recharge.2": "This spell is cast in a similar method to the crafting spells; an entity representing a dropped stack of $(l:items/amethyst)$(item)Amethyst/$ is provided, and recharges the _media battery of the item in my other hand.$(br2)This spell $(italic)cannot/$ recharge the item farther than its original battery size.", "hexcasting.page.hexcasting_spell.erase.1": "Clear a _Hex-containing item in my other hand. Costs about one $(l:items/amethyst)$(item)Amethyst Dust/$.", "hexcasting.page.hexcasting_spell.erase.2": "The spell will also void all the _media stored inside the item, releasing it back to Nature and returning the item to a perfectly clean slate. This way, I can re-use $(l:items/hexcasting)$(item)Trinkets/$ I have put an erroneous spell into, for example.$(br2)This also works to clear a $(l:items/focus)$(item)Focus/$ or $(l:items/spellbook)$(item)Spellbook/$ page, unsealing them in the process.", - + "hexcasting.entry.sentinels": "Sentinels", "hexcasting.page.sentinels.1": "$(italic)Hence, away! Now all is well,$(br)One aloof stand sentinel./$$(br2)A $(l:patterns/spells/sentinels)$(thing)Sentinel/$ is a mysterious force I can summon to assist in the casting of _Hexes, like a familiar or guardian spirit. It appears as a spinning geometric shape to my eyes, but is invisible to everyone else.", "hexcasting.page.sentinels.2": "It has several interesting properties:$(li)It does not appear to be tangible; no one can touch it.$(li)Only my _Hexes can interact with it.$(li)Once summoned, it stays in place until banished.$(li)I am always able to see it if I'm close enough, even through solid objects.", @@ -1107,23 +1107,23 @@ "hexcasting.page.sentinels.sentinel/destroy": "Banish my $(l:patterns/spells/sentinels)$(thing)sentinel/$, and remove it from the world. Costs a negligible amount of _media.", "hexcasting.page.sentinels.sentinel/get_pos": "Add the position of my $(l:patterns/spells/sentinels)$(thing)sentinel/$ to the stack, or $(l:casting/influences)$(thing)Null/$ if it isn't summoned. Costs a negligible amount of _media.", "hexcasting.page.sentinels.sentinel/wayfind": "Transform the position vector on the top of the stack into a unit vector pointing from that position to my $(l:patterns/spells/sentinels)$(thing)sentinel/$, or $(l:casting/influences)$(thing)Null/$ if it isn't summoned. Costs a negligible amount of _media.", - + "hexcasting.page.colorize": "I must be holding a $(l:items/pigments)$(item)Pigment/$ in my other hand to cast this spell. When I do, it will consume the dye and permanently change my mind's coloration (at least, until I cast the spell again). Costs about one $(l:items/amethyst)$(item)Amethyst Dust/$.", - + "hexcasting.page.create_lava.1": "Summon a block of lava (or insert up to a bucket's worth) into a block at the given position. Costs about one $(l:items/amethyst)$(item)Charged Amethyst/$.", "hexcasting.page.create_lava.2": "It may be advisable to keep my knowledge of this spell secret. A certain faction of botanists get... touchy about it, or so I've heard.$(br2)Well, no one said tracing the deep secrets of the universe was going to be an easy time.", - + "hexcasting.entry.weather_manip": "Weather Manipulation", "hexcasting.page.weather_manip.lightning": "I command the heavens! This spell will summon a bolt of lightning to strike the earth where I direct it. Costs about three $(l:items/amethyst)$(item)Amethyst Shards/$.", "hexcasting.page.weather_manip.summon_rain": "I control the clouds! This spell will summon rain across the world I cast it upon. Costs about one $(l:items/amethyst)$(item)Charged Amethyst/$. Does nothing if it is already raining.", "hexcasting.page.weather_manip.dispel_rain": "A counterpart to summoning rain. This spell will dispel rain across the world I cast it upon. Costs about one $(l:items/amethyst)$(item)Amethyst Shard/$. Does nothing if the skies are already clear.", - + "hexcasting.page.flight.1": "The power of flight! I have wrestled Nature to its knees. But Nature is vengeful, and itches for me to break its contract so it may break my shins.", "hexcasting.page.flight.2": "The entity (which must be a player) will be endowed with flight. The first number is the number of seconds they may fly for, and the second number is the radius of the zone they may fly in. If the recipient exits that zone, or their timer runs out while midair, the gravity that they spurned will get its revenge. Painfully.$(br2)It costs one quarter of an $(l:items/amethyst)$(item)Amethyst Dust/$, per meter of radius, per second in flight.", - + "hexcasting.page.teleport.1": "Far more powerful than $(l:patterns/spells/basic#hexcasting:blink)$(action)Blink/$, this spell lets me teleport nearly anywhere in the entire world! There does seem to be a limit, but it is $(italic)much/$ greater than the normal radius of influence I am used to.", "hexcasting.page.teleport.2": "The entity will be teleported by the given vector, which is an offset from its given position. No matter the distance, it always seems to cost about ten $(l:items/amethyst)$(item)Charged Amethyst/$.$(br2)The transference is not perfect, and it seems when teleporting something as complex as a player, their inventory doesn't $(italic)quite/$ stay attached, and tends to splatter everywhere at the destination. In addition, the target will be forcibly removed from anything inanimate they are riding or sitting on ... but I've read scraps that suggest animals can come along for the ride, so to speak.", - + "hexcasting.entry.zeniths": "Zeniths", "hexcasting.page.zeniths.1": "This family of spells all impart a positive potion effect upon an entity, similar to the $(l:patterns/spells/nadirs)$(action)Nadirs/$. However, these have their _media costs increase with the $(italic)cube/$ of the potency.", "hexcasting.page.zeniths.potion/regeneration": "Bestows $(thing)regeneration/$. Base cost is one $(l:items/amethyst)$(item)Amethyst Dust/$ per second.", @@ -1131,18 +1131,18 @@ "hexcasting.page.zeniths.potion/absorption": "Bestows $(thing)absorption/$. Base cost is one $(l:items/amethyst)$(item)Amethyst Dust/$ per second.", "hexcasting.page.zeniths.potion/haste": "Bestows $(thing)haste/$. Base cost is one $(l:items/amethyst)$(item)Amethyst Dust/$ per 3 seconds.", "hexcasting.page.zeniths.potion/strength": "Bestows $(thing)strength/$. Base cost is one $(l:items/amethyst)$(item)Amethyst Dust/$ per 3 seconds.", - + "hexcasting.page.greater_sentinel.1": "Summon a greater version of my $(l:patterns/spells/sentinels)$(thing)Sentinel/$. Costs about two $(l:items/amethyst)$(item)Amethyst Dust/$.", "hexcasting.page.greater_sentinel.2": "The stronger $(l:patterns/spells/sentinels)$(thing)sentinel/$ acts like the normal one I can summon without the use of a Great Spell, if a little more visually interesting. However, the range in which my spells can work is extended to a small region around my greater $(l:patterns/spells/sentinels)$(thing)sentinel/$, about 16 blocks. In other words, no matter where in the world I am, I can interact with things around my $(l:patterns/spells/sentinels)$(thing)sentinel/$ (the mysterious forces of chunkloading notwithstanding).", - + "hexcasting.page.make_battery.1": "Infuse a bottle with _media to form a $(l:items/phials)$(item)Phial./$", "hexcasting.page.make_battery.2": "Similarly to the spells for $(l:patterns/spells/hexcasting)$(action)Crafting Casting Items/$, I must hold a $(item)Glass Bottle/$ in my other hand, and provide the spell with a dropped stack of $(l:items/amethyst)$(item)Amethyst/$. See $(l:items/phials)this page/$ for more information.$(br2)Costs about one $(l:items/amethyst)$(item)Charged Amethyst/$.", - + "hexcasting.page.brainsweep_spell.1": "I cannot make heads or tails of this spell... To be honest, I'm not sure I want to know what it does.", - + "hexcasting.entry.lore": "Lore", "hexcasting.entry.lore.desc": "I have uncovered some letters and text not of direct relevance to my art. But, I think I may be able to divine some of the history of the world from these. Let me see...", - + "hexcasting.entry.lore.terabithia1": "Cardamom Steles, #1", "hexcasting.page.lore.terabithia1.1": "$(italic)Full title: Letter from Cardamom Steles to Her Father, #1/$$(br2)Dear Papa,$(br)Every day it seems I have more reason to thank you for saving up to send me to the Grand Library. The amount I am learning is incredible! I feel I don't have the skill with words needed to express myself fully... it is wonderful to be here.", "hexcasting.page.lore.terabithia1.2": "I sit in the main dome as I write this. It's maintained by the Hexcasting Corps; they have some sort of peculiar mechanism at the top that captures the stray thought energy as it leaks out from the desks and desks of hard-working students, as I understand it. One of my friends in the dormitory, Amanita, is studying the subject, and oh how she loves to explain it to me at length, although I confess I do not understand it very well.", @@ -1152,7 +1152,7 @@ "hexcasting.page.lore.terabithia1.6": "Come to think of it, the description of this \"amethyst\" I now realize closely matches those crystals of media Amanita speaks of. Imagine if these nuggets of thought occurred naturally under the ground! I can't imagine why that might happen, though... ", "hexcasting.page.lore.terabithia1.7": "As a student, I am entitled to send one letter by Akashic post every three months, free of charge. Unfortunately, you know how thin my moneybags are ... so I am afraid this offer is the only method I may communicate with you. I will of course appreciate immensely if you manage to scrounge together the money to send a letter back, but it seems our communications may be limited. I hate to be cut off from you so, but the skills I gain here will be more than repayment. Imagine, I will be the first member of our family to be anything other than a farmer!", "hexcasting.page.lore.terabithia1.8": "So, I suppose I will write again in three months' time.$(br2)Yours,$(br)-- Cardamom Steles", - + "hexcasting.entry.lore.terabithia2": "Cardamom Steles, #2", "hexcasting.page.lore.terabithia2.1": "$(italic)Full title: Letter from Cardamom Steles to Her Father, #2/$$(br2)Dear Papa,$(br)... Goodness, what an ordeal it is to try to summarize the last three months into a short letter. Such a cruel task set before me by this miracle I receive entirely for free! Woe is me.", "hexcasting.page.lore.terabithia2.2": "My studies with the Geology Corps have been progressing smoothly. We have gone on more expeditions, deeper into the earth, to where the smooth gray stone makes way to a hard, flaky slate. It creates such an awful, choking dust under your feet... it's incredible what hostility there is below all of our feet all the time, even disregarding the creatures of the dark. (I have had one or two encounters with them, but I know how you shudder to think of me having to fight for my life, so I will not write of them.)", @@ -1161,7 +1161,7 @@ "hexcasting.page.lore.terabithia2.5": "If this is true, the secrecy, not to mention the prefect's aversion to questioning, may be because this is an original piece of research the Grand Library is not eager to let into the hands of enemy factions.$(br2)However, this theory does not sit quite right with me. The amethyst I handled in the cave and the crystals of media Amanita has shown to me do seem quite similar, but not identical. I would like to see them side-by-side to be sure, but media has a peculiar buzzing or rumbling feel beneath the fingers that amethyst does not.", "hexcasting.page.lore.terabithia2.6": "It is quite possible I was unable to sense it on the amethyst in the cave due to the stress of being undergound-- my hands were shaking the one time I managed to touch some, and the feeling is very light --but it does not seem the same to me. The light reflects slightly differently.$(br2)I suppose if I ever manage to get my hands on a crystal of amethyst outside of a cave, I will ask Amanita to see if she can cast a spell with it. Every time we meet she seems to have some new fantastic trick.", "hexcasting.page.lore.terabithia2.7": "Just last week she suspended me in the air supported by nothing at all! It is an immensely strange feeling to have your body tingling and lighter than air with your clothing still the same weight... I am just glad she tugged me over my bed before the effect ran out.$(br2)Yours,$(br)-- Cardamom Steles", - + "hexcasting.entry.lore.terabithia3": "Cardamom Steles, #3, 1/2", "hexcasting.page.lore.terabithia3.1": "$(italic)Full title: Letter from Cardamom Steles to her father, #3, part 1/2/$$(br2)Dear Papa,$(br)Two very peculiar things have happened since I last wrote.$(br2)Firstly, the professor in charge of the entry-level Hexcasting Corps students has disappeared. Nobody knows where he has gone. His office and living quarters were found locked, but still in their usual state of disarray.", "hexcasting.page.lore.terabithia3.2": "Even more peculiarly, any attempts by the students of the Grand to rouse the administrative portions of the gnarled bureaucracy have been very firmly rejected. Even other professors seem reluctant to talk about him.$(br2)As you might imagine, Amanita is sorely distressed. Whatever replacement professors the Grand managed to dredge up have none of the old professor's tact or skill with beginners.", @@ -1175,7 +1175,7 @@ "hexcasting.page.lore.terabithia3.10": "It was like each breath in erected a friendly signpost in my head promising the way forward, pointing directly down a steep cliff. I shook my head and immersed myself in the work of mining, which seemed to stave off the signposts.$(br2)I did manage, however, to hide a shard of the crystal in my knapsack.$(br2)We spent nearly the whole day mining, excavating most of the crystal by the time the prefects' chronometer said the sun would set soon.", "hexcasting.page.lore.terabithia3.11": "As we left, I couldn't help but notice that on the surfaces of those dark, scored places we left unmined, there seemed to be the faintest buds of new crystal, like they were somehow growing out of them. Everything I had learned about the geology of crystals said they took thousands of years to grow, but here there was new growth in less than a day. I suppose the prefects' warnings against breaking those spots were warranted, at least.", "hexcasting.page.lore.terabithia3.12": "Our journey back to the surface was uneventful, and we got back to our tents just as the sun was setting-- My apologies, I am nearly out of paper for this letter. There's only so much you can write on one Akashic letter ... This tale is worth purchasing another letter for. I'll send them both at once, so they should arrive together.$(br2)Yours,$(br)-- Cardamom Steles", - + "hexcasting.entry.lore.terabithia4": "Cardamom Steles, #3, 2/2", "hexcasting.page.lore.terabithia4.1": "$(italic)Full title: Letter from Cardamom Steles to her father, #3, part 2/2/$$(br2)Dear Papa,$(br)As I was saying, I was running out of paper to write my story, so the rest of it is in this letter. We made it back to camp just as the sun was setting. And that night was the most horrible event of the whole strange outing.", "hexcasting.page.lore.terabithia4.2": "I had gotten up in the middle of the night to relieve myself. The moon was covered with clouds, and I confess I got lost in the winds of the forest and could not find the way back to the camp. Fearing the monsters of the night, I decided I would find my way to the village and see if I could find a bed there. At the least, I would be protected there.", @@ -1187,14 +1187,14 @@ "hexcasting.page.lore.terabithia4.8": "As you can tell from this letter, I did not do a very good job. That warped visage still haunts my dreams. I shudder to think that it once might have been human.$(br2)After we got back to the Grand I showed the shard of crystal I had smuggled out to Amanita. She confirmed my suspicions: it is definitely a crystal of media. What an enormous geode full of it is doing underground, though, is beyond her.", "hexcasting.page.lore.terabithia4.9": "She also mentioned something interesting: apparently media can be used in a similar way to true amethyst in those niche glasses I mentioned a few letters ago. The physical manner in which they both crystallise happens to be nearly identical, and it has nothing to do with media's magical properties, or so she says.$(br2)I chose not to tell her of the village full of monsters.", "hexcasting.page.lore.terabithia4.10": "I know how tight money is for you, and how expensive it is to send a letter all the way back to the Grand, but I beg of you, please send a word of advice back. I am greatly distraught, and reading your words would do me much good.$(br2)Yours,$(br)-- Cardamom Steles", - + "hexcasting.entry.lore.terabithia5": "Cardamom Steles, #4", "hexcasting.page.lore.terabithia5.1": "$(italic)Full title: Letter from Cardamom Steles to her father, #4/$$(br2)Amanita has disappeared.$(br2)I don't know where she has gone, Papa. The last I saw her was over dinner, and she had just spoken to someone about the disappearances, and then--", "hexcasting.page.lore.terabithia5.2": "then-- then she was gone too. And no one speaks of her, and I am so so scared, Papa, do they all know? Everyone must have a friend who's just $(italic)vanished/$, into thin air, into non-being.$(br2)Where did they $(italic)go/$?", "hexcasting.page.lore.terabithia5.3": "They keep shutting things down, too-- we haven't been on a trip for the Geology Corps in weeks, all the apparati that collect media in the main dome are gone, the Apothecary Corps haven't been open for months... it's like termites are eating the Grand from the inside, leaving a hollow shell.$(br2)I think they've started scanning the letters, we write too...", "hexcasting.page.lore.terabithia5.4": "This letter has taken so much courage to write, and I don't have the courage to tell people myself, but if no one here can hold the knowledge I hope and pray you can send the word out... it's a vain hope for this to spread from somewhere as backwater as Brackenfalls, but please, please, do your best. Remember them, Papa... Amanita Libera, Jasmine Ward, Theodore Cha... please, remember them... and please forgive my cowardice, that I foist the responsibility onto you.", "hexcasting.page.lore.terabithia5.5": "i can no longer write, my hands shake so much, please, rescue us.", - + "hexcasting.entry.lore.inventory": "Restoration Log #72", "hexcasting.page.lore.inventory.1": "Cell 39, Restoration Log #72, Detainment Center Beta$(br2)Prisoner Name: Raphael Barr$(br)Crime: Knowledge of Project Wooleye$(br)Reason for Cell Vacancy: Death$(br)Additional notes: The following letter was scrawled over most of the wall space.", "hexcasting.page.lore.inventory.2": "I see hexagons when I close my eyes.$(br2)The patterns, they invade the space between my eyes and my eyelids, my mind, my dreams. I sparkle in and out of lucidity, like a crystal dangling from a string, sometimes catching the light, sometimes consumed by it.", @@ -1209,7 +1209,7 @@ "hexcasting.page.lore.inventory.11": "maybe I am just in the late late late late stages of overcasting dependency, the patterns papercutting into the space between my eyes and my eyelids I have heard of, the purple edges of my nerves i have heard of. is there any point trying to make myself believe what is true I am not being tortured. I deserve this. if i will never have anyone to discuss it with ever again why try", "hexcasting.page.lore.inventory.12": "they're going to kill everyone n the whole world aren't they the grand needs to eat just as much as i ... when did i lasst eat$(br2)everyone else has to eat and they cannot do that if all the farmers in the world are empty and all the knowledge of farming is underground or at least someone else is going to Find out and melt their smug faces to wax", "hexcasting.page.lore.inventory.13": "maybe wake up someday and wonder about all the thngs we left them and wonder why there are million miles of tunnels underground with no one smart enough to mine them$(br2)i can see them reading this . they ... will be too far gone to care", - + "hexcasting.entry.lore.experiment1": "Wooleye Instance Notes", "hexcasting.page.lore.experiment1.1": "$(italic)I only managed to find these five entries from this log./$$(br2)Detonation #26$(li)Location: Carpenter's North$(li)Population: 174$(li)Nodes Formed: 3$(li)Node Distance from Epicenter: 55-80m vertical, 85-156m horizontal$(li)Media Generation: 1320 uθ/min", "hexcasting.page.lore.experiment1.2": "Detonation #27$(li)Location: Brackenfalls$(li)Population: 79$(li)Nodes Formed: 1$(li)Node Distance from Epicenter: 95m vertical, 67m horizontal$(li)Media Generation: 412 uθ/min", @@ -1217,24 +1217,24 @@ "hexcasting.page.lore.experiment1.4": "Detonation #29$(li)Location: Unnamed; village two days west of Greyston$(li)Population: 35$(li)Nodes Formed: 0$(li)Node Distance from Epicenter: N/A$(li)Media Generation: N/A$(br2)Note: inhabitants still affected in the normal way", "hexcasting.page.lore.experiment1.5": "Detonation #30$(li)Location: Boiling Brook$(li)Population: 231$(li)Nodes Formed: 4$(li)Node Distance from Epicenter: 61-89m vertical, 78-191m horizontal$(li)Media Generation: 1862 uθ/min", "hexcasting.page.lore.experiment1.6": "Conclusion: approx 60 needed for one node. Too few consumes them but does not provide enough energy for node formation. Little correlation between input count and breadth/depth.$(br2)Effects on inhabitants still consistently more severe than with single-target testing, especially the physical effects.", - + "hexcasting.entry.lore.experiment2": "Wooleye Interview Logs", "hexcasting.page.lore.experiment2.1": "$(italic)These documents were heavily redacted. I have copied the readable text from them here./$$(br2)Subject #1 \"A.E.\"$(br)Stopped struggling immediately after procedure. Facial expression and limbs slack, but can stand unassisted. When left unattended, absently pantomimes actions commonly done in previous profession (groundskeeping).", "hexcasting.page.lore.experiment2.2": "Heartrate was very high immediately after procedure, but this is inconclusive due to state of fear immediately before. Resulting bud produced 35 uθ/min.$(br)...$(br)Subject #4 \"P.I.\"$(br)Psychological tests run on P.I. Subject has object permanence, spatial awareness, basic numerical reasoning. Difficulty learning new tasks. $(br2) ...", "hexcasting.page.lore.experiment2.3": "Subject #7 \"T.C.\"$(br)Consented to procedure. Similar results several hours after the procedure to other subjects: able to stand, perform simple tasks. $(br2) ...$(br2)Subject #11 \"R.S.\"$(br)Sedated before procedure; dosage such that subject would wake up as procedure occurred...$(br2) ...", "hexcasting.page.lore.experiment2.4": "Subject #23 \"A.L.\"$(br)Ability to speak retained to a greater degree than most subjects; dwindled to broken sentences, then a single word \"card\" over the course of several hours.$(br2)For further testing: how does the procedure affect previous Hexcasters vs. non-Hexcasters?$(br2) ...", - + "hexcasting.entry.interop": "Cross-Mod Compatibility", "hexcasting.entry.interop.desc": "It appears I have installed some mods Hexcasting interoperates with! I've detailed them here.", "hexcasting.page.interop.1": "The art of _Hexcasting is versatile. If I find that my world has been $(italic)modified/$ by certain other powers, it's possible that I may use _Hexcasting in harmony and combination with them.", "hexcasting.page.interop.2": "I should keep in mind, however, that Nature seems to have paid less attention in crafting these aspects of my art; strange behavior and bugs are to be expected. I'm sure the mod developer will do her best to correct them, but I must remember this is a less important pastime to her.$(br2)I may also find that there are sharp disregards to balance in the costs and effects of the interoperating powers. In such a case I suppose I will have to be responsible and restrain myself from using them.", "hexcasting.page.interop.3": "Finally, if I find myself interested in the lore and stories of this world, I do not think any notes compiled while examining these interoperations should be considered as anything more than light trifles.", - + "hexcasting.entry.interop.gravity": "Gravity Changer", "hexcasting.page.interop.gravity.1": "I have discovered actions to get and set an entity's gravity. I find them interesting, if slightly nauseating.$(br2)Interestingly, although $(l:patterns/great_spells/flight)$(action)Flight/$ is a great spell, and manipulates gravity similarly, these are not. It baffles me why... Perhaps the mod developer wanted players to have fun, for once.", "hexcasting.page.interop.gravity.get": "Get the main direction gravity pulls the given entity in, as a unit vector. For most entities, this will be down, <0, -1, 0>.", "hexcasting.page.interop.gravity.set": "Set the main direction gravity pulls the given entity in. The given vector will be coerced into the nearest axis, as per $(l:patterns/math#hexcasting:coerce_axial)$(action)Axial Purification/$. Costs about one $(l:items/amethyst)$(item)Charged Amethyst/$.", - + "hexcasting.entry.interop.pehkui": "Pehkui", "hexcasting.page.interop.pehkui.1": "I have discovered methods of changing the size of entities, and querying how much larger or smaller they are than normal.", "hexcasting.page.interop.pehkui.get": "Get the scale of the entity, as a proportion of their normal size. For most entities, this will be 1.", diff --git a/Common/src/test/java/EulerPathFinderTest.kt b/Common/src/test/java/EulerPathFinderTest.kt index 2ff3f765..f0eca915 100644 --- a/Common/src/test/java/EulerPathFinderTest.kt +++ b/Common/src/test/java/EulerPathFinderTest.kt @@ -1,6 +1,6 @@ -import at.petrak.hexcasting.api.spell.math.EulerPathFinder.findAltDrawing -import at.petrak.hexcasting.api.spell.math.HexDir -import at.petrak.hexcasting.api.spell.math.HexPattern.Companion.fromAngles +import at.petrak.hexcasting.api.casting.math.EulerPathFinder.findAltDrawing +import at.petrak.hexcasting.api.casting.math.HexDir +import at.petrak.hexcasting.api.casting.math.HexPattern.Companion.fromAngles import org.junit.jupiter.api.Test internal class EulerPathFinderTest { diff --git a/Fabric/src/main/java/at/petrak/hexcasting/fabric/FabricHexClientInitializer.kt b/Fabric/src/main/java/at/petrak/hexcasting/fabric/FabricHexClientInitializer.kt index 8c4b0b14..ef8b6219 100644 --- a/Fabric/src/main/java/at/petrak/hexcasting/fabric/FabricHexClientInitializer.kt +++ b/Fabric/src/main/java/at/petrak/hexcasting/fabric/FabricHexClientInitializer.kt @@ -5,11 +5,13 @@ import at.petrak.hexcasting.client.HexAdditionalRenderers import at.petrak.hexcasting.client.RegisterClientStuff import at.petrak.hexcasting.client.ShiftScrollListener import at.petrak.hexcasting.client.gui.PatternTooltipComponent +import at.petrak.hexcasting.common.casting.PatternRegistryManifest import at.petrak.hexcasting.common.lib.HexParticles import at.petrak.hexcasting.fabric.event.MouseScrollCallback import at.petrak.hexcasting.fabric.network.FabricPacketHandler import at.petrak.hexcasting.interop.HexInterop import net.fabricmc.api.ClientModInitializer +import net.fabricmc.fabric.api.client.event.lifecycle.v1.ClientLifecycleEvents import net.fabricmc.fabric.api.client.event.lifecycle.v1.ClientTickEvents import net.fabricmc.fabric.api.client.particle.v1.ParticleFactoryRegistry import net.fabricmc.fabric.api.client.rendering.v1.* @@ -36,6 +38,9 @@ object FabricHexClientInitializer : ClientModInitializer { ShiftScrollListener.clientTickEnd() } TooltipComponentCallback.EVENT.register(PatternTooltipComponent::tryConvert) + ClientLifecycleEvents.CLIENT_STARTED.register { + PatternRegistryManifest.processRegistry(null) + } MouseScrollCallback.EVENT.register(ShiftScrollListener::onScrollInGameplay) @@ -49,10 +54,10 @@ object FabricHexClientInitializer : ClientModInitializer { // how ergonomic RegisterClientStuff.registerBlockEntityRenderers(object : - RegisterClientStuff.BlockEntityRendererRegisterererer { + RegisterClientStuff.BlockEntityRendererRegisterererer { override fun registerBlockEntityRenderer( - type: BlockEntityType, - berp: BlockEntityRendererProvider + type: BlockEntityType, + berp: BlockEntityRendererProvider ) { BlockEntityRendererRegistry.register(type, berp) } @@ -60,7 +65,7 @@ object FabricHexClientInitializer : ClientModInitializer { HexInterop.clientInit() RegisterClientStuff.registerColorProviders( - { colorizer, item -> ColorProviderRegistry.ITEM.register(colorizer, item) }, - { colorizer, block -> ColorProviderRegistry.BLOCK.register(colorizer, block) }) + { colorizer, item -> ColorProviderRegistry.ITEM.register(colorizer, item) }, + { colorizer, block -> ColorProviderRegistry.BLOCK.register(colorizer, block) }) } } diff --git a/Fabric/src/main/java/at/petrak/hexcasting/fabric/FabricHexInitializer.kt b/Fabric/src/main/java/at/petrak/hexcasting/fabric/FabricHexInitializer.kt index e0db1d75..0f63fa53 100644 --- a/Fabric/src/main/java/at/petrak/hexcasting/fabric/FabricHexInitializer.kt +++ b/Fabric/src/main/java/at/petrak/hexcasting/fabric/FabricHexInitializer.kt @@ -5,6 +5,7 @@ import at.petrak.hexcasting.api.advancements.HexAdvancementTriggers import at.petrak.hexcasting.api.mod.HexStatistics import at.petrak.hexcasting.common.blocks.behavior.HexComposting import at.petrak.hexcasting.common.blocks.behavior.HexStrippables +import at.petrak.hexcasting.common.casting.PatternRegistryManifest import at.petrak.hexcasting.common.casting.operators.spells.great.OpFlight import at.petrak.hexcasting.common.command.PatternResLocArgument import at.petrak.hexcasting.common.entities.HexEntities @@ -14,6 +15,7 @@ import at.petrak.hexcasting.common.lib.* import at.petrak.hexcasting.common.lib.hex.HexActions import at.petrak.hexcasting.common.lib.hex.HexEvalSounds import at.petrak.hexcasting.common.lib.hex.HexIotaTypes +import at.petrak.hexcasting.common.lib.hex.HexSpecialHandlers import at.petrak.hexcasting.common.loot.HexLootHandler import at.petrak.hexcasting.common.misc.AkashicTreeGrower import at.petrak.hexcasting.common.misc.BrainsweepingEvents @@ -29,6 +31,7 @@ import io.github.tropheusj.serialization_hooks.ingredient.IngredientDeserializer import net.fabricmc.api.ModInitializer import net.fabricmc.fabric.api.command.v2.ArgumentTypeRegistry import net.fabricmc.fabric.api.command.v2.CommandRegistrationCallback +import net.fabricmc.fabric.api.event.lifecycle.v1.ServerLifecycleEvents import net.fabricmc.fabric.api.event.lifecycle.v1.ServerTickEvents import net.fabricmc.fabric.api.event.player.AttackBlockCallback import net.fabricmc.fabric.api.event.player.UseEntityCallback @@ -54,7 +57,6 @@ object FabricHexInitializer : ModInitializer { PatternResLocArgument::class.java, SingletonArgumentInfo.contextFree { PatternResLocArgument.id() } ) - HexActions.registerPatterns() HexAdvancementTriggers.registerTriggers() HexComposting.setup() HexStrippables.init() @@ -77,6 +79,10 @@ object FabricHexInitializer : ModInitializer { } } + ServerLifecycleEvents.SERVER_STARTED.register { server -> + PatternRegistryManifest.processRegistry(server.overworld()) + } + ServerTickEvents.END_WORLD_TICK.register(PlayerPositionRecorder::updateAllPlayers) ServerTickEvents.END_WORLD_TICK.register(ItemLens::tickAllPlayers) ServerTickEvents.END_WORLD_TICK.register(OpFlight::tickAllPlayers) @@ -86,6 +92,8 @@ object FabricHexInitializer : ModInitializer { LootTableEvents.MODIFY.register { _, _, id, supplier, _ -> HexLootHandler.lootLoad(id, supplier::withPool) } + + } fun initRegistries() { @@ -106,6 +114,8 @@ object FabricHexInitializer : ModInitializer { HexLootFunctions.registerSerializers(bind(Registry.LOOT_FUNCTION_TYPE)) + HexActions.register() + HexSpecialHandlers.register() HexIotaTypes.registerTypes() HexEvalSounds.register() diff --git a/Fabric/src/main/java/at/petrak/hexcasting/fabric/cc/CCHarness.java b/Fabric/src/main/java/at/petrak/hexcasting/fabric/cc/CCHarness.java index 083246d0..b812fb8a 100644 --- a/Fabric/src/main/java/at/petrak/hexcasting/fabric/cc/CCHarness.java +++ b/Fabric/src/main/java/at/petrak/hexcasting/fabric/cc/CCHarness.java @@ -1,7 +1,7 @@ package at.petrak.hexcasting.fabric.cc; -import at.petrak.hexcasting.api.spell.casting.CastingContext; -import at.petrak.hexcasting.api.spell.casting.CastingHarness; +import at.petrak.hexcasting.api.casting.eval.CastingContext; +import at.petrak.hexcasting.api.casting.eval.CastingHarness; import dev.onyxstudios.cca.api.v3.component.Component; import net.minecraft.nbt.CompoundTag; import net.minecraft.server.level.ServerPlayer; diff --git a/Fabric/src/main/java/at/petrak/hexcasting/fabric/cc/CCPatterns.java b/Fabric/src/main/java/at/petrak/hexcasting/fabric/cc/CCPatterns.java index a42a650b..6faa0f70 100644 --- a/Fabric/src/main/java/at/petrak/hexcasting/fabric/cc/CCPatterns.java +++ b/Fabric/src/main/java/at/petrak/hexcasting/fabric/cc/CCPatterns.java @@ -1,6 +1,6 @@ package at.petrak.hexcasting.fabric.cc; -import at.petrak.hexcasting.api.spell.casting.ResolvedPattern; +import at.petrak.hexcasting.api.casting.eval.ResolvedPattern; import dev.onyxstudios.cca.api.v3.component.Component; import net.minecraft.nbt.CompoundTag; import net.minecraft.nbt.ListTag; diff --git a/Fabric/src/main/java/at/petrak/hexcasting/fabric/cc/HexCardinalComponents.java b/Fabric/src/main/java/at/petrak/hexcasting/fabric/cc/HexCardinalComponents.java index ce31494c..6ab165e7 100644 --- a/Fabric/src/main/java/at/petrak/hexcasting/fabric/cc/HexCardinalComponents.java +++ b/Fabric/src/main/java/at/petrak/hexcasting/fabric/cc/HexCardinalComponents.java @@ -7,7 +7,7 @@ import at.petrak.hexcasting.api.item.HexHolderItem; import at.petrak.hexcasting.api.item.IotaHolderItem; import at.petrak.hexcasting.api.item.MediaHolderItem; import at.petrak.hexcasting.api.mod.HexConfig; -import at.petrak.hexcasting.api.spell.iota.DoubleIota; +import at.petrak.hexcasting.api.casting.iota.DoubleIota; import at.petrak.hexcasting.common.entities.EntityWallScroll; import at.petrak.hexcasting.common.lib.HexItems; import at.petrak.hexcasting.fabric.cc.adimpl.*; diff --git a/Fabric/src/main/java/at/petrak/hexcasting/fabric/cc/adimpl/CCEntityIotaHolder.java b/Fabric/src/main/java/at/petrak/hexcasting/fabric/cc/adimpl/CCEntityIotaHolder.java index a8139ef4..ae794ad9 100644 --- a/Fabric/src/main/java/at/petrak/hexcasting/fabric/cc/adimpl/CCEntityIotaHolder.java +++ b/Fabric/src/main/java/at/petrak/hexcasting/fabric/cc/adimpl/CCEntityIotaHolder.java @@ -1,7 +1,7 @@ package at.petrak.hexcasting.fabric.cc.adimpl; import at.petrak.hexcasting.api.addldata.ItemDelegatingEntityIotaHolder; -import at.petrak.hexcasting.api.spell.iota.Iota; +import at.petrak.hexcasting.api.casting.iota.Iota; import net.minecraft.nbt.CompoundTag; import net.minecraft.server.level.ServerLevel; import org.jetbrains.annotations.NotNull; diff --git a/Fabric/src/main/java/at/petrak/hexcasting/fabric/cc/adimpl/CCHexHolder.java b/Fabric/src/main/java/at/petrak/hexcasting/fabric/cc/adimpl/CCHexHolder.java index ec2f465f..69066967 100644 --- a/Fabric/src/main/java/at/petrak/hexcasting/fabric/cc/adimpl/CCHexHolder.java +++ b/Fabric/src/main/java/at/petrak/hexcasting/fabric/cc/adimpl/CCHexHolder.java @@ -2,7 +2,7 @@ package at.petrak.hexcasting.fabric.cc.adimpl; import at.petrak.hexcasting.api.addldata.ADHexHolder; import at.petrak.hexcasting.api.item.HexHolderItem; -import at.petrak.hexcasting.api.spell.iota.Iota; +import at.petrak.hexcasting.api.casting.iota.Iota; import at.petrak.hexcasting.fabric.cc.HexCardinalComponents; import dev.onyxstudios.cca.api.v3.item.ItemComponent; import net.minecraft.server.level.ServerLevel; diff --git a/Fabric/src/main/java/at/petrak/hexcasting/fabric/cc/adimpl/CCItemIotaHolder.java b/Fabric/src/main/java/at/petrak/hexcasting/fabric/cc/adimpl/CCItemIotaHolder.java index d9caa11c..5f879164 100644 --- a/Fabric/src/main/java/at/petrak/hexcasting/fabric/cc/adimpl/CCItemIotaHolder.java +++ b/Fabric/src/main/java/at/petrak/hexcasting/fabric/cc/adimpl/CCItemIotaHolder.java @@ -1,7 +1,7 @@ package at.petrak.hexcasting.fabric.cc.adimpl; import at.petrak.hexcasting.api.item.IotaHolderItem; -import at.petrak.hexcasting.api.spell.iota.Iota; +import at.petrak.hexcasting.api.casting.iota.Iota; import at.petrak.hexcasting.common.lib.hex.HexIotaTypes; import at.petrak.hexcasting.fabric.cc.HexCardinalComponents; import dev.onyxstudios.cca.api.v3.item.ItemComponent; diff --git a/Fabric/src/main/java/at/petrak/hexcasting/fabric/interop/emi/PatternRendererEMI.java b/Fabric/src/main/java/at/petrak/hexcasting/fabric/interop/emi/PatternRendererEMI.java index 4f38b39a..1ee5f0dc 100644 --- a/Fabric/src/main/java/at/petrak/hexcasting/fabric/interop/emi/PatternRendererEMI.java +++ b/Fabric/src/main/java/at/petrak/hexcasting/fabric/interop/emi/PatternRendererEMI.java @@ -1,7 +1,7 @@ package at.petrak.hexcasting.fabric.interop.emi; -import at.petrak.hexcasting.api.PatternRegistry; -import at.petrak.hexcasting.api.spell.math.HexCoord; +import at.petrak.hexcasting.common.casting.PatternRegistryManifest; +import at.petrak.hexcasting.api.casting.math.HexCoord; import at.petrak.hexcasting.interop.utils.PatternDrawingUtil; import at.petrak.hexcasting.interop.utils.PatternEntry; import com.mojang.blaze3d.vertex.PoseStack; @@ -28,7 +28,7 @@ public class PatternRendererEMI implements EmiRenderable { private final List pathfinderDots; public PatternRendererEMI(ResourceLocation pattern, int w, int h) { - var entry = PatternRegistry.lookupPattern(pattern); + var entry = PatternRegistryManifest.lookupPattern(pattern); this.strokeOrder = !entry.isPerWorld(); var data = PatternDrawingUtil.loadPatterns(List.of(new Pair<>(entry.prototype(), HexCoord.getOrigin())), 0f, 1f); diff --git a/Fabric/src/main/java/at/petrak/hexcasting/fabric/interop/gravity/GravityApiInterop.java b/Fabric/src/main/java/at/petrak/hexcasting/fabric/interop/gravity/GravityApiInterop.java index c78e44a1..235a8e61 100644 --- a/Fabric/src/main/java/at/petrak/hexcasting/fabric/interop/gravity/GravityApiInterop.java +++ b/Fabric/src/main/java/at/petrak/hexcasting/fabric/interop/gravity/GravityApiInterop.java @@ -1,19 +1,19 @@ package at.petrak.hexcasting.fabric.interop.gravity; -import at.petrak.hexcasting.api.PatternRegistry; -import at.petrak.hexcasting.api.spell.math.HexDir; -import at.petrak.hexcasting.api.spell.math.HexPattern; +import at.petrak.hexcasting.common.casting.PatternRegistryManifest; +import at.petrak.hexcasting.api.casting.math.HexDir; +import at.petrak.hexcasting.api.casting.math.HexPattern; import static at.petrak.hexcasting.api.HexAPI.modLoc; public class GravityApiInterop { public static void init() { try { - PatternRegistry.mapPattern(HexPattern.fromAngles("wawawddew", HexDir.NORTH_EAST), + PatternRegistryManifest.mapPattern(HexPattern.fromAngles("wawawddew", HexDir.NORTH_EAST), modLoc("interop/gravity/get"), OpGetGravity.INSTANCE); - PatternRegistry.mapPattern(HexPattern.fromAngles("wdwdwaaqw", HexDir.NORTH_WEST), + PatternRegistryManifest.mapPattern(HexPattern.fromAngles("wdwdwaaqw", HexDir.NORTH_WEST), modLoc("interop/gravity/set"), OpChangeGravity.INSTANCE); - } catch (PatternRegistry.RegisterPatternException e) { + } catch (PatternRegistryManifest.RegisterPatternException e) { e.printStackTrace(); } } diff --git a/Fabric/src/main/java/at/petrak/hexcasting/fabric/interop/gravity/OpChangeGravity.kt b/Fabric/src/main/java/at/petrak/hexcasting/fabric/interop/gravity/OpChangeGravity.kt index 1b6f2dc9..e67af28c 100644 --- a/Fabric/src/main/java/at/petrak/hexcasting/fabric/interop/gravity/OpChangeGravity.kt +++ b/Fabric/src/main/java/at/petrak/hexcasting/fabric/interop/gravity/OpChangeGravity.kt @@ -1,8 +1,8 @@ package at.petrak.hexcasting.fabric.interop.gravity -import at.petrak.hexcasting.api.spell.* -import at.petrak.hexcasting.api.spell.casting.CastingContext -import at.petrak.hexcasting.api.spell.iota.Iota +import at.petrak.hexcasting.api.casting.* +import at.petrak.hexcasting.api.casting.eval.CastingContext +import at.petrak.hexcasting.api.casting.iota.Iota import com.fusionflux.gravity_api.api.GravityChangerAPI import net.minecraft.core.Direction import net.minecraft.world.entity.Entity diff --git a/Fabric/src/main/java/at/petrak/hexcasting/fabric/interop/gravity/OpGetGravity.kt b/Fabric/src/main/java/at/petrak/hexcasting/fabric/interop/gravity/OpGetGravity.kt index 807cd075..09cd40b1 100644 --- a/Fabric/src/main/java/at/petrak/hexcasting/fabric/interop/gravity/OpGetGravity.kt +++ b/Fabric/src/main/java/at/petrak/hexcasting/fabric/interop/gravity/OpGetGravity.kt @@ -1,10 +1,10 @@ package at.petrak.hexcasting.fabric.interop.gravity -import at.petrak.hexcasting.api.spell.ConstMediaAction -import at.petrak.hexcasting.api.spell.asActionResult -import at.petrak.hexcasting.api.spell.casting.CastingContext -import at.petrak.hexcasting.api.spell.getEntity -import at.petrak.hexcasting.api.spell.iota.Iota +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.getEntity +import at.petrak.hexcasting.api.casting.iota.Iota import com.fusionflux.gravity_api.api.GravityChangerAPI import net.minecraft.world.phys.Vec3 diff --git a/Fabric/src/main/java/at/petrak/hexcasting/fabric/xplat/FabricXplatImpl.java b/Fabric/src/main/java/at/petrak/hexcasting/fabric/xplat/FabricXplatImpl.java index 78e96ead..dd2954cb 100644 --- a/Fabric/src/main/java/at/petrak/hexcasting/fabric/xplat/FabricXplatImpl.java +++ b/Fabric/src/main/java/at/petrak/hexcasting/fabric/xplat/FabricXplatImpl.java @@ -1,20 +1,20 @@ package at.petrak.hexcasting.fabric.xplat; import at.petrak.hexcasting.api.HexAPI; -import at.petrak.hexcasting.api.SpecialHandler; import at.petrak.hexcasting.api.addldata.ADHexHolder; import at.petrak.hexcasting.api.addldata.ADIotaHolder; import at.petrak.hexcasting.api.addldata.ADMediaHolder; +import at.petrak.hexcasting.api.casting.ActionRegistryEntry; +import at.petrak.hexcasting.api.casting.SpecialHandler; +import at.petrak.hexcasting.api.casting.eval.CastingHarness; +import at.petrak.hexcasting.api.casting.eval.ResolvedPattern; +import at.petrak.hexcasting.api.casting.eval.sideeffects.EvalSound; +import at.petrak.hexcasting.api.casting.iota.IotaType; import at.petrak.hexcasting.api.misc.FrozenColorizer; import at.petrak.hexcasting.api.mod.HexConfig; import at.petrak.hexcasting.api.mod.HexTags; import at.petrak.hexcasting.api.player.FlightAbility; import at.petrak.hexcasting.api.player.Sentinel; -import at.petrak.hexcasting.api.spell.ActionRegistryEntry; -import at.petrak.hexcasting.api.spell.casting.CastingHarness; -import at.petrak.hexcasting.api.spell.casting.ResolvedPattern; -import at.petrak.hexcasting.api.spell.casting.sideeffects.EvalSound; -import at.petrak.hexcasting.api.spell.iota.IotaType; import at.petrak.hexcasting.common.lib.HexItems; import at.petrak.hexcasting.common.network.IMessage; import at.petrak.hexcasting.fabric.cc.HexCardinalComponents; @@ -398,8 +398,9 @@ public class FabricXplatImpl implements IXplatAbstractions { Lifecycle.stable(), null)) .buildAndRegister() ); - private static final Supplier> SPECIAL_HANDLER_REGISTRY = Suppliers.memoize(() -> - FabricRegistryBuilder.from(new MappedRegistry( + private static final Supplier>> SPECIAL_HANDLER_REGISTRY = + Suppliers.memoize(() -> + FabricRegistryBuilder.from(new MappedRegistry>( ResourceKey.createRegistryKey(modLoc("special_handler")), Lifecycle.stable(), null)) .buildAndRegister() @@ -423,7 +424,7 @@ public class FabricXplatImpl implements IXplatAbstractions { } @Override - public Registry getSpecialHandlerRegistry() { + public Registry> getSpecialHandlerRegistry() { return SPECIAL_HANDLER_REGISTRY.get(); } diff --git a/Forge/src/main/java/at/petrak/hexcasting/forge/ForgeHexClientInitializer.java b/Forge/src/main/java/at/petrak/hexcasting/forge/ForgeHexClientInitializer.java index 216be6bd..2e368bb6 100644 --- a/Forge/src/main/java/at/petrak/hexcasting/forge/ForgeHexClientInitializer.java +++ b/Forge/src/main/java/at/petrak/hexcasting/forge/ForgeHexClientInitializer.java @@ -6,6 +6,7 @@ import at.petrak.hexcasting.client.RegisterClientStuff; import at.petrak.hexcasting.client.ShiftScrollListener; import at.petrak.hexcasting.client.gui.PatternTooltipComponent; import at.petrak.hexcasting.client.shader.HexShaders; +import at.petrak.hexcasting.common.casting.PatternRegistryManifest; import at.petrak.hexcasting.common.lib.HexParticles; import at.petrak.hexcasting.common.misc.PatternTooltip; import at.petrak.hexcasting.interop.HexInterop; @@ -36,12 +37,15 @@ public class ForgeHexClientInitializer { evt.enqueueWork(() -> { RegisterClientStuff.init(); RegisterClientStuff.registerColorProviders( - (colorizer, item) -> GLOBAL_ITEM_COLORS.register(colorizer, item), - (colorizer, block) -> GLOBAL_BLOCK_COLORS.register(colorizer, block)); + (colorizer, item) -> GLOBAL_ITEM_COLORS.register(colorizer, item), + (colorizer, block) -> GLOBAL_BLOCK_COLORS.register(colorizer, block)); }); var evBus = MinecraftForge.EVENT_BUS; + evBus.addListener((ClientPlayerNetworkEvent.LoggingIn e) -> + PatternRegistryManifest.processRegistry(null)); + evBus.addListener((RenderLevelStageEvent e) -> { if (e.getStage().equals(RenderLevelStageEvent.Stage.AFTER_PARTICLES)) { HexAdditionalRenderers.overlayLevel(e.getPoseStack(), e.getPartialTick()); @@ -84,7 +88,8 @@ public class ForgeHexClientInitializer { public static void registerParticles(RegisterParticleProvidersEvent evt) { HexParticles.FactoryHandler.registerFactories(new HexParticles.FactoryHandler.Consumer() { @Override - public void register(ParticleType type, Function> constructor) { + public void register(ParticleType type, Function> constructor) { evt.register(type, constructor::apply); } }); diff --git a/Forge/src/main/java/at/petrak/hexcasting/forge/ForgeHexInitializer.java b/Forge/src/main/java/at/petrak/hexcasting/forge/ForgeHexInitializer.java index 748ffcc3..b2da25ef 100644 --- a/Forge/src/main/java/at/petrak/hexcasting/forge/ForgeHexInitializer.java +++ b/Forge/src/main/java/at/petrak/hexcasting/forge/ForgeHexInitializer.java @@ -1,12 +1,12 @@ package at.petrak.hexcasting.forge; import at.petrak.hexcasting.api.HexAPI; -import at.petrak.hexcasting.api.PatternRegistry; import at.petrak.hexcasting.api.advancements.HexAdvancementTriggers; import at.petrak.hexcasting.api.mod.HexConfig; import at.petrak.hexcasting.api.mod.HexStatistics; import at.petrak.hexcasting.common.blocks.behavior.HexComposting; import at.petrak.hexcasting.common.blocks.behavior.HexStrippables; +import at.petrak.hexcasting.common.casting.PatternRegistryManifest; import at.petrak.hexcasting.common.casting.operators.spells.great.OpFlight; import at.petrak.hexcasting.common.entities.HexEntities; import at.petrak.hexcasting.common.items.ItemJewelerHammer; @@ -15,6 +15,7 @@ import at.petrak.hexcasting.common.lib.*; import at.petrak.hexcasting.common.lib.hex.HexActions; import at.petrak.hexcasting.common.lib.hex.HexEvalSounds; import at.petrak.hexcasting.common.lib.hex.HexIotaTypes; +import at.petrak.hexcasting.common.lib.hex.HexSpecialHandlers; import at.petrak.hexcasting.common.loot.HexLootHandler; import at.petrak.hexcasting.common.misc.AkashicTreeGrower; import at.petrak.hexcasting.common.misc.BrainsweepingEvents; @@ -54,6 +55,7 @@ import net.minecraftforge.event.entity.living.LivingEvent; import net.minecraftforge.event.entity.player.PlayerEvent; import net.minecraftforge.event.entity.player.PlayerInteractEvent; import net.minecraftforge.event.level.BlockEvent; +import net.minecraftforge.event.server.ServerStartedEvent; import net.minecraftforge.eventbus.api.IEventBus; import net.minecraftforge.fml.DistExecutor; import net.minecraftforge.fml.ModList; @@ -61,7 +63,6 @@ import net.minecraftforge.fml.ModLoadingContext; import net.minecraftforge.fml.common.Mod; import net.minecraftforge.fml.config.ModConfig; import net.minecraftforge.fml.event.lifecycle.FMLCommonSetupEvent; -import net.minecraftforge.fml.event.lifecycle.FMLLoadCompleteEvent; import net.minecraftforge.network.PacketDistributor; import net.minecraftforge.registries.RegisterEvent; import thedarkcolour.kotlinforforge.KotlinModLoadingContext; @@ -106,6 +107,8 @@ public class ForgeHexInitializer { ForgeHexArgumentTypeRegistry.ARGUMENT_TYPES.register(getModEventBus()); + HexActions.register(); + HexSpecialHandlers.register(); HexIotaTypes.registerTypes(); HexEvalSounds.register(); @@ -133,7 +136,6 @@ public class ForgeHexInitializer { ForgePacketHandler.init(); HexComposting.setup(); HexStrippables.init(); - HexActions.registerPatterns(); // Forge does not strictly require TreeGrowers to initialize during early game stages, unlike Fabric // and Quilt. // However, all launcher panic if the same resource is registered twice. But do need blocks and @@ -145,6 +147,7 @@ public class ForgeHexInitializer { HexInterop.init(); })); + // We have to do these at some point when the registries are still open modBus.addListener((RegisterEvent evt) -> { if (evt.getRegistryKey().equals(Registry.ITEM_REGISTRY)) { @@ -157,9 +160,6 @@ public class ForgeHexInitializer { } }); - modBus.addListener((FMLLoadCompleteEvent evt) -> - HexAPI.LOGGER.info(PatternRegistry.getPatternCountInfo())); - evBus.addListener((PlayerInteractEvent.EntityInteract evt) -> { var res = BrainsweepingEvents.interactWithBrainswept( evt.getEntity(), evt.getLevel(), evt.getHand(), evt.getTarget(), null); @@ -182,6 +182,9 @@ public class ForgeHexInitializer { } }); + evBus.addListener((ServerStartedEvent evt) -> + PatternRegistryManifest.processRegistry(evt.getServer().overworld())); + evBus.addListener((RegisterCommandsEvent evt) -> HexCommands.register(evt.getDispatcher())); evBus.addListener((PlayerEvent.BreakSpeed evt) -> { diff --git a/Forge/src/main/java/at/petrak/hexcasting/forge/cap/ForgeCapabilityHandler.java b/Forge/src/main/java/at/petrak/hexcasting/forge/cap/ForgeCapabilityHandler.java index 2c2b35a1..e205b631 100644 --- a/Forge/src/main/java/at/petrak/hexcasting/forge/cap/ForgeCapabilityHandler.java +++ b/Forge/src/main/java/at/petrak/hexcasting/forge/cap/ForgeCapabilityHandler.java @@ -7,7 +7,7 @@ import at.petrak.hexcasting.api.item.HexHolderItem; import at.petrak.hexcasting.api.item.IotaHolderItem; import at.petrak.hexcasting.api.item.MediaHolderItem; import at.petrak.hexcasting.api.mod.HexConfig; -import at.petrak.hexcasting.api.spell.iota.DoubleIota; +import at.petrak.hexcasting.api.casting.iota.DoubleIota; import at.petrak.hexcasting.common.entities.EntityWallScroll; import at.petrak.hexcasting.common.lib.HexItems; import at.petrak.hexcasting.forge.cap.adimpl.*; diff --git a/Forge/src/main/java/at/petrak/hexcasting/forge/cap/adimpl/CapEntityIotaHolder.java b/Forge/src/main/java/at/petrak/hexcasting/forge/cap/adimpl/CapEntityIotaHolder.java index 9bb6d931..8ad61fd0 100644 --- a/Forge/src/main/java/at/petrak/hexcasting/forge/cap/adimpl/CapEntityIotaHolder.java +++ b/Forge/src/main/java/at/petrak/hexcasting/forge/cap/adimpl/CapEntityIotaHolder.java @@ -2,7 +2,7 @@ package at.petrak.hexcasting.forge.cap.adimpl; import at.petrak.hexcasting.api.addldata.ADIotaHolder; import at.petrak.hexcasting.api.addldata.ItemDelegatingEntityIotaHolder; -import at.petrak.hexcasting.api.spell.iota.Iota; +import at.petrak.hexcasting.api.casting.iota.Iota; import net.minecraft.nbt.CompoundTag; import net.minecraft.server.level.ServerLevel; import org.jetbrains.annotations.Nullable; diff --git a/Forge/src/main/java/at/petrak/hexcasting/forge/cap/adimpl/CapItemHexHolder.java b/Forge/src/main/java/at/petrak/hexcasting/forge/cap/adimpl/CapItemHexHolder.java index 7cd9ed71..9c9f3970 100644 --- a/Forge/src/main/java/at/petrak/hexcasting/forge/cap/adimpl/CapItemHexHolder.java +++ b/Forge/src/main/java/at/petrak/hexcasting/forge/cap/adimpl/CapItemHexHolder.java @@ -2,7 +2,7 @@ package at.petrak.hexcasting.forge.cap.adimpl; import at.petrak.hexcasting.api.addldata.ADHexHolder; import at.petrak.hexcasting.api.item.HexHolderItem; -import at.petrak.hexcasting.api.spell.iota.Iota; +import at.petrak.hexcasting.api.casting.iota.Iota; import net.minecraft.server.level.ServerLevel; import net.minecraft.world.item.ItemStack; import org.jetbrains.annotations.Nullable; diff --git a/Forge/src/main/java/at/petrak/hexcasting/forge/cap/adimpl/CapItemIotaHolder.java b/Forge/src/main/java/at/petrak/hexcasting/forge/cap/adimpl/CapItemIotaHolder.java index 814c0e3e..a1937c0c 100644 --- a/Forge/src/main/java/at/petrak/hexcasting/forge/cap/adimpl/CapItemIotaHolder.java +++ b/Forge/src/main/java/at/petrak/hexcasting/forge/cap/adimpl/CapItemIotaHolder.java @@ -2,7 +2,7 @@ package at.petrak.hexcasting.forge.cap.adimpl; import at.petrak.hexcasting.api.addldata.ADIotaHolder; import at.petrak.hexcasting.api.item.IotaHolderItem; -import at.petrak.hexcasting.api.spell.iota.Iota; +import at.petrak.hexcasting.api.casting.iota.Iota; import net.minecraft.nbt.CompoundTag; import net.minecraft.server.level.ServerLevel; import net.minecraft.world.item.ItemStack; diff --git a/Forge/src/main/java/at/petrak/hexcasting/forge/cap/adimpl/CapStaticIotaHolder.java b/Forge/src/main/java/at/petrak/hexcasting/forge/cap/adimpl/CapStaticIotaHolder.java index 4bcebd07..d55edcfb 100644 --- a/Forge/src/main/java/at/petrak/hexcasting/forge/cap/adimpl/CapStaticIotaHolder.java +++ b/Forge/src/main/java/at/petrak/hexcasting/forge/cap/adimpl/CapStaticIotaHolder.java @@ -1,7 +1,7 @@ package at.petrak.hexcasting.forge.cap.adimpl; import at.petrak.hexcasting.api.addldata.ADIotaHolder; -import at.petrak.hexcasting.api.spell.iota.Iota; +import at.petrak.hexcasting.api.casting.iota.Iota; import at.petrak.hexcasting.common.lib.hex.HexIotaTypes; import net.minecraft.nbt.CompoundTag; import net.minecraft.server.level.ServerLevel; diff --git a/Forge/src/main/java/at/petrak/hexcasting/forge/interop/jei/PatternDrawable.java b/Forge/src/main/java/at/petrak/hexcasting/forge/interop/jei/PatternDrawable.java index 3acbde9c..35761271 100644 --- a/Forge/src/main/java/at/petrak/hexcasting/forge/interop/jei/PatternDrawable.java +++ b/Forge/src/main/java/at/petrak/hexcasting/forge/interop/jei/PatternDrawable.java @@ -1,7 +1,7 @@ package at.petrak.hexcasting.forge.interop.jei; -import at.petrak.hexcasting.api.PatternRegistry; -import at.petrak.hexcasting.api.spell.math.HexCoord; +import at.petrak.hexcasting.common.casting.PatternRegistryManifest; +import at.petrak.hexcasting.api.casting.math.HexCoord; import at.petrak.hexcasting.interop.utils.PatternDrawingUtil; import at.petrak.hexcasting.interop.utils.PatternEntry; import com.mojang.blaze3d.vertex.PoseStack; @@ -24,7 +24,7 @@ public class PatternDrawable implements IDrawable { private final List pathfinderDots; public PatternDrawable(ResourceLocation pattern, int w, int h) { - var entry = PatternRegistry.lookupPattern(pattern); + var entry = PatternRegistryManifest.lookupPattern(pattern); this.strokeOrder = !entry.isPerWorld(); var data = PatternDrawingUtil.loadPatterns( List.of(new Pair<>(entry.prototype(), HexCoord.getOrigin())), diff --git a/Forge/src/main/java/at/petrak/hexcasting/forge/recipe/ForgeUnsealedIngredient.java b/Forge/src/main/java/at/petrak/hexcasting/forge/recipe/ForgeUnsealedIngredient.java index 0a1486ec..594a7aa4 100644 --- a/Forge/src/main/java/at/petrak/hexcasting/forge/recipe/ForgeUnsealedIngredient.java +++ b/Forge/src/main/java/at/petrak/hexcasting/forge/recipe/ForgeUnsealedIngredient.java @@ -2,7 +2,7 @@ package at.petrak.hexcasting.forge.recipe; import at.petrak.hexcasting.api.addldata.ADIotaHolder; import at.petrak.hexcasting.api.item.IotaHolderItem; -import at.petrak.hexcasting.api.spell.iota.NullIota; +import at.petrak.hexcasting.api.casting.iota.NullIota; import at.petrak.hexcasting.api.utils.NBTHelper; import at.petrak.hexcasting.xplat.IXplatAbstractions; import com.google.gson.JsonElement; diff --git a/Forge/src/main/java/at/petrak/hexcasting/forge/xplat/ForgeXplatImpl.java b/Forge/src/main/java/at/petrak/hexcasting/forge/xplat/ForgeXplatImpl.java index a1037930..2d37fc52 100644 --- a/Forge/src/main/java/at/petrak/hexcasting/forge/xplat/ForgeXplatImpl.java +++ b/Forge/src/main/java/at/petrak/hexcasting/forge/xplat/ForgeXplatImpl.java @@ -1,21 +1,21 @@ package at.petrak.hexcasting.forge.xplat; import at.petrak.hexcasting.api.HexAPI; -import at.petrak.hexcasting.api.SpecialHandler; import at.petrak.hexcasting.api.addldata.ADColorizer; import at.petrak.hexcasting.api.addldata.ADHexHolder; import at.petrak.hexcasting.api.addldata.ADIotaHolder; import at.petrak.hexcasting.api.addldata.ADMediaHolder; +import at.petrak.hexcasting.api.casting.ActionRegistryEntry; +import at.petrak.hexcasting.api.casting.SpecialHandler; +import at.petrak.hexcasting.api.casting.eval.CastingContext; +import at.petrak.hexcasting.api.casting.eval.CastingHarness; +import at.petrak.hexcasting.api.casting.eval.ResolvedPattern; +import at.petrak.hexcasting.api.casting.eval.sideeffects.EvalSound; +import at.petrak.hexcasting.api.casting.iota.IotaType; import at.petrak.hexcasting.api.misc.FrozenColorizer; import at.petrak.hexcasting.api.mod.HexTags; import at.petrak.hexcasting.api.player.FlightAbility; import at.petrak.hexcasting.api.player.Sentinel; -import at.petrak.hexcasting.api.spell.ActionRegistryEntry; -import at.petrak.hexcasting.api.spell.casting.CastingContext; -import at.petrak.hexcasting.api.spell.casting.CastingHarness; -import at.petrak.hexcasting.api.spell.casting.ResolvedPattern; -import at.petrak.hexcasting.api.spell.casting.sideeffects.EvalSound; -import at.petrak.hexcasting.api.spell.iota.IotaType; import at.petrak.hexcasting.api.utils.HexUtils; import at.petrak.hexcasting.common.lib.HexItems; import at.petrak.hexcasting.common.lib.hex.HexEvalSounds; @@ -421,7 +421,8 @@ public class ForgeXplatImpl implements IXplatAbstractions { ForgeAccessorRegistry.hex$registerSimple( ResourceKey.createRegistryKey(modLoc("action")), null) ); - private static final Supplier> SPECIAL_HANDLER_REGISTRY = Suppliers.memoize(() -> + private static final Supplier>> SPECIAL_HANDLER_REGISTRY = + Suppliers.memoize(() -> ForgeAccessorRegistry.hex$registerSimple( ResourceKey.createRegistryKey(modLoc("special_handler")), null) ); @@ -442,7 +443,7 @@ public class ForgeXplatImpl implements IXplatAbstractions { } @Override - public Registry getSpecialHandlerRegistry() { + public Registry> getSpecialHandlerRegistry() { return SPECIAL_HANDLER_REGISTRY.get(); } From ede95c4b49ba5e1a1ff69ead4afa9fcbb73e56dd Mon Sep 17 00:00:00 2001 From: "petrak@" Date: Sat, 21 Jan 2023 11:53:23 -0600 Subject: [PATCH 36/95] creeping towards compilation --- .../api/casting/eval/CastingHarness.kt | 4 +- .../hexcasting/api/casting/math/HexPattern.kt | 6 +- .../hexcasting/api/item/IotaHolderItem.java | 4 +- .../api/utils/PatternNameHelper.java | 29 ---- .../casting/PatternRegistryManifest.java | 132 ++++++++++++++---- .../common/command/ListPatternsCommand.java | 34 ++--- .../common/command/PatternResLocArgument.java | 21 +-- .../common/command/RecalcPatternsCommand.java | 2 +- .../hexcasting/common/items/ItemStaff.java | 2 +- .../hexcasting/common/lib/hex/HexActions.java | 17 ++- .../common/loot/PatternScrollFunc.java | 18 +-- .../petrak/hexcasting/interop/HexInterop.java | 1 + .../patchouli/LookupPatternComponent.java | 11 +- .../interop/pehkui/PehkuiInterop.java | 20 +-- .../hexcasting/xplat/IXplatAbstractions.java | 2 +- .../hexcasting/fabric/FabricHexInitializer.kt | 28 +++- .../interop/gravity/GravityApiInterop.java | 19 +-- .../fabric/xplat/FabricXplatImpl.java | 12 +- .../hexcasting/forge/cap/CapSyncers.java | 2 +- .../forge/xplat/ForgeXplatImpl.java | 8 +- 20 files changed, 217 insertions(+), 155 deletions(-) delete mode 100644 Common/src/main/java/at/petrak/hexcasting/api/utils/PatternNameHelper.java 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 a87b3700..b58c8e70 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 @@ -29,7 +29,6 @@ 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 net.minecraft.ChatFormatting import net.minecraft.nbt.CompoundTag import net.minecraft.nbt.Tag import net.minecraft.network.chat.Component @@ -476,6 +475,8 @@ class CastingHarness private constructor( } } + // TODO: replace this once we can read things from the client + /* if (out != null) { val display = if (iota is PatternIota) { PatternNameHelper.representationForPattern(iota.pattern) @@ -484,6 +485,7 @@ class CastingHarness private constructor( } else iota.display() displayPatternDebug(this.escapeNext, displayDepth, display) } + */ return out } diff --git a/Common/src/main/java/at/petrak/hexcasting/api/casting/math/HexPattern.kt b/Common/src/main/java/at/petrak/hexcasting/api/casting/math/HexPattern.kt index 53062de5..096d0340 100644 --- a/Common/src/main/java/at/petrak/hexcasting/api/casting/math/HexPattern.kt +++ b/Common/src/main/java/at/petrak/hexcasting/api/casting/math/HexPattern.kt @@ -129,10 +129,8 @@ data class HexPattern(public val startDir: HexDir, public val angles: MutableLis @JvmStatic fun isPattern(tag: CompoundTag): Boolean { - return tag.contains(TAG_START_DIR, Tag.TAG_ANY_NUMERIC.toInt()) && tag.contains( - TAG_ANGLES, - Tag.TAG_BYTE_ARRAY.toInt() - ) + return tag.contains(TAG_START_DIR, Tag.TAG_ANY_NUMERIC.toInt()) + && tag.contains(TAG_ANGLES, Tag.TAG_BYTE_ARRAY.toInt()) } @JvmStatic diff --git a/Common/src/main/java/at/petrak/hexcasting/api/item/IotaHolderItem.java b/Common/src/main/java/at/petrak/hexcasting/api/item/IotaHolderItem.java index dc9cdf8d..d0ae62a8 100644 --- a/Common/src/main/java/at/petrak/hexcasting/api/item/IotaHolderItem.java +++ b/Common/src/main/java/at/petrak/hexcasting/api/item/IotaHolderItem.java @@ -54,7 +54,7 @@ public interface IotaHolderItem { /** * What is this considered to contain when nothing can be read? *

- * TODO i'm not sure what this exists for + * TODO i'm not sure what this isCastable for */ @Nullable default Iota emptyIota(ItemStack stack) { @@ -97,7 +97,7 @@ public interface IotaHolderItem { void writeDatum(ItemStack stack, @Nullable Iota iota); static void appendHoverText(IotaHolderItem self, ItemStack stack, List components, - TooltipFlag flag) { + TooltipFlag flag) { var datumTag = self.readIotaTag(stack); if (datumTag != null) { var cmp = HexIotaTypes.getDisplay(datumTag); diff --git a/Common/src/main/java/at/petrak/hexcasting/api/utils/PatternNameHelper.java b/Common/src/main/java/at/petrak/hexcasting/api/utils/PatternNameHelper.java deleted file mode 100644 index 880b4717..00000000 --- a/Common/src/main/java/at/petrak/hexcasting/api/utils/PatternNameHelper.java +++ /dev/null @@ -1,29 +0,0 @@ -package at.petrak.hexcasting.api.utils; - -import at.petrak.hexcasting.common.casting.PatternRegistryManifest; -import at.petrak.hexcasting.api.casting.eval.SpecialPatterns; -import at.petrak.hexcasting.api.casting.iota.PatternIota; -import at.petrak.hexcasting.api.casting.math.HexPattern; -import net.minecraft.ChatFormatting; -import net.minecraft.network.chat.Component; - -public class PatternNameHelper { - - public static Component representationForPattern(HexPattern pattern) { - if (pattern.sigsEqual(SpecialPatterns.CONSIDERATION)) { - return Component.translatable("hexcasting.spell.hexcasting:escape").withStyle(ChatFormatting.LIGHT_PURPLE); - } else if (pattern.sigsEqual(SpecialPatterns.INTROSPECTION)) { - return Component.translatable("hexcasting.spell.hexcasting:open_paren").withStyle(ChatFormatting.LIGHT_PURPLE); - } else if (pattern.sigsEqual(SpecialPatterns.RETROSPECTION)) { - return Component.translatable("hexcasting.spell.hexcasting:close_paren").withStyle(ChatFormatting.LIGHT_PURPLE); - } - - var action = PatternRegistryManifest.lookupPatternByShape(pattern); - if (action != null) { - return action.getDisplayName(); - } - - return new PatternIota(pattern).display(); // TODO: this should be merged into iota.display once Great Spells - // can be identified by name - } -} diff --git a/Common/src/main/java/at/petrak/hexcasting/common/casting/PatternRegistryManifest.java b/Common/src/main/java/at/petrak/hexcasting/common/casting/PatternRegistryManifest.java index e815a0f6..b05b7b9c 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/casting/PatternRegistryManifest.java +++ b/Common/src/main/java/at/petrak/hexcasting/common/casting/PatternRegistryManifest.java @@ -5,6 +5,7 @@ import at.petrak.hexcasting.api.casting.ActionRegistryEntry; import at.petrak.hexcasting.api.casting.PatternShapeMatch; import at.petrak.hexcasting.api.casting.SpecialHandler; import at.petrak.hexcasting.api.casting.math.EulerPathFinder; +import at.petrak.hexcasting.api.casting.math.HexDir; import at.petrak.hexcasting.api.casting.math.HexPattern; import at.petrak.hexcasting.api.mod.HexTags; import at.petrak.hexcasting.xplat.IXplatAbstractions; @@ -18,22 +19,28 @@ import org.apache.commons.lang3.NotImplementedException; import org.jetbrains.annotations.Nullable; import java.util.ArrayList; +import java.util.Collection; import java.util.HashMap; import java.util.Map; import java.util.concurrent.ConcurrentHashMap; +import java.util.concurrent.ConcurrentLinkedDeque; import java.util.concurrent.ConcurrentMap; // Now an internal-only class used to do final processing on the registered stuff public class PatternRegistryManifest { - // Map actions to their entry except for the per-world ones. Client and server side - public static final ConcurrentMap> NORMAL_ACTION_LOOKUP = + /* Map actions to their entry except for the per-world ones + * + * This can be static because the patterns that are per-world don't change in one server lifecycle. + */ + private static final ConcurrentMap> NORMAL_ACTION_LOOKUP = new ConcurrentHashMap<>(); - // On the server side, where we know such things, the jumbled patterns - // - // SERVER SIDE ONLY - public static final ConcurrentMap> PER_WORLD_ACTION_LOOKUP = - new ConcurrentHashMap<>(); + /** + * A set of all the per-world patterns. This doesn't store what they are, just that + * they exist. + */ + private static final ConcurrentLinkedDeque> PER_WORLD_ACTIONS = + new ConcurrentLinkedDeque<>(); /** * Process the registry! @@ -45,7 +52,7 @@ public class PatternRegistryManifest { if (overworld != null) { var ds = overworld.getDataStorage(); perWorldPatterns = ds.computeIfAbsent(ScrungledPatternsSave::load, - ScrungledPatternsSave::create, + ScrungledPatternsSave::createEmpty, TAG_SAVED_DATA); } @@ -55,6 +62,8 @@ public class PatternRegistryManifest { for (var key : registry.registryKeySet()) { var entry = registry.get(key); if (registry.getHolderOrThrow(key).is(HexTags.Actions.PER_WORLD_PATTERN)) { + PER_WORLD_ACTIONS.add(key); + // Then we need to create this only on the server, gulp if (perWorldPatterns != null) { var precalced = perWorldPatterns.lookup.get(entry.prototype().anglesSignature()); @@ -73,15 +82,17 @@ public class PatternRegistryManifest { if (perWorldPatterns != null) { for (var postNeederKey : postCalculationNeeders) { - var entry = registry.get(postNeederKey); - var scrungledSig = scrunglePattern(entry.prototype(), overworld.getSeed()); - PER_WORLD_ACTION_LOOKUP.put(scrungledSig, postNeederKey); + var regiEntry = registry.get(postNeederKey); + var scrungledPat = scrunglePattern(regiEntry.prototype(), overworld.getSeed()); + + var entry = new PerWorldEntry(postNeederKey, scrungledPat.getStartDir()); + perWorldPatterns.lookup.put(scrungledPat.anglesSignature(), entry); } } HexAPI.LOGGER.info(("We're on the %s! Loaded %d regular actions, %d per-world actions, and %d special " + "handlers").formatted( - (overworld == null) ? "client" : "server", NORMAL_ACTION_LOOKUP.size(), PER_WORLD_ACTION_LOOKUP.size(), + (overworld == null) ? "client" : "server", NORMAL_ACTION_LOOKUP.size(), PER_WORLD_ACTIONS.size(), IXplatAbstractions.INSTANCE.getSpecialHandlerRegistry().size() )); } @@ -121,13 +132,10 @@ public class PatternRegistryManifest { } // Look it up in the world? - var ds = overworld.getDataStorage(); - ScrungledPatternsSave perWorldPatterns = - ds.computeIfAbsent(ScrungledPatternsSave::load, ScrungledPatternsSave::create, - TAG_SAVED_DATA); + var perWorldPatterns = ScrungledPatternsSave.open(overworld); if (perWorldPatterns.lookup.containsKey(sig)) { - var key = perWorldPatterns.lookup.get(sig); - return new PatternShapeMatch.PerWorld(key, true); + var entry = perWorldPatterns.lookup.get(sig); + return new PatternShapeMatch.PerWorld(entry.key(), true); } if (checkForAlternateStrokeOrders) { @@ -142,59 +150,123 @@ public class PatternRegistryManifest { return new PatternShapeMatch.Nothing(); } + @Nullable + public static HexPattern getCanonicalStrokesPerWorld(ResourceKey key, ServerLevel overworld) { + var perWorldPatterns = ScrungledPatternsSave.open(overworld); + + if (perWorldPatterns.reverseLookup.containsKey(key)) { + var sig = perWorldPatterns.reverseLookup.get(key); + var entry = perWorldPatterns.lookup.get(sig); + return HexPattern.fromAngles(sig, entry.canonicalStartDir()); + } else { + return null; + } + } + + /** + * Get the IDs of all the patterns marked as per-world + */ + public static Collection> getAllPerWorldActions() { + return PER_WORLD_ACTIONS; + } + /** * Maps angle sigs to resource locations and their preferred start dir so we can look them up in the main registry * Save this on the world in case the random algorithm changes. */ public static class ScrungledPatternsSave extends SavedData { + private static final String TAG_DIR = "startDir"; + private static final String TAG_KEY = "key"; - // Maps scrungled signatures to their keys. - private final Map> lookup; + /** + * Maps scrungled signatures to their keys. + */ + private final Map lookup; - public ScrungledPatternsSave(Map> lookup) { + /** + * Reverse-maps resource keys to their signature; you can use that in {@code lookup}. + *

+ * This way we can look up things if we know their resource key, for commands and such + */ + private final Map, String> reverseLookup; + + public ScrungledPatternsSave(Map lookup) { this.lookup = lookup; + this.reverseLookup = new HashMap<>(); + this.lookup.forEach((sig, entry) -> { + this.reverseLookup.put(entry.key, sig); + }); } @Override public CompoundTag save(CompoundTag tag) { - this.lookup.forEach((sig, key) -> tag.putString(sig, key.location().toString())); + // We don't save the reverse lookup cause we can reconstruct it when loading. + this.lookup.forEach((sig, entry) -> { + var inner = new CompoundTag(); + inner.putByte(TAG_DIR, (byte) entry.canonicalStartDir.ordinal()); + inner.putString(TAG_KEY, entry.key().location().toString()); + tag.put(sig, inner); + }); return tag; } private static ScrungledPatternsSave load(CompoundTag tag) { var registryKey = IXplatAbstractions.INSTANCE.getActionRegistry().key(); - var map = new HashMap>(); + var map = new HashMap(); for (var sig : tag.getAllKeys()) { - var keyStr = tag.getString(sig); - var key = ResourceKey.create(registryKey, new ResourceLocation(keyStr)); + var inner = tag.getCompound(sig); - map.put(sig, key); + var rawDir = inner.getByte(TAG_DIR); + var rawKey = inner.getString(TAG_KEY); + + var dir = HexDir.values()[rawDir]; + var key = ResourceKey.create(registryKey, new ResourceLocation(rawKey)); + + map.put(sig, new PerWorldEntry(key, dir)); } return new ScrungledPatternsSave(map); } - public static ScrungledPatternsSave create() { + public static ScrungledPatternsSave createEmpty() { var save = new ScrungledPatternsSave(new HashMap<>()); return save; } + public static ScrungledPatternsSave createFromScratch(long seed) { + var map = new HashMap(); + for (var key : PER_WORLD_ACTIONS) { + var regiEntry = IXplatAbstractions.INSTANCE.getActionRegistry().get(key); + var scrungled = scrunglePattern(regiEntry.prototype(), seed); + map.put(scrungled.anglesSignature(), new PerWorldEntry(key, scrungled.getStartDir())); + } + + return new ScrungledPatternsSave(map); + } + + public static ScrungledPatternsSave open(ServerLevel overworld) { + return overworld.getDataStorage().computeIfAbsent( + ScrungledPatternsSave::load, ScrungledPatternsSave::createEmpty, TAG_SAVED_DATA); + } + } + + private record PerWorldEntry(ResourceKey key, HexDir canonicalStartDir) { } public static final String DATA_VERSION = "0.1.0"; public static final String TAG_SAVED_DATA = "hexcasting.per-world-patterns." + DATA_VERSION; + /** * Find a valid alternate drawing for this pattern that won't collide with anything pre-existing */ - private static String scrunglePattern(HexPattern prototype, long seed) { - var scrungled = EulerPathFinder.findAltDrawing(prototype, seed, it -> { + private static HexPattern scrunglePattern(HexPattern prototype, long seed) { + return EulerPathFinder.findAltDrawing(prototype, seed, it -> { var sig = it.anglesSignature(); return !NORMAL_ACTION_LOOKUP.containsKey(sig); }); - return scrungled.anglesSignature(); } } diff --git a/Common/src/main/java/at/petrak/hexcasting/common/command/ListPatternsCommand.java b/Common/src/main/java/at/petrak/hexcasting/common/command/ListPatternsCommand.java index 9895cbb1..8e414e49 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/command/ListPatternsCommand.java +++ b/Common/src/main/java/at/petrak/hexcasting/common/command/ListPatternsCommand.java @@ -1,8 +1,8 @@ package at.petrak.hexcasting.common.command; -import at.petrak.hexcasting.common.casting.PatternRegistryManifest; import at.petrak.hexcasting.api.casting.iota.PatternIota; import at.petrak.hexcasting.api.casting.math.HexPattern; +import at.petrak.hexcasting.common.casting.PatternRegistryManifest; import at.petrak.hexcasting.common.items.ItemScroll; import at.petrak.hexcasting.common.lib.HexItems; import com.mojang.brigadier.builder.LiteralArgumentBuilder; @@ -57,36 +57,36 @@ public class ListPatternsCommand { } private static int list(CommandSourceStack source) { - var lookup = PatternRegistryManifest.getPerWorldPatterns(source.getLevel()); - var listing = lookup.entrySet() + var keys = PatternRegistryManifest.getAllPerWorldActions(); + var listing = keys .stream() - .sorted((a, b) -> compareResLoc(a.getValue().getFirst(), b.getValue().getFirst())) + .sorted((a, b) -> compareResLoc(a.location(), b.location())) .toList(); + var ow = source.getLevel().getServer().overworld(); source.sendSuccess(Component.translatable("command.hexcasting.pats.listing"), false); - for (var pair : listing) { - source.sendSuccess(Component.literal(pair.getValue().getFirst().toString()) + for (var key : listing) { + var pat = PatternRegistryManifest.getCanonicalStrokesPerWorld(key, ow); + + source.sendSuccess(Component.literal(key.location().toString()) .append(": ") - .append(new PatternIota(HexPattern.fromAngles(pair.getKey(), pair.getValue().getSecond())) - .display()), false); + .append(new PatternIota(pat).display()), false); } - - return lookup.size(); + return keys.size(); } private static int giveAll(CommandSourceStack source, Collection targets) { if (!targets.isEmpty()) { - var lookup = PatternRegistryManifest.getPerWorldPatterns(source.getLevel()); + var lookup = PatternRegistryManifest.getAllPerWorldActions(); + var ow = source.getLevel().getServer().overworld(); - lookup.forEach((sig, entry) -> { - var opId = entry.getFirst(); - var startDir = entry.getSecond(); + lookup.forEach(key -> { + var pat = PatternRegistryManifest.getCanonicalStrokesPerWorld(key, ow); var tag = new CompoundTag(); - tag.putString(ItemScroll.TAG_OP_ID, opId.toString()); - tag.put(ItemScroll.TAG_PATTERN, - HexPattern.fromAngles(sig, startDir).serializeToNBT()); + tag.putString(ItemScroll.TAG_OP_ID, key.location().toString()); + tag.put(ItemScroll.TAG_PATTERN, pat.serializeToNBT()); var stack = new ItemStack(HexItems.SCROLL_LARGE); stack.setTag(tag); diff --git a/Common/src/main/java/at/petrak/hexcasting/common/command/PatternResLocArgument.java b/Common/src/main/java/at/petrak/hexcasting/common/command/PatternResLocArgument.java index 901dd7a5..99b3701f 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/command/PatternResLocArgument.java +++ b/Common/src/main/java/at/petrak/hexcasting/common/command/PatternResLocArgument.java @@ -1,7 +1,7 @@ package at.petrak.hexcasting.common.command; -import at.petrak.hexcasting.common.casting.PatternRegistryManifest; import at.petrak.hexcasting.api.casting.math.HexPattern; +import at.petrak.hexcasting.common.casting.PatternRegistryManifest; import com.mojang.brigadier.context.CommandContext; import com.mojang.brigadier.exceptions.CommandSyntaxException; import com.mojang.brigadier.exceptions.DynamicCommandExceptionType; @@ -28,26 +28,17 @@ public class PatternResLocArgument extends ResourceLocationArgument { @Override public CompletableFuture listSuggestions(CommandContext context, SuggestionsBuilder builder) { return SharedSuggestionProvider.suggest( - PatternRegistryManifest.getAllPerWorldPatternNames().stream().map(Object::toString), builder); + PatternRegistryManifest.getAllPerWorldActions().stream().map(key -> key.location().toString()), builder); } public static HexPattern getPattern( - CommandContext ctx, String pName) throws CommandSyntaxException { - var targetId = ctx.getArgument(pName, ResourceLocation.class); - var lookup = PatternRegistryManifest.getPerWorldPatterns(ctx.getSource().getLevel()); - HexPattern foundPat = null; - for (var sig : lookup.keySet()) { - var rhs = lookup.get(sig); - if (rhs.getFirst().equals(targetId)) { - foundPat = HexPattern.fromAngles(sig, rhs.getSecond()); - break; - } - } - + CommandContext ctx, String argumentName) throws CommandSyntaxException { + var targetId = ctx.getArgument(argumentName, ResourceLocation.class); + var foundPat = PatternRegistryManifest.getCanonicalStrokesPerWorld(targetId, ctx.getSource().getLevel()); if (foundPat == null) { throw ERROR_UNKNOWN_PATTERN.create(targetId); } else { - return foundPat; + return foundPat.getSecond(); } } } diff --git a/Common/src/main/java/at/petrak/hexcasting/common/command/RecalcPatternsCommand.java b/Common/src/main/java/at/petrak/hexcasting/common/command/RecalcPatternsCommand.java index 500f71d4..5b0b1436 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/command/RecalcPatternsCommand.java +++ b/Common/src/main/java/at/petrak/hexcasting/common/command/RecalcPatternsCommand.java @@ -14,7 +14,7 @@ public class RecalcPatternsCommand { var world = ctx.getSource().getServer().overworld(); var ds = world.getDataStorage(); ds.set(PatternRegistryManifest.TAG_SAVED_DATA, - PatternRegistryManifest.ScrungledPatternsSave.create(world.getSeed())); + PatternRegistryManifest.ScrungledPatternsSave.createEmpty()); ctx.getSource().sendSuccess( Component.translatable("command.hexcasting.recalc"), true); diff --git a/Common/src/main/java/at/petrak/hexcasting/common/items/ItemStaff.java b/Common/src/main/java/at/petrak/hexcasting/common/items/ItemStaff.java index 2dd455bf..7c1c8503 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/items/ItemStaff.java +++ b/Common/src/main/java/at/petrak/hexcasting/common/items/ItemStaff.java @@ -34,7 +34,7 @@ public class ItemStaff extends Item { if (!world.isClientSide() && player instanceof ServerPlayer serverPlayer) { var harness = IXplatAbstractions.INSTANCE.getHarness(serverPlayer, hand); - var patterns = IXplatAbstractions.INSTANCE.getPatterns(serverPlayer); + var patterns = IXplatAbstractions.INSTANCE.getPatternsSavedInUi(serverPlayer); var descs = harness.generateDescs(); IXplatAbstractions.INSTANCE.sendPacketToPlayer(serverPlayer, 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 eabd4769..721c20a3 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 @@ -1,6 +1,5 @@ package at.petrak.hexcasting.common.lib.hex; -import at.petrak.hexcasting.api.misc.MediaConstants; import at.petrak.hexcasting.api.casting.Action; import at.petrak.hexcasting.api.casting.ActionRegistryEntry; import at.petrak.hexcasting.api.casting.iota.BooleanIota; @@ -9,6 +8,7 @@ import at.petrak.hexcasting.api.casting.iota.NullIota; import at.petrak.hexcasting.api.casting.iota.Vec3Iota; import at.petrak.hexcasting.api.casting.math.HexDir; import at.petrak.hexcasting.api.casting.math.HexPattern; +import at.petrak.hexcasting.api.misc.MediaConstants; import at.petrak.hexcasting.api.utils.HexUtils; import at.petrak.hexcasting.common.casting.operators.*; import at.petrak.hexcasting.common.casting.operators.akashic.OpAkashicRead; @@ -37,6 +37,9 @@ import at.petrak.hexcasting.common.casting.operators.spells.sentinel.OpGetSentin import at.petrak.hexcasting.common.casting.operators.spells.sentinel.OpGetSentinelWayfind; import at.petrak.hexcasting.common.casting.operators.stack.*; import at.petrak.hexcasting.common.lib.HexItems; +import at.petrak.hexcasting.interop.pehkui.OpGetScale; +import at.petrak.hexcasting.interop.pehkui.OpSetScale; +import at.petrak.hexcasting.interop.pehkui.PehkuiInterop; import at.petrak.hexcasting.xplat.IXplatAbstractions; import net.minecraft.core.Registry; import net.minecraft.resources.ResourceLocation; @@ -536,7 +539,17 @@ public class HexActions { public static final ActionRegistryEntry DECONSTRUCT = make("deconstruct", new ActionRegistryEntry(HexPattern.fromAngles("aaqwqaa", HexDir.SOUTH_WEST), OpUnCons.INSTANCE)); - private static ActionRegistryEntry make(String name, ActionRegistryEntry are) { + // Xplat interops + static { + if (PehkuiInterop.isActive()) { + make("interop/pehkui/get", + new ActionRegistryEntry(HexPattern.fromAngles("aawawwawwa", HexDir.NORTH_WEST), OpGetScale.INSTANCE)); + make("interop/pehkui/set", + new ActionRegistryEntry(HexPattern.fromAngles("ddwdwwdwwd", HexDir.NORTH_EAST), OpSetScale.INSTANCE)); + } + } + + public static ActionRegistryEntry make(String name, ActionRegistryEntry are) { var old = ACTIONS.put(modLoc(name), are); if (old != null) { throw new IllegalArgumentException("Typo? Duplicate id " + name); diff --git a/Common/src/main/java/at/petrak/hexcasting/common/loot/PatternScrollFunc.java b/Common/src/main/java/at/petrak/hexcasting/common/loot/PatternScrollFunc.java index 06cc8287..5f158a75 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/loot/PatternScrollFunc.java +++ b/Common/src/main/java/at/petrak/hexcasting/common/loot/PatternScrollFunc.java @@ -1,7 +1,6 @@ package at.petrak.hexcasting.common.loot; import at.petrak.hexcasting.common.casting.PatternRegistryManifest; -import at.petrak.hexcasting.api.casting.math.HexPattern; import at.petrak.hexcasting.common.items.ItemScroll; import at.petrak.hexcasting.common.lib.HexLootFunctions; import com.google.gson.JsonDeserializationContext; @@ -14,6 +13,9 @@ import net.minecraft.world.level.storage.loot.functions.LootItemConditionalFunct import net.minecraft.world.level.storage.loot.functions.LootItemFunctionType; import net.minecraft.world.level.storage.loot.predicates.LootItemCondition; +/** + * Slap a random per-world pattern on the scroll + */ public class PatternScrollFunc extends LootItemConditionalFunction { public PatternScrollFunc(LootItemCondition[] lootItemConditions) { super(lootItemConditions); @@ -22,17 +24,15 @@ public class PatternScrollFunc extends LootItemConditionalFunction { @Override protected ItemStack run(ItemStack stack, LootContext ctx) { var rand = ctx.getRandom(); - var worldLookup = PatternRegistryManifest.getPerWorldPatterns(ctx.getLevel()); + var worldLookup = PatternRegistryManifest.getAllPerWorldActions(); - var keys = worldLookup.keySet().stream().toList(); - var sig = keys.get(rand.nextInt(keys.size())); + var keys = worldLookup.stream().toList(); + var key = keys.get(rand.nextInt(keys.size())); - var entry = worldLookup.get(sig); - var opId = entry.getFirst(); - var startDir = entry.getSecond(); + var pat = PatternRegistryManifest.getCanonicalStrokesPerWorld(key, ctx.getLevel().getServer().overworld()); var tag = new CompoundTag(); - tag.putString(ItemScroll.TAG_OP_ID, opId.toString()); - tag.put(ItemScroll.TAG_PATTERN, HexPattern.fromAngles(sig, startDir).serializeToNBT()); + tag.putString(ItemScroll.TAG_OP_ID, key.location().toString()); + tag.put(ItemScroll.TAG_PATTERN, pat.serializeToNBT()); stack.getOrCreateTag().merge(tag); diff --git a/Common/src/main/java/at/petrak/hexcasting/interop/HexInterop.java b/Common/src/main/java/at/petrak/hexcasting/interop/HexInterop.java index 53cd3094..ab1379b3 100644 --- a/Common/src/main/java/at/petrak/hexcasting/interop/HexInterop.java +++ b/Common/src/main/java/at/petrak/hexcasting/interop/HexInterop.java @@ -18,6 +18,7 @@ public class HexInterop { } public static final class Fabric { + // TODO: the ID for this mod changed, fix that, #362 public static final String GRAVITY_CHANGER_API_ID = "gravitychanger"; public static final String TRINKETS_API_ID = "trinkets"; } diff --git a/Common/src/main/java/at/petrak/hexcasting/interop/patchouli/LookupPatternComponent.java b/Common/src/main/java/at/petrak/hexcasting/interop/patchouli/LookupPatternComponent.java index e8126b9d..7f5517b3 100644 --- a/Common/src/main/java/at/petrak/hexcasting/interop/patchouli/LookupPatternComponent.java +++ b/Common/src/main/java/at/petrak/hexcasting/interop/patchouli/LookupPatternComponent.java @@ -1,10 +1,12 @@ package at.petrak.hexcasting.interop.patchouli; -import at.petrak.hexcasting.common.casting.PatternRegistryManifest; import at.petrak.hexcasting.api.casting.math.HexCoord; import at.petrak.hexcasting.api.casting.math.HexPattern; +import at.petrak.hexcasting.api.mod.HexTags; +import at.petrak.hexcasting.xplat.IXplatAbstractions; import com.google.gson.annotations.SerializedName; import com.mojang.datafixers.util.Pair; +import net.minecraft.resources.ResourceKey; import net.minecraft.resources.ResourceLocation; import vazkii.patchouli.api.IVariable; @@ -23,8 +25,11 @@ public class LookupPatternComponent extends AbstractPatternComponent { @Override public List> getPatterns(UnaryOperator lookup) { - var entry = PatternRegistryManifest.lookupPattern(this.opName); - this.strokeOrder = !entry.isPerWorld(); + var key = ResourceKey.create(IXplatAbstractions.INSTANCE.getActionRegistry().key(), this.opName); + var entry = IXplatAbstractions.INSTANCE.getActionRegistry().get(key); + + this.strokeOrder = + !IXplatAbstractions.INSTANCE.getActionRegistry().getHolderOrThrow(key).is(HexTags.Actions.PER_WORLD_PATTERN); return List.of(new Pair<>(entry.prototype(), HexCoord.getOrigin())); } diff --git a/Common/src/main/java/at/petrak/hexcasting/interop/pehkui/PehkuiInterop.java b/Common/src/main/java/at/petrak/hexcasting/interop/pehkui/PehkuiInterop.java index a54ad467..8f89517e 100644 --- a/Common/src/main/java/at/petrak/hexcasting/interop/pehkui/PehkuiInterop.java +++ b/Common/src/main/java/at/petrak/hexcasting/interop/pehkui/PehkuiInterop.java @@ -1,22 +1,16 @@ package at.petrak.hexcasting.interop.pehkui; -import at.petrak.hexcasting.common.casting.PatternRegistryManifest; -import at.petrak.hexcasting.api.casting.math.HexDir; -import at.petrak.hexcasting.api.casting.math.HexPattern; +import at.petrak.hexcasting.interop.HexInterop; +import at.petrak.hexcasting.xplat.IXplatAbstractions; import net.minecraft.world.entity.Entity; -import static at.petrak.hexcasting.api.HexAPI.modLoc; - public class PehkuiInterop { public static void init() { - try { - PatternRegistryManifest.mapPattern(HexPattern.fromAngles("aawawwawwa", HexDir.NORTH_WEST), - modLoc("interop/pehkui/get"), OpGetScale.INSTANCE); - PatternRegistryManifest.mapPattern(HexPattern.fromAngles("ddwdwwdwwd", HexDir.NORTH_EAST), - modLoc("interop/pehkui/set"), OpSetScale.INSTANCE); - } catch (PatternRegistryManifest.RegisterPatternException e) { - e.printStackTrace(); - } + // for future work + } + + public static boolean isActive() { + return IXplatAbstractions.INSTANCE.isModPresent(HexInterop.PEHKUI_ID); } /** diff --git a/Common/src/main/java/at/petrak/hexcasting/xplat/IXplatAbstractions.java b/Common/src/main/java/at/petrak/hexcasting/xplat/IXplatAbstractions.java index 30364f4c..e6b41fe9 100644 --- a/Common/src/main/java/at/petrak/hexcasting/xplat/IXplatAbstractions.java +++ b/Common/src/main/java/at/petrak/hexcasting/xplat/IXplatAbstractions.java @@ -93,7 +93,7 @@ public interface IXplatAbstractions { CastingHarness getHarness(ServerPlayer player, InteractionHand hand); - List getPatterns(ServerPlayer player); + List getPatternsSavedInUi(ServerPlayer player); void clearCastingData(ServerPlayer player); diff --git a/Fabric/src/main/java/at/petrak/hexcasting/fabric/FabricHexInitializer.kt b/Fabric/src/main/java/at/petrak/hexcasting/fabric/FabricHexInitializer.kt index 0f63fa53..ea08dad1 100644 --- a/Fabric/src/main/java/at/petrak/hexcasting/fabric/FabricHexInitializer.kt +++ b/Fabric/src/main/java/at/petrak/hexcasting/fabric/FabricHexInitializer.kt @@ -2,6 +2,9 @@ package at.petrak.hexcasting.fabric import at.petrak.hexcasting.api.HexAPI.modLoc import at.petrak.hexcasting.api.advancements.HexAdvancementTriggers +import at.petrak.hexcasting.api.casting.ActionRegistryEntry +import at.petrak.hexcasting.api.casting.math.HexDir +import at.petrak.hexcasting.api.casting.math.HexPattern import at.petrak.hexcasting.api.mod.HexStatistics import at.petrak.hexcasting.common.blocks.behavior.HexComposting import at.petrak.hexcasting.common.blocks.behavior.HexStrippables @@ -22,6 +25,9 @@ import at.petrak.hexcasting.common.misc.BrainsweepingEvents import at.petrak.hexcasting.common.misc.PlayerPositionRecorder import at.petrak.hexcasting.common.recipe.HexRecipeStuffRegistry import at.petrak.hexcasting.fabric.event.VillagerConversionCallback +import at.petrak.hexcasting.fabric.interop.gravity.GravityApiInterop +import at.petrak.hexcasting.fabric.interop.gravity.OpChangeGravity +import at.petrak.hexcasting.fabric.interop.gravity.OpGetGravity import at.petrak.hexcasting.fabric.network.FabricPacketHandler import at.petrak.hexcasting.fabric.recipe.FabricModConditionalIngredient import at.petrak.hexcasting.fabric.recipe.FabricUnsealedIngredient @@ -96,7 +102,9 @@ object FabricHexInitializer : ModInitializer { } - fun initRegistries() { + private fun initRegistries() { + fabricOnlyRegistration() + HexSounds.registerSounds(bind(Registry.SOUND_EVENT)) HexBlocks.registerBlocks(bind(Registry.BLOCK)) HexBlocks.registerBlockItems(bind(Registry.ITEM)) @@ -125,6 +133,22 @@ object FabricHexInitializer : ModInitializer { AkashicTreeGrower.init() // Done with soft implements in forge + butYouCouldBeFire() + + HexStatistics.register() + } + + // sorry lex (not sorry) + private fun fabricOnlyRegistration() { + if (GravityApiInterop.isActive()) { + HexActions.make("interop/gravity/get", + ActionRegistryEntry(HexPattern.fromAngles("wawawddew", HexDir.NORTH_EAST), OpGetGravity)) + HexActions.make("interop/gravity/set", + ActionRegistryEntry(HexPattern.fromAngles("wdwdwaaqw", HexDir.NORTH_WEST), OpChangeGravity)) + } + } + + private fun butYouCouldBeFire() { val flameOn = FlammableBlockRegistry.getDefaultInstance() for (log in listOf( HexBlocks.EDIFIED_LOG, @@ -165,8 +189,6 @@ object FabricHexInitializer : ModInitializer { )) { flameOn.add(leaves, 60, 30) } - - HexStatistics.register() } private fun bind(registry: Registry): BiConsumer = diff --git a/Fabric/src/main/java/at/petrak/hexcasting/fabric/interop/gravity/GravityApiInterop.java b/Fabric/src/main/java/at/petrak/hexcasting/fabric/interop/gravity/GravityApiInterop.java index 235a8e61..6bc32115 100644 --- a/Fabric/src/main/java/at/petrak/hexcasting/fabric/interop/gravity/GravityApiInterop.java +++ b/Fabric/src/main/java/at/petrak/hexcasting/fabric/interop/gravity/GravityApiInterop.java @@ -1,20 +1,13 @@ package at.petrak.hexcasting.fabric.interop.gravity; -import at.petrak.hexcasting.common.casting.PatternRegistryManifest; -import at.petrak.hexcasting.api.casting.math.HexDir; -import at.petrak.hexcasting.api.casting.math.HexPattern; - -import static at.petrak.hexcasting.api.HexAPI.modLoc; +import at.petrak.hexcasting.interop.HexInterop; +import at.petrak.hexcasting.xplat.IXplatAbstractions; public class GravityApiInterop { public static void init() { - try { - PatternRegistryManifest.mapPattern(HexPattern.fromAngles("wawawddew", HexDir.NORTH_EAST), - modLoc("interop/gravity/get"), OpGetGravity.INSTANCE); - PatternRegistryManifest.mapPattern(HexPattern.fromAngles("wdwdwaaqw", HexDir.NORTH_WEST), - modLoc("interop/gravity/set"), OpChangeGravity.INSTANCE); - } catch (PatternRegistryManifest.RegisterPatternException e) { - e.printStackTrace(); - } + } + + public static boolean isActive() { + return IXplatAbstractions.INSTANCE.isModPresent(HexInterop.Fabric.GRAVITY_CHANGER_API_ID); } } diff --git a/Fabric/src/main/java/at/petrak/hexcasting/fabric/xplat/FabricXplatImpl.java b/Fabric/src/main/java/at/petrak/hexcasting/fabric/xplat/FabricXplatImpl.java index dd2954cb..b6be7559 100644 --- a/Fabric/src/main/java/at/petrak/hexcasting/fabric/xplat/FabricXplatImpl.java +++ b/Fabric/src/main/java/at/petrak/hexcasting/fabric/xplat/FabricXplatImpl.java @@ -207,7 +207,7 @@ public class FabricXplatImpl implements IXplatAbstractions { } @Override - public List getPatterns(ServerPlayer player) { + public List getPatternsSavedInUi(ServerPlayer player) { var cc = HexCardinalComponents.PATTERNS.get(player); return cc.getPatterns(); } @@ -400,11 +400,11 @@ public class FabricXplatImpl implements IXplatAbstractions { ); private static final Supplier>> SPECIAL_HANDLER_REGISTRY = Suppliers.memoize(() -> - FabricRegistryBuilder.from(new MappedRegistry>( - ResourceKey.createRegistryKey(modLoc("special_handler")), - Lifecycle.stable(), null)) - .buildAndRegister() - ); + FabricRegistryBuilder.from(new MappedRegistry>( + ResourceKey.createRegistryKey(modLoc("special_handler")), + Lifecycle.stable(), null)) + .buildAndRegister() + ); private static final Supplier>> IOTA_TYPE_REGISTRY = Suppliers.memoize(() -> FabricRegistryBuilder.from(new DefaultedRegistry>( HexAPI.MOD_ID + ":null", ResourceKey.createRegistryKey(modLoc("iota_type")), diff --git a/Forge/src/main/java/at/petrak/hexcasting/forge/cap/CapSyncers.java b/Forge/src/main/java/at/petrak/hexcasting/forge/cap/CapSyncers.java index 75920726..0f9ea2be 100644 --- a/Forge/src/main/java/at/petrak/hexcasting/forge/cap/CapSyncers.java +++ b/Forge/src/main/java/at/petrak/hexcasting/forge/cap/CapSyncers.java @@ -28,7 +28,7 @@ public class CapSyncers { x.setSentinel(player, x.getSentinel(proto)); x.setColorizer(player, x.getColorizer(proto)); x.setHarness(player, x.getHarness(proto, InteractionHand.MAIN_HAND)); - x.setPatterns(player, x.getPatterns(proto)); + x.setPatterns(player, x.getPatternsSavedInUi(proto)); } @SubscribeEvent diff --git a/Forge/src/main/java/at/petrak/hexcasting/forge/xplat/ForgeXplatImpl.java b/Forge/src/main/java/at/petrak/hexcasting/forge/xplat/ForgeXplatImpl.java index 2d37fc52..5882fc2b 100644 --- a/Forge/src/main/java/at/petrak/hexcasting/forge/xplat/ForgeXplatImpl.java +++ b/Forge/src/main/java/at/petrak/hexcasting/forge/xplat/ForgeXplatImpl.java @@ -244,7 +244,7 @@ public class ForgeXplatImpl implements IXplatAbstractions { } @Override - public List getPatterns(ServerPlayer player) { + public List getPatternsSavedInUi(ServerPlayer player) { ListTag patternsTag = player.getPersistentData().getList(TAG_PATTERNS, Tag.TAG_COMPOUND); List patterns = new ArrayList<>(patternsTag.size()); @@ -423,9 +423,9 @@ public class ForgeXplatImpl implements IXplatAbstractions { ); private static final Supplier>> SPECIAL_HANDLER_REGISTRY = Suppliers.memoize(() -> - ForgeAccessorRegistry.hex$registerSimple( - ResourceKey.createRegistryKey(modLoc("special_handler")), null) - ); + ForgeAccessorRegistry.hex$registerSimple( + ResourceKey.createRegistryKey(modLoc("special_handler")), null) + ); private static final Supplier>> IOTA_TYPE_REGISTRY = Suppliers.memoize(() -> ForgeAccessorRegistry.hex$registerDefaulted( ResourceKey.createRegistryKey(modLoc("iota_type")), From e900e4d62b8da678c61b8c54d2da333b2ea5d93d Mon Sep 17 00:00:00 2001 From: "petrak@" Date: Sat, 21 Jan 2023 12:45:32 -0600 Subject: [PATCH 37/95] it's compiling! --- .../at/petrak/hexcasting/api/utils/HexUtils.kt | 14 ++++++++++++++ .../common/casting/PatternRegistryManifest.java | 8 +++----- .../common/command/PatternResLocArgument.java | 7 +++++-- .../thehexbook/en_us/entries/patterns/meta.json | 10 ---------- .../fabric/interop/emi/PatternRendererEMI.java | 9 ++++++--- 5 files changed, 28 insertions(+), 20 deletions(-) diff --git a/Common/src/main/java/at/petrak/hexcasting/api/utils/HexUtils.kt b/Common/src/main/java/at/petrak/hexcasting/api/utils/HexUtils.kt index 12235ee0..c0c9e041 100644 --- a/Common/src/main/java/at/petrak/hexcasting/api/utils/HexUtils.kt +++ b/Common/src/main/java/at/petrak/hexcasting/api/utils/HexUtils.kt @@ -7,10 +7,14 @@ import at.petrak.hexcasting.api.casting.iota.ListIota import at.petrak.hexcasting.api.casting.math.HexCoord import at.petrak.hexcasting.common.lib.hex.HexIotaTypes import net.minecraft.ChatFormatting +import net.minecraft.core.Registry import net.minecraft.nbt.* import net.minecraft.network.chat.Component import net.minecraft.network.chat.MutableComponent import net.minecraft.network.chat.Style +import net.minecraft.resources.ResourceKey +import net.minecraft.resources.ResourceLocation +import net.minecraft.tags.TagKey import net.minecraft.world.InteractionHand import net.minecraft.world.item.ItemStack import net.minecraft.world.phys.Vec2 @@ -272,3 +276,13 @@ fun Tag.downcast(type: TagType): T { } const val ERROR_COLOR = 0xff_f800f8.toInt() +fun isOfTag(registry: Registry, key: ResourceKey, tag: TagKey): Boolean { + val maybeHolder = registry.getHolder(key) + val holder = if (maybeHolder.isPresent) maybeHolder.get() else return false + return holder.`is`(tag) +} + +fun isOfTag(registry: Registry, loc: ResourceLocation, tag: TagKey): Boolean { + val key = ResourceKey.create(registry.key(), loc); + return isOfTag(registry, key, tag) +} diff --git a/Common/src/main/java/at/petrak/hexcasting/common/casting/PatternRegistryManifest.java b/Common/src/main/java/at/petrak/hexcasting/common/casting/PatternRegistryManifest.java index b05b7b9c..47a1e826 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/casting/PatternRegistryManifest.java +++ b/Common/src/main/java/at/petrak/hexcasting/common/casting/PatternRegistryManifest.java @@ -8,6 +8,7 @@ import at.petrak.hexcasting.api.casting.math.EulerPathFinder; import at.petrak.hexcasting.api.casting.math.HexDir; import at.petrak.hexcasting.api.casting.math.HexPattern; import at.petrak.hexcasting.api.mod.HexTags; +import at.petrak.hexcasting.api.utils.HexUtils; import at.petrak.hexcasting.xplat.IXplatAbstractions; import com.mojang.datafixers.util.Pair; import net.minecraft.nbt.CompoundTag; @@ -50,10 +51,7 @@ public class PatternRegistryManifest { public static void processRegistry(@Nullable ServerLevel overworld) { ScrungledPatternsSave perWorldPatterns = null; if (overworld != null) { - var ds = overworld.getDataStorage(); - perWorldPatterns = ds.computeIfAbsent(ScrungledPatternsSave::load, - ScrungledPatternsSave::createEmpty, - TAG_SAVED_DATA); + perWorldPatterns = ScrungledPatternsSave.open(overworld); } var postCalculationNeeders = new ArrayList>(); @@ -61,7 +59,7 @@ public class PatternRegistryManifest { var registry = IXplatAbstractions.INSTANCE.getActionRegistry(); for (var key : registry.registryKeySet()) { var entry = registry.get(key); - if (registry.getHolderOrThrow(key).is(HexTags.Actions.PER_WORLD_PATTERN)) { + if (HexUtils.isOfTag(registry, key, HexTags.Actions.PER_WORLD_PATTERN)) { PER_WORLD_ACTIONS.add(key); // Then we need to create this only on the server, gulp diff --git a/Common/src/main/java/at/petrak/hexcasting/common/command/PatternResLocArgument.java b/Common/src/main/java/at/petrak/hexcasting/common/command/PatternResLocArgument.java index 99b3701f..f043ed05 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/command/PatternResLocArgument.java +++ b/Common/src/main/java/at/petrak/hexcasting/common/command/PatternResLocArgument.java @@ -2,6 +2,7 @@ package at.petrak.hexcasting.common.command; import at.petrak.hexcasting.api.casting.math.HexPattern; import at.petrak.hexcasting.common.casting.PatternRegistryManifest; +import at.petrak.hexcasting.xplat.IXplatAbstractions; import com.mojang.brigadier.context.CommandContext; import com.mojang.brigadier.exceptions.CommandSyntaxException; import com.mojang.brigadier.exceptions.DynamicCommandExceptionType; @@ -11,6 +12,7 @@ import net.minecraft.commands.CommandSourceStack; import net.minecraft.commands.SharedSuggestionProvider; import net.minecraft.commands.arguments.ResourceLocationArgument; import net.minecraft.network.chat.Component; +import net.minecraft.resources.ResourceKey; import net.minecraft.resources.ResourceLocation; import java.util.concurrent.CompletableFuture; @@ -34,11 +36,12 @@ public class PatternResLocArgument extends ResourceLocationArgument { public static HexPattern getPattern( CommandContext ctx, String argumentName) throws CommandSyntaxException { var targetId = ctx.getArgument(argumentName, ResourceLocation.class); - var foundPat = PatternRegistryManifest.getCanonicalStrokesPerWorld(targetId, ctx.getSource().getLevel()); + var targetKey = ResourceKey.create(IXplatAbstractions.INSTANCE.getActionRegistry().key(), targetId); + var foundPat = PatternRegistryManifest.getCanonicalStrokesPerWorld(targetKey, ctx.getSource().getLevel()); if (foundPat == null) { throw ERROR_UNKNOWN_PATTERN.create(targetId); } else { - return foundPat.getSecond(); + return foundPat; } } } diff --git a/Common/src/main/resources/data/hexcasting/patchouli_books/thehexbook/en_us/entries/patterns/meta.json b/Common/src/main/resources/data/hexcasting/patchouli_books/thehexbook/en_us/entries/patterns/meta.json index b38c35e0..a9beb442 100644 --- a/Common/src/main/resources/data/hexcasting/patchouli_books/thehexbook/en_us/entries/patterns/meta.json +++ b/Common/src/main/resources/data/hexcasting/patchouli_books/thehexbook/en_us/entries/patterns/meta.json @@ -29,16 +29,6 @@ { "type": "patchouli:text", "text": "hexcasting.page.meta.for_each.2" - }, - { - "type": "hexcasting:pattern", - "op_id": "hexcasting:halt", - "anchor": "hexcasting:halt", - "text": "hexcasting.page.meta.halt.1" - }, - { - "type": "patchouli:text", - "text": "hexcasting.page.meta.halt.2" } ] } diff --git a/Fabric/src/main/java/at/petrak/hexcasting/fabric/interop/emi/PatternRendererEMI.java b/Fabric/src/main/java/at/petrak/hexcasting/fabric/interop/emi/PatternRendererEMI.java index 1ee5f0dc..6127d55a 100644 --- a/Fabric/src/main/java/at/petrak/hexcasting/fabric/interop/emi/PatternRendererEMI.java +++ b/Fabric/src/main/java/at/petrak/hexcasting/fabric/interop/emi/PatternRendererEMI.java @@ -1,9 +1,11 @@ package at.petrak.hexcasting.fabric.interop.emi; -import at.petrak.hexcasting.common.casting.PatternRegistryManifest; import at.petrak.hexcasting.api.casting.math.HexCoord; +import at.petrak.hexcasting.api.mod.HexTags; +import at.petrak.hexcasting.api.utils.HexUtils; import at.petrak.hexcasting.interop.utils.PatternDrawingUtil; import at.petrak.hexcasting.interop.utils.PatternEntry; +import at.petrak.hexcasting.xplat.IXplatAbstractions; import com.mojang.blaze3d.vertex.PoseStack; import com.mojang.datafixers.util.Pair; import dev.emi.emi.api.render.EmiRenderable; @@ -28,8 +30,9 @@ public class PatternRendererEMI implements EmiRenderable { private final List pathfinderDots; public PatternRendererEMI(ResourceLocation pattern, int w, int h) { - var entry = PatternRegistryManifest.lookupPattern(pattern); - this.strokeOrder = !entry.isPerWorld(); + var regi = IXplatAbstractions.INSTANCE.getActionRegistry(); + var entry = regi.get(pattern); + this.strokeOrder = HexUtils.isOfTag(regi, pattern, HexTags.Actions.PER_WORLD_PATTERN); var data = PatternDrawingUtil.loadPatterns(List.of(new Pair<>(entry.prototype(), HexCoord.getOrigin())), 0f, 1f); this.patterns = data.patterns(); From 4af930e7a717ccbdbb82acc4e8775d8b4d536b78 Mon Sep 17 00:00:00 2001 From: "petrak@" Date: Sat, 21 Jan 2023 13:23:24 -0600 Subject: [PATCH 38/95] data: genned --- .../844611d4af49e23072b8a888c8e73c6c5d8c0768 | 3 ++ .../hexcasting/action/per_world_pattern.json | 12 ++++++ .../action/requires_enlightenment.json | 13 +++++++ .../hexcasting/common/lib/hex/HexActions.java | 3 +- .../common/lib/hex/HexEvalSounds.java | 3 +- .../common/lib/hex/HexIotaTypes.java | 3 +- .../common/lib/hex/HexSpecialHandlers.java | 3 +- .../datagen/tag/HexActionTagProvider.java | 38 +++++++++++++++++++ .../{ => tag}/HexBlockTagProvider.java | 2 +- .../datagen/{ => tag}/HexItemTagProvider.java | 2 +- .../03e4de26f1265135874f8cdcaebc09d9c08eb42b | 2 +- .../67cce32b1c3cbbcb1f646605f4914e3f196986c2 | 2 +- .../75bcd4dba6ca7d365462b0ec45e291d1056349c4 | 2 +- .../9fb1092f32d4fcbf9e061ffd718d4ec689c6c95e | 2 +- .../hexcasting/fabric/FabricHexInitializer.kt | 9 +++-- .../datagen/HexFabricDataGenerators.java | 4 +- .../hexcasting/forge/ForgeHexInitializer.java | 12 +++--- .../forge/datagen/HexForgeDataGenerators.java | 9 ++++- .../forge/interop/jei/PatternDrawable.java | 9 +++-- 19 files changed, 103 insertions(+), 30 deletions(-) create mode 100644 Common/src/generated/resources/.cache/844611d4af49e23072b8a888c8e73c6c5d8c0768 create mode 100644 Common/src/generated/resources/data/hexcasting/tags/hexcasting/action/per_world_pattern.json create mode 100644 Common/src/generated/resources/data/hexcasting/tags/hexcasting/action/requires_enlightenment.json create mode 100644 Common/src/main/java/at/petrak/hexcasting/datagen/tag/HexActionTagProvider.java rename Common/src/main/java/at/petrak/hexcasting/datagen/{ => tag}/HexBlockTagProvider.java (98%) rename Common/src/main/java/at/petrak/hexcasting/datagen/{ => tag}/HexItemTagProvider.java (98%) diff --git a/Common/src/generated/resources/.cache/844611d4af49e23072b8a888c8e73c6c5d8c0768 b/Common/src/generated/resources/.cache/844611d4af49e23072b8a888c8e73c6c5d8c0768 new file mode 100644 index 00000000..74f865db --- /dev/null +++ b/Common/src/generated/resources/.cache/844611d4af49e23072b8a888c8e73c6c5d8c0768 @@ -0,0 +1,3 @@ +// 1.19.2 2023-01-21T13:20:42.592825003 Tags for hexcasting:action +7684713a5311ad151b5591d22757988c8462d647 data/hexcasting/tags/hexcasting/action/per_world_pattern.json +9eb0b98603394a44b9202d1ff6778a539edfdfa4 data/hexcasting/tags/hexcasting/action/requires_enlightenment.json diff --git a/Common/src/generated/resources/data/hexcasting/tags/hexcasting/action/per_world_pattern.json b/Common/src/generated/resources/data/hexcasting/tags/hexcasting/action/per_world_pattern.json new file mode 100644 index 00000000..fb547c1a --- /dev/null +++ b/Common/src/generated/resources/data/hexcasting/tags/hexcasting/action/per_world_pattern.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/Common/src/generated/resources/data/hexcasting/tags/hexcasting/action/requires_enlightenment.json b/Common/src/generated/resources/data/hexcasting/tags/hexcasting/action/requires_enlightenment.json new file mode 100644 index 00000000..75caecfe --- /dev/null +++ b/Common/src/generated/resources/data/hexcasting/tags/hexcasting/action/requires_enlightenment.json @@ -0,0 +1,13 @@ +{ + "values": [ + "hexcasting:lightning", + "hexcasting:flight", + "hexcasting:create_lava", + "hexcasting:teleport", + "hexcasting:sentinel/create/great", + "hexcasting:dispel_rain", + "hexcasting:summon_rain", + "hexcasting:brainsweep", + "hexcasting:akashic/write" + ] +} \ No newline at end of file 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 721c20a3..78fa78a3 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 @@ -557,8 +557,7 @@ public class HexActions { return are; } - public static void register() { - BiConsumer r = (type, id) -> Registry.register(REGISTRY, id, type); + public static void register(BiConsumer r) { for (var e : ACTIONS.entrySet()) { r.accept(e.getValue(), e.getKey()); } diff --git a/Common/src/main/java/at/petrak/hexcasting/common/lib/hex/HexEvalSounds.java b/Common/src/main/java/at/petrak/hexcasting/common/lib/hex/HexEvalSounds.java index a711146b..ecbc5332 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/lib/hex/HexEvalSounds.java +++ b/Common/src/main/java/at/petrak/hexcasting/common/lib/hex/HexEvalSounds.java @@ -38,8 +38,7 @@ public class HexEvalSounds { return sound; } - public static void register() { - BiConsumer r = (type, id) -> Registry.register(REGISTRY, id, type); + public static void register(BiConsumer r) { for (var e : SOUNDS.entrySet()) { r.accept(e.getValue(), e.getKey()); } diff --git a/Common/src/main/java/at/petrak/hexcasting/common/lib/hex/HexIotaTypes.java b/Common/src/main/java/at/petrak/hexcasting/common/lib/hex/HexIotaTypes.java index 5109c087..8d5def2d 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/lib/hex/HexIotaTypes.java +++ b/Common/src/main/java/at/petrak/hexcasting/common/lib/hex/HexIotaTypes.java @@ -179,8 +179,7 @@ public class HexIotaTypes { return type.color(); } - public static void registerTypes() { - BiConsumer, ResourceLocation> r = (type, id) -> Registry.register(REGISTRY, id, type); + public static void registerTypes(BiConsumer, ResourceLocation> r) { for (var e : TYPES.entrySet()) { r.accept(e.getValue(), e.getKey()); } diff --git a/Common/src/main/java/at/petrak/hexcasting/common/lib/hex/HexSpecialHandlers.java b/Common/src/main/java/at/petrak/hexcasting/common/lib/hex/HexSpecialHandlers.java index f31f3044..af21ee21 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/lib/hex/HexSpecialHandlers.java +++ b/Common/src/main/java/at/petrak/hexcasting/common/lib/hex/HexSpecialHandlers.java @@ -33,8 +33,7 @@ public class HexSpecialHandlers { return handler; } - public static void register() { - BiConsumer, ResourceLocation> r = (type, id) -> Registry.register(REGISTRY, id, type); + public static void register(BiConsumer, ResourceLocation> r) { for (var e : SPECIAL_HANDLERS.entrySet()) { r.accept(e.getValue(), e.getKey()); } 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 new file mode 100644 index 00000000..aa1eedbd --- /dev/null +++ b/Common/src/main/java/at/petrak/hexcasting/datagen/tag/HexActionTagProvider.java @@ -0,0 +1,38 @@ +package at.petrak.hexcasting.datagen.tag; + +import at.petrak.hexcasting.api.casting.ActionRegistryEntry; +import at.petrak.hexcasting.api.mod.HexTags; +import at.petrak.hexcasting.xplat.IXplatAbstractions; +import net.minecraft.data.DataGenerator; +import net.minecraft.data.tags.TagsProvider; +import net.minecraft.resources.ResourceKey; + +import static at.petrak.hexcasting.api.HexAPI.modLoc; + +public class HexActionTagProvider extends TagsProvider { + public HexActionTagProvider(DataGenerator generator) { + super(generator, IXplatAbstractions.INSTANCE.getActionRegistry()); + } + + @Override + protected void addTags() { + // In-game almost all great spells are always per-world + for (var normalGreat : new String[]{ + "lightning", "flight", "create_lava", "teleport", "sentinel/create/great", + "dispel_rain", "summon_rain", "brainsweep" + }) { + var loc = modLoc(normalGreat); + var key = ResourceKey.create(IXplatAbstractions.INSTANCE.getActionRegistry().key(), loc); + tag(HexTags.Actions.REQUIRES_ENLIGHTENMENT).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); + } + } +} diff --git a/Common/src/main/java/at/petrak/hexcasting/datagen/HexBlockTagProvider.java b/Common/src/main/java/at/petrak/hexcasting/datagen/tag/HexBlockTagProvider.java similarity index 98% rename from Common/src/main/java/at/petrak/hexcasting/datagen/HexBlockTagProvider.java rename to Common/src/main/java/at/petrak/hexcasting/datagen/tag/HexBlockTagProvider.java index 263b90f1..0894f1cd 100644 --- a/Common/src/main/java/at/petrak/hexcasting/datagen/HexBlockTagProvider.java +++ b/Common/src/main/java/at/petrak/hexcasting/datagen/tag/HexBlockTagProvider.java @@ -1,4 +1,4 @@ -package at.petrak.hexcasting.datagen; +package at.petrak.hexcasting.datagen.tag; import at.petrak.hexcasting.api.mod.HexTags; import at.petrak.hexcasting.common.lib.HexBlocks; diff --git a/Common/src/main/java/at/petrak/hexcasting/datagen/HexItemTagProvider.java b/Common/src/main/java/at/petrak/hexcasting/datagen/tag/HexItemTagProvider.java similarity index 98% rename from Common/src/main/java/at/petrak/hexcasting/datagen/HexItemTagProvider.java rename to Common/src/main/java/at/petrak/hexcasting/datagen/tag/HexItemTagProvider.java index 4a724b61..2ea0f8e6 100644 --- a/Common/src/main/java/at/petrak/hexcasting/datagen/HexItemTagProvider.java +++ b/Common/src/main/java/at/petrak/hexcasting/datagen/tag/HexItemTagProvider.java @@ -1,4 +1,4 @@ -package at.petrak.hexcasting.datagen; +package at.petrak.hexcasting.datagen.tag; import at.petrak.hexcasting.api.mod.HexTags; import at.petrak.hexcasting.common.lib.HexItems; diff --git a/Fabric/src/generated/resources/.cache/03e4de26f1265135874f8cdcaebc09d9c08eb42b b/Fabric/src/generated/resources/.cache/03e4de26f1265135874f8cdcaebc09d9c08eb42b index 40812693..6bbac1c9 100644 --- a/Fabric/src/generated/resources/.cache/03e4de26f1265135874f8cdcaebc09d9c08eb42b +++ b/Fabric/src/generated/resources/.cache/03e4de26f1265135874f8cdcaebc09d9c08eb42b @@ -1,4 +1,4 @@ -// 1.19.2 2022-12-29T13:31:04.089602837 Tags for minecraft:item +// 1.19.2 2023-01-21T13:21:56.749293749 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 b8815f06..5b0192b2 100644 --- a/Fabric/src/generated/resources/.cache/67cce32b1c3cbbcb1f646605f4914e3f196986c2 +++ b/Fabric/src/generated/resources/.cache/67cce32b1c3cbbcb1f646605f4914e3f196986c2 @@ -1,4 +1,4 @@ -// 1.19.2 2022-12-29T13:31:04.07610805 LootTables +// 1.19.2 2023-01-21T13:21:56.793259038 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 ecf16b72..4d845417 100644 --- a/Fabric/src/generated/resources/.cache/75bcd4dba6ca7d365462b0ec45e291d1056349c4 +++ b/Fabric/src/generated/resources/.cache/75bcd4dba6ca7d365462b0ec45e291d1056349c4 @@ -1,4 +1,4 @@ -// 1.19.2 2022-12-29T13:31:04.07186608 Tags for minecraft:block +// 1.19.2 2023-01-21T13:21:56.751752593 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/9fb1092f32d4fcbf9e061ffd718d4ec689c6c95e b/Fabric/src/generated/resources/.cache/9fb1092f32d4fcbf9e061ffd718d4ec689c6c95e index 9e9a9a14..b291e45c 100644 --- a/Fabric/src/generated/resources/.cache/9fb1092f32d4fcbf9e061ffd718d4ec689c6c95e +++ b/Fabric/src/generated/resources/.cache/9fb1092f32d4fcbf9e061ffd718d4ec689c6c95e @@ -1,4 +1,4 @@ -// 1.19.2 2022-12-29T13:31:04.05733867 Recipes +// 1.19.2 2023-01-21T13:21:56.764789809 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/main/java/at/petrak/hexcasting/fabric/FabricHexInitializer.kt b/Fabric/src/main/java/at/petrak/hexcasting/fabric/FabricHexInitializer.kt index ea08dad1..423e0849 100644 --- a/Fabric/src/main/java/at/petrak/hexcasting/fabric/FabricHexInitializer.kt +++ b/Fabric/src/main/java/at/petrak/hexcasting/fabric/FabricHexInitializer.kt @@ -33,6 +33,7 @@ import at.petrak.hexcasting.fabric.recipe.FabricModConditionalIngredient import at.petrak.hexcasting.fabric.recipe.FabricUnsealedIngredient import at.petrak.hexcasting.fabric.storage.FabricImpetusStorage import at.petrak.hexcasting.interop.HexInterop +import at.petrak.hexcasting.xplat.IXplatAbstractions import io.github.tropheusj.serialization_hooks.ingredient.IngredientDeserializer import net.fabricmc.api.ModInitializer import net.fabricmc.fabric.api.command.v2.ArgumentTypeRegistry @@ -122,10 +123,10 @@ object FabricHexInitializer : ModInitializer { HexLootFunctions.registerSerializers(bind(Registry.LOOT_FUNCTION_TYPE)) - HexActions.register() - HexSpecialHandlers.register() - HexIotaTypes.registerTypes() - HexEvalSounds.register() + HexIotaTypes.registerTypes(bind(IXplatAbstractions.INSTANCE.iotaTypeRegistry)) + HexActions.register(bind(IXplatAbstractions.INSTANCE.actionRegistry)) + HexSpecialHandlers.register(bind(IXplatAbstractions.INSTANCE.specialHandlerRegistry)) + HexEvalSounds.register(bind(IXplatAbstractions.INSTANCE.evalSoundRegistry)) // Because of Java's lazy-loading of classes, can't use Kotlin static initialization for // any calls that will eventually touch FeatureUtils.register(), as the growers here do, diff --git a/Fabric/src/main/java/at/petrak/hexcasting/fabric/datagen/HexFabricDataGenerators.java b/Fabric/src/main/java/at/petrak/hexcasting/fabric/datagen/HexFabricDataGenerators.java index 5e4239df..5379a969 100644 --- a/Fabric/src/main/java/at/petrak/hexcasting/fabric/datagen/HexFabricDataGenerators.java +++ b/Fabric/src/main/java/at/petrak/hexcasting/fabric/datagen/HexFabricDataGenerators.java @@ -1,12 +1,12 @@ package at.petrak.hexcasting.fabric.datagen; import at.petrak.hexcasting.api.HexAPI; -import at.petrak.hexcasting.datagen.HexBlockTagProvider; -import at.petrak.hexcasting.datagen.HexItemTagProvider; import at.petrak.hexcasting.datagen.HexLootTables; import at.petrak.hexcasting.datagen.IXplatIngredients; import at.petrak.hexcasting.datagen.recipe.HexplatRecipes; import at.petrak.hexcasting.datagen.recipe.builders.FarmersDelightToolIngredient; +import at.petrak.hexcasting.datagen.tag.HexBlockTagProvider; +import at.petrak.hexcasting.datagen.tag.HexItemTagProvider; import at.petrak.hexcasting.fabric.recipe.FabricModConditionalIngredient; import at.petrak.hexcasting.xplat.IXplatAbstractions; import com.google.gson.JsonObject; diff --git a/Forge/src/main/java/at/petrak/hexcasting/forge/ForgeHexInitializer.java b/Forge/src/main/java/at/petrak/hexcasting/forge/ForgeHexInitializer.java index b2da25ef..35361d02 100644 --- a/Forge/src/main/java/at/petrak/hexcasting/forge/ForgeHexInitializer.java +++ b/Forge/src/main/java/at/petrak/hexcasting/forge/ForgeHexInitializer.java @@ -105,18 +105,18 @@ public class ForgeHexInitializer { bind(Registry.PARTICLE_TYPE_REGISTRY, HexParticles::registerParticles); - ForgeHexArgumentTypeRegistry.ARGUMENT_TYPES.register(getModEventBus()); + bind(IXplatAbstractions.INSTANCE.getIotaTypeRegistry().key(), HexIotaTypes::registerTypes); + bind(IXplatAbstractions.INSTANCE.getActionRegistry().key(), HexActions::register); + bind(IXplatAbstractions.INSTANCE.getSpecialHandlerRegistry().key(), HexSpecialHandlers::register); + bind(IXplatAbstractions.INSTANCE.getEvalSoundRegistry().key(), HexEvalSounds::register); - HexActions.register(); - HexSpecialHandlers.register(); - HexIotaTypes.registerTypes(); - HexEvalSounds.register(); + ForgeHexArgumentTypeRegistry.ARGUMENT_TYPES.register(getModEventBus()); HexAdvancementTriggers.registerTriggers(); } // https://github.com/VazkiiMods/Botania/blob/1.18.x/Forge/src/main/java/vazkii/botania/forge/ForgeCommonInitializer.java - private static void bind(ResourceKey> registry, + private static void bind(ResourceKey> registry, Consumer> source) { getModEventBus().addListener((RegisterEvent event) -> { if (registry.equals(event.getRegistryKey())) { diff --git a/Forge/src/main/java/at/petrak/hexcasting/forge/datagen/HexForgeDataGenerators.java b/Forge/src/main/java/at/petrak/hexcasting/forge/datagen/HexForgeDataGenerators.java index bc8f10ee..64c567a7 100644 --- a/Forge/src/main/java/at/petrak/hexcasting/forge/datagen/HexForgeDataGenerators.java +++ b/Forge/src/main/java/at/petrak/hexcasting/forge/datagen/HexForgeDataGenerators.java @@ -1,9 +1,14 @@ package at.petrak.hexcasting.forge.datagen; import at.petrak.hexcasting.api.HexAPI; -import at.petrak.hexcasting.datagen.*; +import at.petrak.hexcasting.datagen.HexAdvancements; +import at.petrak.hexcasting.datagen.HexLootTables; +import at.petrak.hexcasting.datagen.IXplatIngredients; import at.petrak.hexcasting.datagen.recipe.HexplatRecipes; import at.petrak.hexcasting.datagen.recipe.builders.FarmersDelightToolIngredient; +import at.petrak.hexcasting.datagen.tag.HexActionTagProvider; +import at.petrak.hexcasting.datagen.tag.HexBlockTagProvider; +import at.petrak.hexcasting.datagen.tag.HexItemTagProvider; import at.petrak.hexcasting.forge.datagen.xplat.HexBlockStatesAndModels; import at.petrak.hexcasting.forge.datagen.xplat.HexItemModels; import at.petrak.hexcasting.forge.recipe.ForgeModConditionalIngredient; @@ -46,6 +51,8 @@ public class HexForgeDataGenerators { gen.addProvider(ev.includeClient(), new HexBlockStatesAndModels(gen, efh)); gen.addProvider(ev.includeServer(), PaucalForgeDatagenWrappers.addEFHToAdvancements(new HexAdvancements(gen), efh)); + gen.addProvider(ev.includeServer(), PaucalForgeDatagenWrappers.addEFHToTagProvider( + new HexActionTagProvider(gen), efh)); } private static void configureForgeDatagen(GatherDataEvent ev) { diff --git a/Forge/src/main/java/at/petrak/hexcasting/forge/interop/jei/PatternDrawable.java b/Forge/src/main/java/at/petrak/hexcasting/forge/interop/jei/PatternDrawable.java index 35761271..bbcbf119 100644 --- a/Forge/src/main/java/at/petrak/hexcasting/forge/interop/jei/PatternDrawable.java +++ b/Forge/src/main/java/at/petrak/hexcasting/forge/interop/jei/PatternDrawable.java @@ -1,9 +1,11 @@ package at.petrak.hexcasting.forge.interop.jei; -import at.petrak.hexcasting.common.casting.PatternRegistryManifest; import at.petrak.hexcasting.api.casting.math.HexCoord; +import at.petrak.hexcasting.api.mod.HexTags; +import at.petrak.hexcasting.api.utils.HexUtils; import at.petrak.hexcasting.interop.utils.PatternDrawingUtil; import at.petrak.hexcasting.interop.utils.PatternEntry; +import at.petrak.hexcasting.xplat.IXplatAbstractions; import com.mojang.blaze3d.vertex.PoseStack; import com.mojang.datafixers.util.Pair; import mezz.jei.api.gui.drawable.IDrawable; @@ -24,8 +26,9 @@ public class PatternDrawable implements IDrawable { private final List pathfinderDots; public PatternDrawable(ResourceLocation pattern, int w, int h) { - var entry = PatternRegistryManifest.lookupPattern(pattern); - this.strokeOrder = !entry.isPerWorld(); + var regi = IXplatAbstractions.INSTANCE.getActionRegistry(); + var entry = regi.get(pattern); + this.strokeOrder = !HexUtils.isOfTag(regi, pattern, HexTags.Actions.PER_WORLD_PATTERN); var data = PatternDrawingUtil.loadPatterns( List.of(new Pair<>(entry.prototype(), HexCoord.getOrigin())), 0f, From 7e7b5ff3ae8364c005595e47e5e8e8198b0ef539 Mon Sep 17 00:00:00 2001 From: "petrak@" Date: Sat, 21 Jan 2023 14:08:31 -0600 Subject: [PATCH 39/95] it appears to work?! --- .../casting/PatternRegistryManifest.java | 122 ++---------------- .../common/command/RecalcPatternsCommand.java | 6 +- .../server/ScrungledPatternsSave.java | 119 +++++++++++++++++ .../en_us/entries/patterns/sets.json | 20 +-- .../fabric/FabricHexClientInitializer.kt | 4 +- 5 files changed, 146 insertions(+), 125 deletions(-) create mode 100644 Common/src/main/java/at/petrak/hexcasting/server/ScrungledPatternsSave.java diff --git a/Common/src/main/java/at/petrak/hexcasting/common/casting/PatternRegistryManifest.java b/Common/src/main/java/at/petrak/hexcasting/common/casting/PatternRegistryManifest.java index 47a1e826..f2aa793f 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/casting/PatternRegistryManifest.java +++ b/Common/src/main/java/at/petrak/hexcasting/common/casting/PatternRegistryManifest.java @@ -5,24 +5,19 @@ import at.petrak.hexcasting.api.casting.ActionRegistryEntry; import at.petrak.hexcasting.api.casting.PatternShapeMatch; import at.petrak.hexcasting.api.casting.SpecialHandler; import at.petrak.hexcasting.api.casting.math.EulerPathFinder; -import at.petrak.hexcasting.api.casting.math.HexDir; import at.petrak.hexcasting.api.casting.math.HexPattern; import at.petrak.hexcasting.api.mod.HexTags; import at.petrak.hexcasting.api.utils.HexUtils; +import at.petrak.hexcasting.server.ScrungledPatternsSave; import at.petrak.hexcasting.xplat.IXplatAbstractions; import com.mojang.datafixers.util.Pair; -import net.minecraft.nbt.CompoundTag; import net.minecraft.resources.ResourceKey; -import net.minecraft.resources.ResourceLocation; import net.minecraft.server.level.ServerLevel; -import net.minecraft.world.level.saveddata.SavedData; import org.apache.commons.lang3.NotImplementedException; import org.jetbrains.annotations.Nullable; import java.util.ArrayList; import java.util.Collection; -import java.util.HashMap; -import java.util.Map; import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ConcurrentLinkedDeque; import java.util.concurrent.ConcurrentMap; @@ -64,10 +59,9 @@ public class PatternRegistryManifest { // Then we need to create this only on the server, gulp if (perWorldPatterns != null) { - var precalced = perWorldPatterns.lookup.get(entry.prototype().anglesSignature()); + var precalced = perWorldPatterns.lookup(entry.prototype().anglesSignature()); if (precalced == null) { postCalculationNeeders.add(key); - perWorldPatterns.setDirty(); } } else { // We're on the client, TODO implement the client guessing code @@ -83,8 +77,7 @@ public class PatternRegistryManifest { var regiEntry = registry.get(postNeederKey); var scrungledPat = scrunglePattern(regiEntry.prototype(), overworld.getSeed()); - var entry = new PerWorldEntry(postNeederKey, scrungledPat.getStartDir()); - perWorldPatterns.lookup.put(scrungledPat.anglesSignature(), entry); + perWorldPatterns.insert(scrungledPat, postNeederKey); } } @@ -131,8 +124,8 @@ public class PatternRegistryManifest { // Look it up in the world? var perWorldPatterns = ScrungledPatternsSave.open(overworld); - if (perWorldPatterns.lookup.containsKey(sig)) { - var entry = perWorldPatterns.lookup.get(sig); + var entry = perWorldPatterns.lookup(sig); + if (entry != null) { return new PatternShapeMatch.PerWorld(entry.key(), true); } @@ -152,13 +145,12 @@ public class PatternRegistryManifest { public static HexPattern getCanonicalStrokesPerWorld(ResourceKey key, ServerLevel overworld) { var perWorldPatterns = ScrungledPatternsSave.open(overworld); - if (perWorldPatterns.reverseLookup.containsKey(key)) { - var sig = perWorldPatterns.reverseLookup.get(key); - var entry = perWorldPatterns.lookup.get(sig); - return HexPattern.fromAngles(sig, entry.canonicalStartDir()); - } else { - return null; - } + var pair = perWorldPatterns.lookupReverse(key); + if (pair == null) return null; + + var sig = pair.getFirst(); + var entry = pair.getSecond(); + return HexPattern.fromAngles(sig, entry.canonicalStartDir()); } /** @@ -168,100 +160,10 @@ public class PatternRegistryManifest { return PER_WORLD_ACTIONS; } - /** - * Maps angle sigs to resource locations and their preferred start dir so we can look them up in the main registry - * Save this on the world in case the random algorithm changes. - */ - public static class ScrungledPatternsSave extends SavedData { - private static final String TAG_DIR = "startDir"; - private static final String TAG_KEY = "key"; - - /** - * Maps scrungled signatures to their keys. - */ - private final Map lookup; - - /** - * Reverse-maps resource keys to their signature; you can use that in {@code lookup}. - *

- * This way we can look up things if we know their resource key, for commands and such - */ - private final Map, String> reverseLookup; - - public ScrungledPatternsSave(Map lookup) { - this.lookup = lookup; - this.reverseLookup = new HashMap<>(); - this.lookup.forEach((sig, entry) -> { - this.reverseLookup.put(entry.key, sig); - }); - } - - - @Override - public CompoundTag save(CompoundTag tag) { - // We don't save the reverse lookup cause we can reconstruct it when loading. - this.lookup.forEach((sig, entry) -> { - var inner = new CompoundTag(); - inner.putByte(TAG_DIR, (byte) entry.canonicalStartDir.ordinal()); - inner.putString(TAG_KEY, entry.key().location().toString()); - tag.put(sig, inner); - }); - return tag; - } - - private static ScrungledPatternsSave load(CompoundTag tag) { - var registryKey = IXplatAbstractions.INSTANCE.getActionRegistry().key(); - - var map = new HashMap(); - for (var sig : tag.getAllKeys()) { - var inner = tag.getCompound(sig); - - var rawDir = inner.getByte(TAG_DIR); - var rawKey = inner.getString(TAG_KEY); - - var dir = HexDir.values()[rawDir]; - var key = ResourceKey.create(registryKey, new ResourceLocation(rawKey)); - - map.put(sig, new PerWorldEntry(key, dir)); - } - - return new ScrungledPatternsSave(map); - } - - - public static ScrungledPatternsSave createEmpty() { - var save = new ScrungledPatternsSave(new HashMap<>()); - return save; - } - - public static ScrungledPatternsSave createFromScratch(long seed) { - var map = new HashMap(); - for (var key : PER_WORLD_ACTIONS) { - var regiEntry = IXplatAbstractions.INSTANCE.getActionRegistry().get(key); - var scrungled = scrunglePattern(regiEntry.prototype(), seed); - map.put(scrungled.anglesSignature(), new PerWorldEntry(key, scrungled.getStartDir())); - } - - return new ScrungledPatternsSave(map); - } - - public static ScrungledPatternsSave open(ServerLevel overworld) { - return overworld.getDataStorage().computeIfAbsent( - ScrungledPatternsSave::load, ScrungledPatternsSave::createEmpty, TAG_SAVED_DATA); - } - } - - private record PerWorldEntry(ResourceKey key, HexDir canonicalStartDir) { - } - - public static final String DATA_VERSION = "0.1.0"; - public static final String TAG_SAVED_DATA = "hexcasting.per-world-patterns." + DATA_VERSION; - - /** * Find a valid alternate drawing for this pattern that won't collide with anything pre-existing */ - private static HexPattern scrunglePattern(HexPattern prototype, long seed) { + public static HexPattern scrunglePattern(HexPattern prototype, long seed) { return EulerPathFinder.findAltDrawing(prototype, seed, it -> { var sig = it.anglesSignature(); return !NORMAL_ACTION_LOOKUP.containsKey(sig); diff --git a/Common/src/main/java/at/petrak/hexcasting/common/command/RecalcPatternsCommand.java b/Common/src/main/java/at/petrak/hexcasting/common/command/RecalcPatternsCommand.java index 5b0b1436..0de6729e 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/command/RecalcPatternsCommand.java +++ b/Common/src/main/java/at/petrak/hexcasting/common/command/RecalcPatternsCommand.java @@ -1,6 +1,6 @@ package at.petrak.hexcasting.common.command; -import at.petrak.hexcasting.common.casting.PatternRegistryManifest; +import at.petrak.hexcasting.server.ScrungledPatternsSave; import com.mojang.brigadier.builder.LiteralArgumentBuilder; import net.minecraft.commands.CommandSourceStack; import net.minecraft.commands.Commands; @@ -13,8 +13,8 @@ public class RecalcPatternsCommand { .executes(ctx -> { var world = ctx.getSource().getServer().overworld(); var ds = world.getDataStorage(); - ds.set(PatternRegistryManifest.TAG_SAVED_DATA, - PatternRegistryManifest.ScrungledPatternsSave.createEmpty()); + ds.set(ScrungledPatternsSave.TAG_SAVED_DATA, + ScrungledPatternsSave.createFromScratch(world.getSeed())); ctx.getSource().sendSuccess( Component.translatable("command.hexcasting.recalc"), true); diff --git a/Common/src/main/java/at/petrak/hexcasting/server/ScrungledPatternsSave.java b/Common/src/main/java/at/petrak/hexcasting/server/ScrungledPatternsSave.java new file mode 100644 index 00000000..236da74c --- /dev/null +++ b/Common/src/main/java/at/petrak/hexcasting/server/ScrungledPatternsSave.java @@ -0,0 +1,119 @@ +package at.petrak.hexcasting.server; + +import at.petrak.hexcasting.api.casting.ActionRegistryEntry; +import at.petrak.hexcasting.api.casting.math.HexDir; +import at.petrak.hexcasting.api.casting.math.HexPattern; +import at.petrak.hexcasting.common.casting.PatternRegistryManifest; +import at.petrak.hexcasting.xplat.IXplatAbstractions; +import com.mojang.datafixers.util.Pair; +import net.minecraft.nbt.CompoundTag; +import net.minecraft.resources.ResourceKey; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.server.level.ServerLevel; +import net.minecraft.world.level.saveddata.SavedData; +import org.jetbrains.annotations.Nullable; + +import java.util.HashMap; +import java.util.Map; + +/** + * Maps angle sigs to resource locations and their preferred start dir so we can look them up in the main registry + * Save this on the world in case the random algorithm changes. + */ +public class ScrungledPatternsSave extends SavedData { + public static final String DATA_VERSION = "0.1.0"; + public static final String TAG_SAVED_DATA = "hexcasting.per-world-patterns." + DATA_VERSION; + private static final String TAG_DIR = "startDir"; + private static final String TAG_KEY = "key"; + + /** + * Maps scrungled signatures to their keys. + */ + private final Map lookup; + + /** + * Reverse-maps resource keys to their signature; you can use that in {@code lookup}. + *

+ * This way we can look up things if we know their resource key, for commands and such + */ + private final Map, String> reverseLookup; + + private ScrungledPatternsSave(Map lookup) { + this.lookup = lookup; + this.reverseLookup = new HashMap<>(); + this.lookup.forEach((sig, entry) -> { + this.reverseLookup.put(entry.key, sig); + }); + } + + public void insert(HexPattern scrungledPattern, ResourceKey key) { + this.lookup.put(scrungledPattern.anglesSignature(), new PerWorldEntry(key, scrungledPattern.getStartDir())); + this.reverseLookup.put(key, scrungledPattern.anglesSignature()); + this.setDirty(); + } + + @Nullable + public PerWorldEntry lookup(String signature) { + return this.lookup.get(signature); + } + + @Nullable + public Pair lookupReverse(ResourceKey key) { + var sig = this.reverseLookup.get(key); + if (sig == null) return null; + + return Pair.of(sig, this.lookup.get(sig)); + } + + @Override + public CompoundTag save(CompoundTag tag) { + // We don't save the reverse lookup cause we can reconstruct it when loading. + this.lookup.forEach((sig, entry) -> { + var inner = new CompoundTag(); + inner.putByte(TAG_DIR, (byte) entry.canonicalStartDir.ordinal()); + inner.putString(TAG_KEY, entry.key().location().toString()); + tag.put(sig, inner); + }); + return tag; + } + + private static ScrungledPatternsSave load(CompoundTag tag) { + var registryKey = IXplatAbstractions.INSTANCE.getActionRegistry().key(); + + var map = new HashMap(); + for (var sig : tag.getAllKeys()) { + var inner = tag.getCompound(sig); + + var rawDir = inner.getByte(TAG_DIR); + var rawKey = inner.getString(TAG_KEY); + + var dir = HexDir.values()[rawDir]; + var key = ResourceKey.create(registryKey, new ResourceLocation(rawKey)); + + map.put(sig, new PerWorldEntry(key, dir)); + } + + return new ScrungledPatternsSave(map); + } + + public static ScrungledPatternsSave createFromScratch(long seed) { + var map = new HashMap(); + for (var key : PatternRegistryManifest.getAllPerWorldActions()) { + var regiEntry = IXplatAbstractions.INSTANCE.getActionRegistry().get(key); + var scrungled = PatternRegistryManifest.scrunglePattern(regiEntry.prototype(), seed); + map.put(scrungled.anglesSignature(), new PerWorldEntry(key, scrungled.getStartDir())); + } + + return new ScrungledPatternsSave(map); + } + + public static ScrungledPatternsSave open(ServerLevel overworld) { + return overworld.getDataStorage().computeIfAbsent( + ScrungledPatternsSave::load, + () -> ScrungledPatternsSave.createFromScratch(overworld.getSeed()), + TAG_SAVED_DATA); + } + + public record PerWorldEntry(ResourceKey key, HexDir canonicalStartDir) { + } +} diff --git a/Common/src/main/resources/data/hexcasting/patchouli_books/thehexbook/en_us/entries/patterns/sets.json b/Common/src/main/resources/data/hexcasting/patchouli_books/thehexbook/en_us/entries/patterns/sets.json index 293e9d31..7d6a397e 100644 --- a/Common/src/main/resources/data/hexcasting/patchouli_books/thehexbook/en_us/entries/patterns/sets.json +++ b/Common/src/main/resources/data/hexcasting/patchouli_books/thehexbook/en_us/entries/patterns/sets.json @@ -15,8 +15,8 @@ }, { "type": "hexcasting:pattern", - "op_id": "hexcasting:or_bit", - "anchor": "hexcasting:or_bit", + "op_id": "hexcasting:bit/or", + "anchor": "hexcasting:bit/or", "input": "num, num/list, list", "output": "num/list", "text": "hexcasting.page.sets.or.1" @@ -27,8 +27,8 @@ }, { "type": "hexcasting:pattern", - "op_id": "hexcasting:and_bit", - "anchor": "hexcasting:and_bit", + "op_id": "hexcasting:bit/and", + "anchor": "hexcasting:bit/and", "input": "num, num/list, list", "output": "num/list", "text": "hexcasting.page.sets.and.1" @@ -39,8 +39,8 @@ }, { "type": "hexcasting:pattern", - "op_id": "hexcasting:xor_bit", - "anchor": "hexcasting:xor_bit", + "op_id": "hexcasting:bit/xor", + "anchor": "hexcasting:bit/xor", "input": "num, num/list, list", "output": "num/list", "text": "hexcasting.page.sets.xor.1" @@ -51,16 +51,16 @@ }, { "type": "hexcasting:pattern", - "op_id": "hexcasting:not_bit", - "anchor": "hexcasting:not_bit", + "op_id": "hexcasting:bit/not", + "anchor": "hexcasting:bit/not", "input": "num", "output": "num", "text": "hexcasting.page.sets.not" }, { "type": "hexcasting:pattern", - "op_id": "hexcasting:to_set", - "anchor": "hexcasting:to_set", + "op_id": "hexcasting:bit/to_set", + "anchor": "hexcasting:bit/to_set", "input": "list", "output": "list", "text": "hexcasting.page.sets.to_set" diff --git a/Fabric/src/main/java/at/petrak/hexcasting/fabric/FabricHexClientInitializer.kt b/Fabric/src/main/java/at/petrak/hexcasting/fabric/FabricHexClientInitializer.kt index ef8b6219..45e7877d 100644 --- a/Fabric/src/main/java/at/petrak/hexcasting/fabric/FabricHexClientInitializer.kt +++ b/Fabric/src/main/java/at/petrak/hexcasting/fabric/FabricHexClientInitializer.kt @@ -11,8 +11,8 @@ import at.petrak.hexcasting.fabric.event.MouseScrollCallback import at.petrak.hexcasting.fabric.network.FabricPacketHandler import at.petrak.hexcasting.interop.HexInterop import net.fabricmc.api.ClientModInitializer -import net.fabricmc.fabric.api.client.event.lifecycle.v1.ClientLifecycleEvents import net.fabricmc.fabric.api.client.event.lifecycle.v1.ClientTickEvents +import net.fabricmc.fabric.api.client.networking.v1.ClientPlayConnectionEvents import net.fabricmc.fabric.api.client.particle.v1.ParticleFactoryRegistry import net.fabricmc.fabric.api.client.rendering.v1.* import net.minecraft.client.particle.ParticleProvider @@ -38,7 +38,7 @@ object FabricHexClientInitializer : ClientModInitializer { ShiftScrollListener.clientTickEnd() } TooltipComponentCallback.EVENT.register(PatternTooltipComponent::tryConvert) - ClientLifecycleEvents.CLIENT_STARTED.register { + ClientPlayConnectionEvents.JOIN.register { _, _, _ -> PatternRegistryManifest.processRegistry(null) } From 2f2ab698167765d9852a6327cd0054a5ae5fd9fb Mon Sep 17 00:00:00 2001 From: "petrak@" Date: Sat, 21 Jan 2023 14:51:40 -0600 Subject: [PATCH 40/95] fixed action tags not working on fabc --- .../common/casting/PatternRegistryManifest.java | 4 ++-- .../03e4de26f1265135874f8cdcaebc09d9c08eb42b | 2 +- .../67cce32b1c3cbbcb1f646605f4914e3f196986c2 | 2 +- .../75bcd4dba6ca7d365462b0ec45e291d1056349c4 | 2 +- .../844611d4af49e23072b8a888c8e73c6c5d8c0768 | 3 +++ .../9fb1092f32d4fcbf9e061ffd718d4ec689c6c95e | 2 +- .../hexcasting/tags/action/per_world_pattern.json | 13 +++++++++++++ .../tags/action/requires_enlightenment.json | 14 ++++++++++++++ .../fabric/datagen/HexFabricDataGenerators.java | 3 +++ .../844611d4af49e23072b8a888c8e73c6c5d8c0768 | 2 +- .../tags/hexcasting/action/per_world_pattern.json | 0 .../hexcasting/action/requires_enlightenment.json | 0 .../forge/datagen/HexForgeDataGenerators.java | 4 ++-- 13 files changed, 42 insertions(+), 9 deletions(-) create mode 100644 Fabric/src/generated/resources/.cache/844611d4af49e23072b8a888c8e73c6c5d8c0768 create mode 100644 Fabric/src/generated/resources/data/hexcasting/tags/action/per_world_pattern.json create mode 100644 Fabric/src/generated/resources/data/hexcasting/tags/action/requires_enlightenment.json rename {Common => Forge}/src/generated/resources/.cache/844611d4af49e23072b8a888c8e73c6c5d8c0768 (76%) rename {Common => Forge}/src/generated/resources/data/hexcasting/tags/hexcasting/action/per_world_pattern.json (100%) rename {Common => Forge}/src/generated/resources/data/hexcasting/tags/hexcasting/action/requires_enlightenment.json (100%) diff --git a/Common/src/main/java/at/petrak/hexcasting/common/casting/PatternRegistryManifest.java b/Common/src/main/java/at/petrak/hexcasting/common/casting/PatternRegistryManifest.java index f2aa793f..76472e24 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/casting/PatternRegistryManifest.java +++ b/Common/src/main/java/at/petrak/hexcasting/common/casting/PatternRegistryManifest.java @@ -81,8 +81,8 @@ public class PatternRegistryManifest { } } - HexAPI.LOGGER.info(("We're on the %s! Loaded %d regular actions, %d per-world actions, and %d special " + - "handlers").formatted( + HexAPI.LOGGER.info(("We're on the %s! " + + "Loaded %d regular actions, %d per-world actions, and %d special handlers").formatted( (overworld == null) ? "client" : "server", NORMAL_ACTION_LOOKUP.size(), PER_WORLD_ACTIONS.size(), IXplatAbstractions.INSTANCE.getSpecialHandlerRegistry().size() )); diff --git a/Fabric/src/generated/resources/.cache/03e4de26f1265135874f8cdcaebc09d9c08eb42b b/Fabric/src/generated/resources/.cache/03e4de26f1265135874f8cdcaebc09d9c08eb42b index 6bbac1c9..43d3daa8 100644 --- a/Fabric/src/generated/resources/.cache/03e4de26f1265135874f8cdcaebc09d9c08eb42b +++ b/Fabric/src/generated/resources/.cache/03e4de26f1265135874f8cdcaebc09d9c08eb42b @@ -1,4 +1,4 @@ -// 1.19.2 2023-01-21T13:21:56.749293749 Tags for minecraft:item +// 1.19.2 2023-01-21T14:45:49.102988105 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 5b0192b2..2344bfbc 100644 --- a/Fabric/src/generated/resources/.cache/67cce32b1c3cbbcb1f646605f4914e3f196986c2 +++ b/Fabric/src/generated/resources/.cache/67cce32b1c3cbbcb1f646605f4914e3f196986c2 @@ -1,4 +1,4 @@ -// 1.19.2 2023-01-21T13:21:56.793259038 LootTables +// 1.19.2 2023-01-21T14:45:49.133731101 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 4d845417..f671e6ab 100644 --- a/Fabric/src/generated/resources/.cache/75bcd4dba6ca7d365462b0ec45e291d1056349c4 +++ b/Fabric/src/generated/resources/.cache/75bcd4dba6ca7d365462b0ec45e291d1056349c4 @@ -1,4 +1,4 @@ -// 1.19.2 2023-01-21T13:21:56.751752593 Tags for minecraft:block +// 1.19.2 2023-01-21T14:45:49.143179079 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 new file mode 100644 index 00000000..db33488f --- /dev/null +++ b/Fabric/src/generated/resources/.cache/844611d4af49e23072b8a888c8e73c6c5d8c0768 @@ -0,0 +1,3 @@ +// 1.19.2 2023-01-21T14:45:49.142544446 Tags for hexcasting:action +e5afc567ea17f035e4eb1d1d48825100b7f6ad68 data/hexcasting/tags/action/per_world_pattern.json +e0464372b1bfe00bb9e9fdaa9889f88c31080cc4 data/hexcasting/tags/action/requires_enlightenment.json diff --git a/Fabric/src/generated/resources/.cache/9fb1092f32d4fcbf9e061ffd718d4ec689c6c95e b/Fabric/src/generated/resources/.cache/9fb1092f32d4fcbf9e061ffd718d4ec689c6c95e index b291e45c..5d9065de 100644 --- a/Fabric/src/generated/resources/.cache/9fb1092f32d4fcbf9e061ffd718d4ec689c6c95e +++ b/Fabric/src/generated/resources/.cache/9fb1092f32d4fcbf9e061ffd718d4ec689c6c95e @@ -1,4 +1,4 @@ -// 1.19.2 2023-01-21T13:21:56.764789809 Recipes +// 1.19.2 2023-01-21T14:45:49.119742079 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/per_world_pattern.json b/Fabric/src/generated/resources/data/hexcasting/tags/action/per_world_pattern.json new file mode 100644 index 00000000..2417e4d5 --- /dev/null +++ b/Fabric/src/generated/resources/data/hexcasting/tags/action/per_world_pattern.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 new file mode 100644 index 00000000..bbfcb9b7 --- /dev/null +++ b/Fabric/src/generated/resources/data/hexcasting/tags/action/requires_enlightenment.json @@ -0,0 +1,14 @@ +{ + "replace": false, + "values": [ + "hexcasting:lightning", + "hexcasting:flight", + "hexcasting:create_lava", + "hexcasting:teleport", + "hexcasting:sentinel/create/great", + "hexcasting:dispel_rain", + "hexcasting:summon_rain", + "hexcasting:brainsweep", + "hexcasting:akashic/write" + ] +} \ No newline at end of file diff --git a/Fabric/src/main/java/at/petrak/hexcasting/fabric/datagen/HexFabricDataGenerators.java b/Fabric/src/main/java/at/petrak/hexcasting/fabric/datagen/HexFabricDataGenerators.java index 5379a969..fb651dbd 100644 --- a/Fabric/src/main/java/at/petrak/hexcasting/fabric/datagen/HexFabricDataGenerators.java +++ b/Fabric/src/main/java/at/petrak/hexcasting/fabric/datagen/HexFabricDataGenerators.java @@ -5,6 +5,7 @@ import at.petrak.hexcasting.datagen.HexLootTables; import at.petrak.hexcasting.datagen.IXplatIngredients; import at.petrak.hexcasting.datagen.recipe.HexplatRecipes; import at.petrak.hexcasting.datagen.recipe.builders.FarmersDelightToolIngredient; +import at.petrak.hexcasting.datagen.tag.HexActionTagProvider; import at.petrak.hexcasting.datagen.tag.HexBlockTagProvider; import at.petrak.hexcasting.datagen.tag.HexItemTagProvider; import at.petrak.hexcasting.fabric.recipe.FabricModConditionalIngredient; @@ -33,6 +34,8 @@ public class HexFabricDataGenerators implements DataGeneratorEntrypoint { gen.addProvider(blockTagProvider); gen.addProvider(new HexItemTagProvider(gen, blockTagProvider, xtags)); + gen.addProvider(new HexActionTagProvider(gen)); + gen.addProvider(new HexLootTables(gen)); } diff --git a/Common/src/generated/resources/.cache/844611d4af49e23072b8a888c8e73c6c5d8c0768 b/Forge/src/generated/resources/.cache/844611d4af49e23072b8a888c8e73c6c5d8c0768 similarity index 76% rename from Common/src/generated/resources/.cache/844611d4af49e23072b8a888c8e73c6c5d8c0768 rename to Forge/src/generated/resources/.cache/844611d4af49e23072b8a888c8e73c6c5d8c0768 index 74f865db..6914e485 100644 --- a/Common/src/generated/resources/.cache/844611d4af49e23072b8a888c8e73c6c5d8c0768 +++ b/Forge/src/generated/resources/.cache/844611d4af49e23072b8a888c8e73c6c5d8c0768 @@ -1,3 +1,3 @@ -// 1.19.2 2023-01-21T13:20:42.592825003 Tags for hexcasting:action +// 1.19.2 2023-01-21T14:47:29.414121689 Tags for hexcasting:action 7684713a5311ad151b5591d22757988c8462d647 data/hexcasting/tags/hexcasting/action/per_world_pattern.json 9eb0b98603394a44b9202d1ff6778a539edfdfa4 data/hexcasting/tags/hexcasting/action/requires_enlightenment.json diff --git a/Common/src/generated/resources/data/hexcasting/tags/hexcasting/action/per_world_pattern.json b/Forge/src/generated/resources/data/hexcasting/tags/hexcasting/action/per_world_pattern.json similarity index 100% rename from Common/src/generated/resources/data/hexcasting/tags/hexcasting/action/per_world_pattern.json rename to Forge/src/generated/resources/data/hexcasting/tags/hexcasting/action/per_world_pattern.json diff --git a/Common/src/generated/resources/data/hexcasting/tags/hexcasting/action/requires_enlightenment.json b/Forge/src/generated/resources/data/hexcasting/tags/hexcasting/action/requires_enlightenment.json similarity index 100% rename from Common/src/generated/resources/data/hexcasting/tags/hexcasting/action/requires_enlightenment.json rename to Forge/src/generated/resources/data/hexcasting/tags/hexcasting/action/requires_enlightenment.json diff --git a/Forge/src/main/java/at/petrak/hexcasting/forge/datagen/HexForgeDataGenerators.java b/Forge/src/main/java/at/petrak/hexcasting/forge/datagen/HexForgeDataGenerators.java index 64c567a7..1304019d 100644 --- a/Forge/src/main/java/at/petrak/hexcasting/forge/datagen/HexForgeDataGenerators.java +++ b/Forge/src/main/java/at/petrak/hexcasting/forge/datagen/HexForgeDataGenerators.java @@ -51,8 +51,6 @@ public class HexForgeDataGenerators { gen.addProvider(ev.includeClient(), new HexBlockStatesAndModels(gen, efh)); gen.addProvider(ev.includeServer(), PaucalForgeDatagenWrappers.addEFHToAdvancements(new HexAdvancements(gen), efh)); - gen.addProvider(ev.includeServer(), PaucalForgeDatagenWrappers.addEFHToTagProvider( - new HexActionTagProvider(gen), efh)); } private static void configureForgeDatagen(GatherDataEvent ev) { @@ -70,6 +68,8 @@ public class HexForgeDataGenerators { var itemTagProvider = PaucalForgeDatagenWrappers.addEFHToTagProvider( new HexItemTagProvider(gen, blockTagProvider, IXplatAbstractions.INSTANCE.tags()), efh); gen.addProvider(ev.includeServer(), itemTagProvider); + gen.addProvider(ev.includeServer(), + PaucalForgeDatagenWrappers.addEFHToTagProvider(new HexActionTagProvider(gen), efh)); } private static final IXplatIngredients INGREDIENTS = new IXplatIngredients() { From 05e4114b97446d1badeccb39e52ce8c9bc80dbae Mon Sep 17 00:00:00 2001 From: "petrak@" Date: Sat, 21 Jan 2023 15:49:20 -0600 Subject: [PATCH 41/95] 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 From 4010ea6d9ec736ffee0099afb2142d422d399185 Mon Sep 17 00:00:00 2001 From: "petrak@" Date: Sat, 21 Jan 2023 17:35:41 -0600 Subject: [PATCH 42/95] move more things --- .../main/java/at/petrak/hexcasting/README.md | 4 +-- .../java/at/petrak/hexcasting/api/HexAPI.java | 2 +- .../api/casting/ActionRegistryEntry.java | 1 + .../api/casting/PatternShapeMatch.java | 1 + .../api/casting/{ => castables}/Action.kt | 3 ++- .../{ => castables}/ConstMediaAction.kt | 3 ++- .../{ => castables}/SpecialHandler.java | 8 +++--- .../casting/{ => castables}/SpellAction.kt | 5 +++- .../hexcasting/api/casting/eval/CastResult.kt | 20 +++++++++++++++ .../api/casting/eval/CastingContext.kt | 2 +- .../api/casting/eval/CastingHarness.kt | 25 ++++++------------- .../api/casting/eval/vm/ContinuationFrame.kt | 2 +- .../api/casting/eval/vm/FrameEvaluate.kt | 5 ++-- .../api/casting/eval/vm/FrameFinishEval.kt | 7 +++--- .../api/casting/eval/vm/FrameForEach.kt | 7 +++--- .../casting/PatternRegistryManifest.java | 2 +- .../casting/operators/OpBlockAxisRaycast.kt | 4 +-- .../casting/operators/OpBlockRaycast.kt | 4 +-- .../casting/operators/OpEntityHeight.kt | 2 +- .../common/casting/operators/OpEntityLook.kt | 2 +- .../common/casting/operators/OpEntityPos.kt | 2 +- .../casting/operators/OpEntityRaycast.kt | 4 +-- .../casting/operators/OpEntityVelocity.kt | 2 +- .../operators/akashic/OpAkashicRead.kt | 2 +- .../operators/akashic/OpAkashicWrite.kt | 1 + .../operators/circles/OpCircleBounds.kt | 2 +- .../casting/operators/circles/OpImpetusDir.kt | 2 +- .../casting/operators/circles/OpImpetusPos.kt | 2 +- .../common/casting/operators/eval/OpEval.kt | 2 +- .../casting/operators/eval/OpEvalDelay.kt | 2 +- .../casting/operators/eval/OpForEach.kt | 2 +- .../common/casting/operators/eval/OpHalt.kt | 2 +- .../casting/operators/lists/OpAppend.kt | 2 +- .../casting/operators/lists/OpConcat.kt | 2 +- .../common/casting/operators/lists/OpCons.kt | 2 +- .../casting/operators/lists/OpEmptyList.kt | 2 +- .../common/casting/operators/lists/OpIndex.kt | 2 +- .../casting/operators/lists/OpIndexOf.kt | 2 +- .../casting/operators/lists/OpLastNToList.kt | 2 +- .../casting/operators/lists/OpListSize.kt | 2 +- .../operators/lists/OpModifyInPlace.kt | 1 + .../casting/operators/lists/OpRemove.kt | 2 +- .../casting/operators/lists/OpReverski.kt | 2 +- .../casting/operators/lists/OpSingleton.kt | 2 +- .../common/casting/operators/lists/OpSlice.kt | 2 +- .../common/casting/operators/lists/OpSplat.kt | 2 +- .../casting/operators/lists/OpUnCons.kt | 2 +- .../casting/operators/local/OpPeekLocal.kt | 2 +- .../casting/operators/local/OpPushLocal.kt | 2 +- .../common/casting/operators/math/OpAbsLen.kt | 2 +- .../common/casting/operators/math/OpAdd.kt | 2 +- .../common/casting/operators/math/OpCeil.kt | 2 +- .../casting/operators/math/OpCoerceToAxial.kt | 2 +- .../casting/operators/math/OpConstructVec.kt | 2 +- .../operators/math/OpDeconstructVec.kt | 2 +- .../casting/operators/math/OpDivCross.kt | 2 +- .../common/casting/operators/math/OpFloor.kt | 2 +- .../common/casting/operators/math/OpLog.kt | 2 +- .../common/casting/operators/math/OpModulo.kt | 2 +- .../common/casting/operators/math/OpMulDot.kt | 2 +- .../casting/operators/math/OpPowProj.kt | 2 +- .../common/casting/operators/math/OpRandom.kt | 2 +- .../common/casting/operators/math/OpSub.kt | 2 +- .../math/SpecialHandlerNumberLiteral.kt | 8 +++--- .../casting/operators/math/bit/OpAnd.kt | 1 + .../casting/operators/math/bit/OpNot.kt | 2 +- .../common/casting/operators/math/bit/OpOr.kt | 1 + .../casting/operators/math/bit/OpToSet.kt | 2 +- .../casting/operators/math/bit/OpXor.kt | 1 + .../casting/operators/math/logic/OpBoolAnd.kt | 2 +- .../casting/operators/math/logic/OpBoolIf.kt | 2 +- .../casting/operators/math/logic/OpBoolNot.kt | 2 +- .../casting/operators/math/logic/OpBoolOr.kt | 2 +- .../casting/operators/math/logic/OpBoolXor.kt | 2 +- .../operators/math/logic/OpCoerceToBool.kt | 2 +- .../casting/operators/math/logic/OpCompare.kt | 2 +- .../operators/math/logic/OpEquality.kt | 2 +- .../casting/operators/math/trig/OpArcCos.kt | 2 +- .../casting/operators/math/trig/OpArcSin.kt | 2 +- .../casting/operators/math/trig/OpArcTan.kt | 2 +- .../casting/operators/math/trig/OpArcTan2.kt | 2 +- .../casting/operators/math/trig/OpCos.kt | 2 +- .../casting/operators/math/trig/OpSin.kt | 2 +- .../casting/operators/math/trig/OpTan.kt | 2 +- .../common/casting/operators/rw/OpRead.kt | 2 +- .../common/casting/operators/rw/OpReadable.kt | 2 +- .../casting/operators/rw/OpTheCoolerRead.kt | 2 +- .../operators/rw/OpTheCoolerReadable.kt | 2 +- .../operators/rw/OpTheCoolerWritable.kt | 2 +- .../casting/operators/rw/OpTheCoolerWrite.kt | 2 +- .../common/casting/operators/rw/OpWritable.kt | 2 +- .../common/casting/operators/rw/OpWrite.kt | 2 +- .../operators/selectors/OpGetCaster.kt | 2 +- .../operators/selectors/OpGetEntitiesBy.kt | 2 +- .../operators/selectors/OpGetEntityAt.kt | 2 +- .../casting/operators/spells/OpAddMotion.kt | 1 + .../common/casting/operators/spells/OpBeep.kt | 1 + .../casting/operators/spells/OpBlink.kt | 1 + .../casting/operators/spells/OpBreakBlock.kt | 2 +- .../casting/operators/spells/OpColorize.kt | 2 +- .../operators/spells/OpConjureBlock.kt | 2 +- .../casting/operators/spells/OpCreateFluid.kt | 2 +- .../operators/spells/OpDestroyFluid.kt | 2 +- .../operators/spells/OpEdifySapling.kt | 2 +- .../casting/operators/spells/OpErase.kt | 2 +- .../casting/operators/spells/OpExplode.kt | 1 + .../casting/operators/spells/OpExtinguish.kt | 2 +- .../casting/operators/spells/OpIgnite.kt | 2 +- .../casting/operators/spells/OpMakeBattery.kt | 2 +- .../operators/spells/OpMakePackagedSpell.kt | 1 + .../casting/operators/spells/OpPlaceBlock.kt | 2 +- .../operators/spells/OpPotionEffect.kt | 1 + .../casting/operators/spells/OpPrint.kt | 2 +- .../casting/operators/spells/OpRecharge.kt | 2 +- .../OpTheOnlyReasonAnyoneDownloadedPsi.kt | 2 +- .../operators/spells/great/OpBrainsweep.kt | 1 + .../operators/spells/great/OpFlight.kt | 1 + .../operators/spells/great/OpLightning.kt | 2 +- .../operators/spells/great/OpTeleport.kt | 1 + .../operators/spells/great/OpWeather.kt | 2 +- .../spells/sentinel/OpCreateSentinel.kt | 2 +- .../spells/sentinel/OpDestroySentinel.kt | 2 +- .../spells/sentinel/OpGetSentinelPos.kt | 2 +- .../spells/sentinel/OpGetSentinelWayfind.kt | 2 +- .../OpAlwinfyHasAscendedToABeingOfPureMath.kt | 2 +- .../casting/operators/stack/OpBitMask.kt | 2 +- .../casting/operators/stack/OpDuplicateN.kt | 2 +- .../casting/operators/stack/OpFisherman.kt | 2 +- .../operators/stack/OpFishermanButItCopies.kt | 2 +- .../common/casting/operators/stack/OpMask.kt | 2 +- .../casting/operators/stack/OpStackSize.kt | 2 +- .../casting/operators/stack/OpTwiddling.kt | 2 +- .../operators/stack/SpecialHandlerMask.kt | 8 +++--- .../hexcasting/common/lib/hex/HexActions.java | 2 +- .../common/lib/hex/HexSpecialHandlers.java | 2 +- .../hexcasting/interop/pehkui/OpGetScale.kt | 2 +- .../hexcasting/interop/pehkui/OpSetScale.kt | 1 + .../hexcasting/xplat/IXplatAbstractions.java | 2 +- .../fabric/interop/gravity/OpChangeGravity.kt | 1 + .../fabric/interop/gravity/OpGetGravity.kt | 2 +- .../fabric/xplat/FabricXplatImpl.java | 2 +- .../forge/xplat/ForgeXplatImpl.java | 2 +- 142 files changed, 194 insertions(+), 157 deletions(-) rename Common/src/main/java/at/petrak/hexcasting/api/casting/{ => castables}/Action.kt (95%) rename Common/src/main/java/at/petrak/hexcasting/api/casting/{ => castables}/ConstMediaAction.kt (91%) rename Common/src/main/java/at/petrak/hexcasting/api/casting/{ => castables}/SpecialHandler.java (88%) rename Common/src/main/java/at/petrak/hexcasting/api/casting/{ => castables}/SpellAction.kt (88%) create mode 100644 Common/src/main/java/at/petrak/hexcasting/api/casting/eval/CastResult.kt diff --git a/Common/src/main/java/at/petrak/hexcasting/README.md b/Common/src/main/java/at/petrak/hexcasting/README.md index 8dd3a12c..a96585f0 100644 --- a/Common/src/main/java/at/petrak/hexcasting/README.md +++ b/Common/src/main/java/at/petrak/hexcasting/README.md @@ -4,6 +4,6 @@ The "flavor text" words for things in this mod and the internal names are differ - A "Hex" is a `Cast`, cast through a [`CastingHarness`](api/casting/eval/CastingHarness.kt) - A "Pattern" is a [`HexPattern`](api/casting/math/HexPattern.kt) -- An "Action" is an [`Operator`](api/casting/Action.kt) -- An action that pushes a spell is a [`Spell`](api/casting/SpellAction.kt) +- An "Action" is an [`Operator`](api/casting/castables/Action.kt) +- An action that pushes a spell is a [`Spell`](api/casting/castables/SpellAction.kt) diff --git a/Common/src/main/java/at/petrak/hexcasting/api/HexAPI.java b/Common/src/main/java/at/petrak/hexcasting/api/HexAPI.java index b3722477..4872b945 100644 --- a/Common/src/main/java/at/petrak/hexcasting/api/HexAPI.java +++ b/Common/src/main/java/at/petrak/hexcasting/api/HexAPI.java @@ -1,7 +1,7 @@ package at.petrak.hexcasting.api; import at.petrak.hexcasting.api.casting.ActionRegistryEntry; -import at.petrak.hexcasting.api.casting.SpecialHandler; +import at.petrak.hexcasting.api.casting.castables.SpecialHandler; import com.google.common.base.Suppliers; import net.minecraft.ChatFormatting; import net.minecraft.network.chat.Component; diff --git a/Common/src/main/java/at/petrak/hexcasting/api/casting/ActionRegistryEntry.java b/Common/src/main/java/at/petrak/hexcasting/api/casting/ActionRegistryEntry.java index 374508c6..dbc5dc06 100644 --- a/Common/src/main/java/at/petrak/hexcasting/api/casting/ActionRegistryEntry.java +++ b/Common/src/main/java/at/petrak/hexcasting/api/casting/ActionRegistryEntry.java @@ -1,5 +1,6 @@ package at.petrak.hexcasting.api.casting; +import at.petrak.hexcasting.api.casting.castables.Action; import at.petrak.hexcasting.api.casting.math.HexPattern; /** diff --git a/Common/src/main/java/at/petrak/hexcasting/api/casting/PatternShapeMatch.java b/Common/src/main/java/at/petrak/hexcasting/api/casting/PatternShapeMatch.java index 068d9982..b72d3498 100644 --- a/Common/src/main/java/at/petrak/hexcasting/api/casting/PatternShapeMatch.java +++ b/Common/src/main/java/at/petrak/hexcasting/api/casting/PatternShapeMatch.java @@ -1,5 +1,6 @@ package at.petrak.hexcasting.api.casting; +import at.petrak.hexcasting.api.casting.castables.SpecialHandler; import net.minecraft.resources.ResourceKey; /** diff --git a/Common/src/main/java/at/petrak/hexcasting/api/casting/Action.kt b/Common/src/main/java/at/petrak/hexcasting/api/casting/castables/Action.kt similarity index 95% rename from Common/src/main/java/at/petrak/hexcasting/api/casting/Action.kt rename to Common/src/main/java/at/petrak/hexcasting/api/casting/castables/Action.kt index 710f9cd6..24ff61bf 100644 --- a/Common/src/main/java/at/petrak/hexcasting/api/casting/Action.kt +++ b/Common/src/main/java/at/petrak/hexcasting/api/casting/castables/Action.kt @@ -1,5 +1,6 @@ -package at.petrak.hexcasting.api.casting +package at.petrak.hexcasting.api.casting.castables +import at.petrak.hexcasting.api.casting.OperationResult 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 diff --git a/Common/src/main/java/at/petrak/hexcasting/api/casting/ConstMediaAction.kt b/Common/src/main/java/at/petrak/hexcasting/api/casting/castables/ConstMediaAction.kt similarity index 91% rename from Common/src/main/java/at/petrak/hexcasting/api/casting/ConstMediaAction.kt rename to Common/src/main/java/at/petrak/hexcasting/api/casting/castables/ConstMediaAction.kt index 651cef53..aa33a4b5 100644 --- a/Common/src/main/java/at/petrak/hexcasting/api/casting/ConstMediaAction.kt +++ b/Common/src/main/java/at/petrak/hexcasting/api/casting/castables/ConstMediaAction.kt @@ -1,5 +1,6 @@ -package at.petrak.hexcasting.api.casting +package at.petrak.hexcasting.api.casting.castables +import at.petrak.hexcasting.api.casting.OperationResult 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 diff --git a/Common/src/main/java/at/petrak/hexcasting/api/casting/SpecialHandler.java b/Common/src/main/java/at/petrak/hexcasting/api/casting/castables/SpecialHandler.java similarity index 88% rename from Common/src/main/java/at/petrak/hexcasting/api/casting/SpecialHandler.java rename to Common/src/main/java/at/petrak/hexcasting/api/casting/castables/SpecialHandler.java index ea331c04..512c8254 100644 --- a/Common/src/main/java/at/petrak/hexcasting/api/casting/SpecialHandler.java +++ b/Common/src/main/java/at/petrak/hexcasting/api/casting/castables/SpecialHandler.java @@ -1,4 +1,4 @@ -package at.petrak.hexcasting.api.casting; +package at.petrak.hexcasting.api.casting.castables; import at.petrak.hexcasting.api.casting.math.HexPattern; import net.minecraft.network.chat.Component; @@ -15,18 +15,18 @@ import org.jetbrains.annotations.Nullable; * {@link Action} instances on the client. We can have SpecialHandlers on the client though because they're just * wrappers. */ -public abstract class SpecialHandler { +public interface SpecialHandler { /** * Convert this to an action, for modification of the stack and state. *

* This is called on the SERVER-SIDE ONLY. */ - public abstract Action act(); + Action act(); /** * Get the name of this handler. */ - public abstract Component getName(); + Component getName(); /** * Given a pattern, possibly make up the special handler from it. diff --git a/Common/src/main/java/at/petrak/hexcasting/api/casting/SpellAction.kt b/Common/src/main/java/at/petrak/hexcasting/api/casting/castables/SpellAction.kt similarity index 88% rename from Common/src/main/java/at/petrak/hexcasting/api/casting/SpellAction.kt rename to Common/src/main/java/at/petrak/hexcasting/api/casting/castables/SpellAction.kt index c630b7d4..d6440d22 100644 --- a/Common/src/main/java/at/petrak/hexcasting/api/casting/SpellAction.kt +++ b/Common/src/main/java/at/petrak/hexcasting/api/casting/castables/SpellAction.kt @@ -1,5 +1,8 @@ -package at.petrak.hexcasting.api.casting +package at.petrak.hexcasting.api.casting.castables +import at.petrak.hexcasting.api.casting.OperationResult +import at.petrak.hexcasting.api.casting.ParticleSpray +import at.petrak.hexcasting.api.casting.RenderedSpell import at.petrak.hexcasting.api.casting.eval.CastingContext import at.petrak.hexcasting.api.casting.eval.sideeffects.OperatorSideEffect import at.petrak.hexcasting.api.casting.eval.vm.SpellContinuation diff --git a/Common/src/main/java/at/petrak/hexcasting/api/casting/eval/CastResult.kt b/Common/src/main/java/at/petrak/hexcasting/api/casting/eval/CastResult.kt new file mode 100644 index 00000000..4254f068 --- /dev/null +++ b/Common/src/main/java/at/petrak/hexcasting/api/casting/eval/CastResult.kt @@ -0,0 +1,20 @@ +package at.petrak.hexcasting.api.casting.eval + +import at.petrak.hexcasting.api.casting.eval.sideeffects.EvalSound +import at.petrak.hexcasting.api.casting.eval.sideeffects.OperatorSideEffect +import at.petrak.hexcasting.api.casting.eval.vm.FunctionalData +import at.petrak.hexcasting.api.casting.eval.vm.SpellContinuation + +/** + * The result of doing something to a cast harness. + * + * Contains the next thing to execute after this is finished, the modified state of the stack, + * and side effects, as well as display information for the client. + */ +data class CastResult( + val continuation: SpellContinuation, + val newData: FunctionalData?, + val sideEffects: List, + val resolutionType: ResolvedPatternType, + val sound: EvalSound, +) \ No newline at end of file diff --git a/Common/src/main/java/at/petrak/hexcasting/api/casting/eval/CastingContext.kt b/Common/src/main/java/at/petrak/hexcasting/api/casting/eval/CastingContext.kt index eb01f4c7..19b89cf0 100644 --- a/Common/src/main/java/at/petrak/hexcasting/api/casting/eval/CastingContext.kt +++ b/Common/src/main/java/at/petrak/hexcasting/api/casting/eval/CastingContext.kt @@ -3,7 +3,7 @@ package at.petrak.hexcasting.api.casting.eval import at.petrak.hexcasting.api.HexAPI.modLoc import at.petrak.hexcasting.api.misc.DiscoveryHandlers import at.petrak.hexcasting.api.mod.HexConfig -import at.petrak.hexcasting.api.casting.Action +import at.petrak.hexcasting.api.casting.castables.Action import at.petrak.hexcasting.api.casting.mishaps.MishapEntityTooFarAway import at.petrak.hexcasting.api.casting.mishaps.MishapEvalTooDeep import at.petrak.hexcasting.api.casting.mishaps.MishapLocationTooFarAway 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 324a7f89..38085c20 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,12 +3,11 @@ 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.* import at.petrak.hexcasting.api.casting.SpellList -import at.petrak.hexcasting.api.casting.eval.sideeffects.EvalSound +import at.petrak.hexcasting.api.casting.castables.Action import at.petrak.hexcasting.api.casting.eval.sideeffects.OperatorSideEffect import at.petrak.hexcasting.api.casting.eval.vm.FrameEvaluate import at.petrak.hexcasting.api.casting.eval.vm.FunctionalData @@ -149,14 +148,13 @@ class CastingHarness private constructor( // ALSO TODO need to add reader macro-style things try { this.handleParentheses(iota)?.let { (data, resolutionType) -> - return@getUpdate CastResult(continuation, data, resolutionType, listOf(), HexEvalSounds.OPERATOR) + return@getUpdate CastResult(continuation, data, listOf(), resolutionType, HexEvalSounds.OPERATOR) } } catch (e: MishapTooManyCloseParens) { // This is ridiculous and needs to be fixed return CastResult( continuation, null, - ResolvedPatternType.ERRORED, listOf( OperatorSideEffect.DoMishap( e, @@ -166,6 +164,7 @@ class CastingHarness private constructor( ) ) ), + ResolvedPatternType.ERRORED, HexEvalSounds.MISHAP ) } @@ -176,13 +175,13 @@ class CastingHarness private constructor( return CastResult( continuation, null, - ResolvedPatternType.INVALID, // Should never matter listOf( OperatorSideEffect.DoMishap( MishapUnescapedValue(iota), Mishap.Context(HexPattern(HexDir.WEST), null) ) - ), + ), // Should never matter + ResolvedPatternType.INVALID, HexEvalSounds.MISHAP ) } @@ -192,7 +191,6 @@ class CastingHarness private constructor( return CastResult( continuation, null, - ResolvedPatternType.ERRORED, listOf( OperatorSideEffect.DoMishap( MishapError(exception), @@ -202,6 +200,7 @@ class CastingHarness private constructor( ) ) ), + ResolvedPatternType.ERRORED, HexEvalSounds.MISHAP ) } @@ -313,8 +312,8 @@ class CastingHarness private constructor( return CastResult( cont2, fd, - ResolvedPatternType.EVALUATED, sideEffects, + ResolvedPatternType.EVALUATED, soundType, ) @@ -322,8 +321,8 @@ class CastingHarness private constructor( return CastResult( continuation, null, - mishap.resolutionType(ctx), listOf(OperatorSideEffect.DoMishap(mishap, Mishap.Context(newPat, castedName))), + mishap.resolutionType(ctx), HexEvalSounds.MISHAP ) } @@ -663,12 +662,4 @@ class CastingHarness private constructor( data class TempControllerInfo( var earlyExit: Boolean, ) - - data class CastResult( - val continuation: SpellContinuation, - val newData: FunctionalData?, - val resolutionType: ResolvedPatternType, - val sideEffects: List, - val sound: EvalSound, - ) } diff --git a/Common/src/main/java/at/petrak/hexcasting/api/casting/eval/vm/ContinuationFrame.kt b/Common/src/main/java/at/petrak/hexcasting/api/casting/eval/vm/ContinuationFrame.kt index 870e3071..24235613 100644 --- a/Common/src/main/java/at/petrak/hexcasting/api/casting/eval/vm/ContinuationFrame.kt +++ b/Common/src/main/java/at/petrak/hexcasting/api/casting/eval/vm/ContinuationFrame.kt @@ -2,7 +2,7 @@ package at.petrak.hexcasting.api.casting.eval.vm import at.petrak.hexcasting.api.casting.SpellList import at.petrak.hexcasting.api.casting.eval.CastingHarness -import at.petrak.hexcasting.api.casting.eval.CastingHarness.CastResult +import at.petrak.hexcasting.api.casting.eval.CastResult import at.petrak.hexcasting.api.casting.iota.Iota import at.petrak.hexcasting.api.utils.getList import at.petrak.hexcasting.api.utils.hasList diff --git a/Common/src/main/java/at/petrak/hexcasting/api/casting/eval/vm/FrameEvaluate.kt b/Common/src/main/java/at/petrak/hexcasting/api/casting/eval/vm/FrameEvaluate.kt index daf544e1..bec172a1 100644 --- a/Common/src/main/java/at/petrak/hexcasting/api/casting/eval/vm/FrameEvaluate.kt +++ b/Common/src/main/java/at/petrak/hexcasting/api/casting/eval/vm/FrameEvaluate.kt @@ -1,6 +1,7 @@ package at.petrak.hexcasting.api.casting.eval.vm import at.petrak.hexcasting.api.casting.SpellList +import at.petrak.hexcasting.api.casting.eval.CastResult import at.petrak.hexcasting.api.casting.eval.CastingHarness import at.petrak.hexcasting.api.casting.eval.ResolvedPatternType import at.petrak.hexcasting.api.casting.iota.Iota @@ -23,7 +24,7 @@ data class FrameEvaluate(val list: SpellList, val isMetacasting: Boolean) : Cont continuation: SpellContinuation, level: ServerLevel, harness: CastingHarness - ): CastingHarness.CastResult { + ): CastResult { // If there are patterns left... return if (list.nonEmpty) { val newCont = if (list.cdr.nonEmpty) { // yay TCO @@ -39,7 +40,7 @@ data class FrameEvaluate(val list: SpellList, val isMetacasting: Boolean) : Cont } } else { // If there are no patterns (e.g. empty Hermes), just return OK. - CastingHarness.CastResult(continuation, null, ResolvedPatternType.EVALUATED, listOf(), HexEvalSounds.HERMES) + CastResult(continuation, null, listOf(), ResolvedPatternType.EVALUATED, HexEvalSounds.HERMES) } } diff --git a/Common/src/main/java/at/petrak/hexcasting/api/casting/eval/vm/FrameFinishEval.kt b/Common/src/main/java/at/petrak/hexcasting/api/casting/eval/vm/FrameFinishEval.kt index 964683ee..75c42654 100644 --- a/Common/src/main/java/at/petrak/hexcasting/api/casting/eval/vm/FrameFinishEval.kt +++ b/Common/src/main/java/at/petrak/hexcasting/api/casting/eval/vm/FrameFinishEval.kt @@ -1,5 +1,6 @@ package at.petrak.hexcasting.api.casting.eval.vm +import at.petrak.hexcasting.api.casting.eval.CastResult import at.petrak.hexcasting.api.casting.eval.CastingHarness import at.petrak.hexcasting.api.casting.eval.ResolvedPatternType import at.petrak.hexcasting.api.casting.iota.Iota @@ -20,12 +21,12 @@ object FrameFinishEval : ContinuationFrame { continuation: SpellContinuation, level: ServerLevel, harness: CastingHarness - ): CastingHarness.CastResult { - return CastingHarness.CastResult( + ): CastResult { + return CastResult( continuation, FunctionalData(harness.stack.toList(), 0, listOf(), false, harness.ravenmind), - ResolvedPatternType.EVALUATED, listOf(), + ResolvedPatternType.EVALUATED, HexEvalSounds.NOTHING, ) } diff --git a/Common/src/main/java/at/petrak/hexcasting/api/casting/eval/vm/FrameForEach.kt b/Common/src/main/java/at/petrak/hexcasting/api/casting/eval/vm/FrameForEach.kt index 01f6d998..25dc4bb0 100644 --- a/Common/src/main/java/at/petrak/hexcasting/api/casting/eval/vm/FrameForEach.kt +++ b/Common/src/main/java/at/petrak/hexcasting/api/casting/eval/vm/FrameForEach.kt @@ -1,6 +1,7 @@ package at.petrak.hexcasting.api.casting.eval.vm import at.petrak.hexcasting.api.casting.SpellList +import at.petrak.hexcasting.api.casting.eval.CastResult import at.petrak.hexcasting.api.casting.eval.CastingHarness import at.petrak.hexcasting.api.casting.eval.ResolvedPatternType import at.petrak.hexcasting.api.casting.iota.Iota @@ -39,7 +40,7 @@ data class FrameForEach( continuation: SpellContinuation, level: ServerLevel, harness: CastingHarness - ): CastingHarness.CastResult { + ): CastResult { // If this isn't the very first Thoth step (i.e. no Thoth computations run yet)... val stack = if (baseStack == null) { // init stack to the harness stack... @@ -67,11 +68,11 @@ data class FrameForEach( val tStack = stack.toMutableList() tStack.add(stackTop) // TODO: this means we could have Thoth casting do a different sound - return CastingHarness.CastResult( + return CastResult( newCont, FunctionalData(tStack, 0, listOf(), false, harness.ravenmind), - ResolvedPatternType.EVALUATED, listOf(), + ResolvedPatternType.EVALUATED, HexEvalSounds.THOTH, ) } diff --git a/Common/src/main/java/at/petrak/hexcasting/common/casting/PatternRegistryManifest.java b/Common/src/main/java/at/petrak/hexcasting/common/casting/PatternRegistryManifest.java index 76472e24..bcea001a 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/casting/PatternRegistryManifest.java +++ b/Common/src/main/java/at/petrak/hexcasting/common/casting/PatternRegistryManifest.java @@ -3,7 +3,7 @@ package at.petrak.hexcasting.common.casting; import at.petrak.hexcasting.api.HexAPI; import at.petrak.hexcasting.api.casting.ActionRegistryEntry; import at.petrak.hexcasting.api.casting.PatternShapeMatch; -import at.petrak.hexcasting.api.casting.SpecialHandler; +import at.petrak.hexcasting.api.casting.castables.SpecialHandler; import at.petrak.hexcasting.api.casting.math.EulerPathFinder; import at.petrak.hexcasting.api.casting.math.HexPattern; import at.petrak.hexcasting.api.mod.HexTags; diff --git a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/OpBlockAxisRaycast.kt b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/OpBlockAxisRaycast.kt index 17c6165c..2ee687ad 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/OpBlockAxisRaycast.kt +++ b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/OpBlockAxisRaycast.kt @@ -1,8 +1,8 @@ package at.petrak.hexcasting.common.casting.operators import at.petrak.hexcasting.api.misc.MediaConstants -import at.petrak.hexcasting.api.casting.Action -import at.petrak.hexcasting.api.casting.ConstMediaAction +import at.petrak.hexcasting.api.casting.castables.Action +import at.petrak.hexcasting.api.casting.castables.ConstMediaAction import at.petrak.hexcasting.api.casting.asActionResult import at.petrak.hexcasting.api.casting.eval.CastingContext import at.petrak.hexcasting.api.casting.getVec3 diff --git a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/OpBlockRaycast.kt b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/OpBlockRaycast.kt index cbf2d398..667ff3c7 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/OpBlockRaycast.kt +++ b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/OpBlockRaycast.kt @@ -1,8 +1,8 @@ package at.petrak.hexcasting.common.casting.operators import at.petrak.hexcasting.api.misc.MediaConstants -import at.petrak.hexcasting.api.casting.Action -import at.petrak.hexcasting.api.casting.ConstMediaAction +import at.petrak.hexcasting.api.casting.castables.Action +import at.petrak.hexcasting.api.casting.castables.ConstMediaAction import at.petrak.hexcasting.api.casting.asActionResult import at.petrak.hexcasting.api.casting.eval.CastingContext import at.petrak.hexcasting.api.casting.getVec3 diff --git a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/OpEntityHeight.kt b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/OpEntityHeight.kt index 16de676a..0415470f 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/OpEntityHeight.kt +++ b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/OpEntityHeight.kt @@ -1,6 +1,6 @@ package at.petrak.hexcasting.common.casting.operators -import at.petrak.hexcasting.api.casting.ConstMediaAction +import at.petrak.hexcasting.api.casting.castables.ConstMediaAction import at.petrak.hexcasting.api.casting.asActionResult import at.petrak.hexcasting.api.casting.eval.CastingContext import at.petrak.hexcasting.api.casting.getEntity diff --git a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/OpEntityLook.kt b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/OpEntityLook.kt index 08550871..0633a499 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/OpEntityLook.kt +++ b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/OpEntityLook.kt @@ -1,6 +1,6 @@ package at.petrak.hexcasting.common.casting.operators -import at.petrak.hexcasting.api.casting.ConstMediaAction +import at.petrak.hexcasting.api.casting.castables.ConstMediaAction import at.petrak.hexcasting.api.casting.asActionResult import at.petrak.hexcasting.api.casting.eval.CastingContext import at.petrak.hexcasting.api.casting.getEntity diff --git a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/OpEntityPos.kt b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/OpEntityPos.kt index 91919c94..e6356957 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/OpEntityPos.kt +++ b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/OpEntityPos.kt @@ -1,6 +1,6 @@ package at.petrak.hexcasting.common.casting.operators -import at.petrak.hexcasting.api.casting.ConstMediaAction +import at.petrak.hexcasting.api.casting.castables.ConstMediaAction import at.petrak.hexcasting.api.casting.asActionResult import at.petrak.hexcasting.api.casting.eval.CastingContext import at.petrak.hexcasting.api.casting.getEntity diff --git a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/OpEntityRaycast.kt b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/OpEntityRaycast.kt index 43572a16..90e98c73 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/OpEntityRaycast.kt +++ b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/OpEntityRaycast.kt @@ -1,8 +1,8 @@ package at.petrak.hexcasting.common.casting.operators import at.petrak.hexcasting.api.misc.MediaConstants -import at.petrak.hexcasting.api.casting.Action -import at.petrak.hexcasting.api.casting.ConstMediaAction +import at.petrak.hexcasting.api.casting.castables.Action +import at.petrak.hexcasting.api.casting.castables.ConstMediaAction import at.petrak.hexcasting.api.casting.asActionResult import at.petrak.hexcasting.api.casting.eval.CastingContext import at.petrak.hexcasting.api.casting.getVec3 diff --git a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/OpEntityVelocity.kt b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/OpEntityVelocity.kt index c93c3157..39807d56 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/OpEntityVelocity.kt +++ b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/OpEntityVelocity.kt @@ -1,6 +1,6 @@ package at.petrak.hexcasting.common.casting.operators -import at.petrak.hexcasting.api.casting.ConstMediaAction +import at.petrak.hexcasting.api.casting.castables.ConstMediaAction import at.petrak.hexcasting.api.casting.asActionResult import at.petrak.hexcasting.api.casting.eval.CastingContext import at.petrak.hexcasting.api.casting.getEntity diff --git a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/akashic/OpAkashicRead.kt b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/akashic/OpAkashicRead.kt index 7978d755..0e8a850c 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/akashic/OpAkashicRead.kt +++ b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/akashic/OpAkashicRead.kt @@ -1,7 +1,7 @@ package at.petrak.hexcasting.common.casting.operators.akashic import at.petrak.hexcasting.api.misc.MediaConstants -import at.petrak.hexcasting.api.casting.ConstMediaAction +import at.petrak.hexcasting.api.casting.castables.ConstMediaAction import at.petrak.hexcasting.api.casting.eval.CastingContext import at.petrak.hexcasting.api.casting.getBlockPos import at.petrak.hexcasting.api.casting.getPattern 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 899d3035..02a2da90 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,6 +1,7 @@ package at.petrak.hexcasting.common.casting.operators.akashic import at.petrak.hexcasting.api.casting.* +import at.petrak.hexcasting.api.casting.castables.SpellAction import at.petrak.hexcasting.api.casting.eval.CastingContext import at.petrak.hexcasting.api.casting.iota.Iota import at.petrak.hexcasting.api.casting.math.HexPattern diff --git a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/circles/OpCircleBounds.kt b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/circles/OpCircleBounds.kt index ee270650..86eef2e3 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/circles/OpCircleBounds.kt +++ b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/circles/OpCircleBounds.kt @@ -1,6 +1,6 @@ package at.petrak.hexcasting.common.casting.operators.circles -import at.petrak.hexcasting.api.casting.ConstMediaAction +import at.petrak.hexcasting.api.casting.castables.ConstMediaAction import at.petrak.hexcasting.api.casting.asActionResult import at.petrak.hexcasting.api.casting.eval.CastingContext import at.petrak.hexcasting.api.casting.iota.Iota diff --git a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/circles/OpImpetusDir.kt b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/circles/OpImpetusDir.kt index e5dad30f..30ad718b 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/circles/OpImpetusDir.kt +++ b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/circles/OpImpetusDir.kt @@ -1,7 +1,7 @@ package at.petrak.hexcasting.common.casting.operators.circles import at.petrak.hexcasting.api.block.circle.BlockAbstractImpetus -import at.petrak.hexcasting.api.casting.ConstMediaAction +import at.petrak.hexcasting.api.casting.castables.ConstMediaAction import at.petrak.hexcasting.api.casting.asActionResult import at.petrak.hexcasting.api.casting.eval.CastingContext import at.petrak.hexcasting.api.casting.iota.Iota diff --git a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/circles/OpImpetusPos.kt b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/circles/OpImpetusPos.kt index ee2107f1..dcc68497 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/circles/OpImpetusPos.kt +++ b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/circles/OpImpetusPos.kt @@ -1,6 +1,6 @@ package at.petrak.hexcasting.common.casting.operators.circles -import at.petrak.hexcasting.api.casting.ConstMediaAction +import at.petrak.hexcasting.api.casting.castables.ConstMediaAction import at.petrak.hexcasting.api.casting.asActionResult import at.petrak.hexcasting.api.casting.eval.CastingContext import at.petrak.hexcasting.api.casting.iota.Iota diff --git a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/eval/OpEval.kt b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/eval/OpEval.kt index 542b01b2..a9dee28d 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/eval/OpEval.kt +++ b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/eval/OpEval.kt @@ -1,6 +1,6 @@ package at.petrak.hexcasting.common.casting.operators.eval -import at.petrak.hexcasting.api.casting.Action +import at.petrak.hexcasting.api.casting.castables.Action import at.petrak.hexcasting.api.casting.OperationResult import at.petrak.hexcasting.api.casting.SpellList import at.petrak.hexcasting.api.casting.eval.CastingContext diff --git a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/eval/OpEvalDelay.kt b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/eval/OpEvalDelay.kt index 895531fc..dd2cab70 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/eval/OpEvalDelay.kt +++ b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/eval/OpEvalDelay.kt @@ -1,6 +1,6 @@ package at.petrak.hexcasting.common.casting.operators.eval -import at.petrak.hexcasting.api.casting.Action +import at.petrak.hexcasting.api.casting.castables.Action import at.petrak.hexcasting.api.casting.OperationResult import at.petrak.hexcasting.api.casting.eval.CastingContext import at.petrak.hexcasting.api.casting.eval.vm.SpellContinuation diff --git a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/eval/OpForEach.kt b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/eval/OpForEach.kt index e718ed44..d011651e 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/eval/OpForEach.kt +++ b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/eval/OpForEach.kt @@ -1,6 +1,6 @@ package at.petrak.hexcasting.common.casting.operators.eval -import at.petrak.hexcasting.api.casting.Action +import at.petrak.hexcasting.api.casting.castables.Action import at.petrak.hexcasting.api.casting.OperationResult import at.petrak.hexcasting.api.casting.eval.CastingContext import at.petrak.hexcasting.api.casting.eval.vm.FrameForEach diff --git a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/eval/OpHalt.kt b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/eval/OpHalt.kt index 398523b3..7baf550d 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/eval/OpHalt.kt +++ b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/eval/OpHalt.kt @@ -1,6 +1,6 @@ package at.petrak.hexcasting.common.casting.operators.eval -import at.petrak.hexcasting.api.casting.Action +import at.petrak.hexcasting.api.casting.castables.Action import at.petrak.hexcasting.api.casting.OperationResult import at.petrak.hexcasting.api.casting.eval.CastingContext import at.petrak.hexcasting.api.casting.eval.vm.SpellContinuation diff --git a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/lists/OpAppend.kt b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/lists/OpAppend.kt index 5e15a975..91677a8c 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/lists/OpAppend.kt +++ b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/lists/OpAppend.kt @@ -1,6 +1,6 @@ package at.petrak.hexcasting.common.casting.operators.lists -import at.petrak.hexcasting.api.casting.ConstMediaAction +import at.petrak.hexcasting.api.casting.castables.ConstMediaAction import at.petrak.hexcasting.api.casting.asActionResult import at.petrak.hexcasting.api.casting.eval.CastingContext import at.petrak.hexcasting.api.casting.getList diff --git a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/lists/OpConcat.kt b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/lists/OpConcat.kt index ff5032bb..ff1e3832 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/lists/OpConcat.kt +++ b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/lists/OpConcat.kt @@ -1,6 +1,6 @@ package at.petrak.hexcasting.common.casting.operators.lists -import at.petrak.hexcasting.api.casting.ConstMediaAction +import at.petrak.hexcasting.api.casting.castables.ConstMediaAction import at.petrak.hexcasting.api.casting.asActionResult import at.petrak.hexcasting.api.casting.eval.CastingContext import at.petrak.hexcasting.api.casting.getList diff --git a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/lists/OpCons.kt b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/lists/OpCons.kt index e1266760..92e5cac5 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/lists/OpCons.kt +++ b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/lists/OpCons.kt @@ -1,6 +1,6 @@ package at.petrak.hexcasting.common.casting.operators.lists -import at.petrak.hexcasting.api.casting.ConstMediaAction +import at.petrak.hexcasting.api.casting.castables.ConstMediaAction import at.petrak.hexcasting.api.casting.SpellList import at.petrak.hexcasting.api.casting.asActionResult import at.petrak.hexcasting.api.casting.eval.CastingContext diff --git a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/lists/OpEmptyList.kt b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/lists/OpEmptyList.kt index c688cd59..f1fadd54 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/lists/OpEmptyList.kt +++ b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/lists/OpEmptyList.kt @@ -1,6 +1,6 @@ package at.petrak.hexcasting.common.casting.operators.lists -import at.petrak.hexcasting.api.casting.ConstMediaAction +import at.petrak.hexcasting.api.casting.castables.ConstMediaAction import at.petrak.hexcasting.api.casting.iota.Iota import at.petrak.hexcasting.api.casting.asActionResult import at.petrak.hexcasting.api.casting.eval.CastingContext diff --git a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/lists/OpIndex.kt b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/lists/OpIndex.kt index 0d912bcb..9f01433f 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/lists/OpIndex.kt +++ b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/lists/OpIndex.kt @@ -1,6 +1,6 @@ package at.petrak.hexcasting.common.casting.operators.lists -import at.petrak.hexcasting.api.casting.ConstMediaAction +import at.petrak.hexcasting.api.casting.castables.ConstMediaAction import at.petrak.hexcasting.api.casting.eval.CastingContext import at.petrak.hexcasting.api.casting.getDouble import at.petrak.hexcasting.api.casting.getList diff --git a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/lists/OpIndexOf.kt b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/lists/OpIndexOf.kt index 1f1dd0e1..cb571cae 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/lists/OpIndexOf.kt +++ b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/lists/OpIndexOf.kt @@ -1,6 +1,6 @@ package at.petrak.hexcasting.common.casting.operators.lists -import at.petrak.hexcasting.api.casting.ConstMediaAction +import at.petrak.hexcasting.api.casting.castables.ConstMediaAction import at.petrak.hexcasting.api.casting.asActionResult import at.petrak.hexcasting.api.casting.eval.CastingContext import at.petrak.hexcasting.api.casting.getList diff --git a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/lists/OpLastNToList.kt b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/lists/OpLastNToList.kt index 791ede46..5cbb550e 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/lists/OpLastNToList.kt +++ b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/lists/OpLastNToList.kt @@ -1,6 +1,6 @@ package at.petrak.hexcasting.common.casting.operators.lists -import at.petrak.hexcasting.api.casting.Action +import at.petrak.hexcasting.api.casting.castables.Action import at.petrak.hexcasting.api.casting.OperationResult import at.petrak.hexcasting.api.casting.asActionResult import at.petrak.hexcasting.api.casting.eval.CastingContext diff --git a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/lists/OpListSize.kt b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/lists/OpListSize.kt index 15046f33..e08d3c87 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/lists/OpListSize.kt +++ b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/lists/OpListSize.kt @@ -1,6 +1,6 @@ package at.petrak.hexcasting.common.casting.operators.lists -import at.petrak.hexcasting.api.casting.ConstMediaAction +import at.petrak.hexcasting.api.casting.castables.ConstMediaAction import at.petrak.hexcasting.api.casting.asActionResult import at.petrak.hexcasting.api.casting.eval.CastingContext import at.petrak.hexcasting.api.casting.getList diff --git a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/lists/OpModifyInPlace.kt b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/lists/OpModifyInPlace.kt index ba1a75e3..3abf5c8b 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/lists/OpModifyInPlace.kt +++ b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/lists/OpModifyInPlace.kt @@ -1,6 +1,7 @@ package at.petrak.hexcasting.common.casting.operators.lists import at.petrak.hexcasting.api.casting.* +import at.petrak.hexcasting.api.casting.castables.ConstMediaAction import at.petrak.hexcasting.api.casting.eval.CastingContext import at.petrak.hexcasting.api.casting.iota.Iota diff --git a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/lists/OpRemove.kt b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/lists/OpRemove.kt index 90ee5f9d..5c22b957 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/lists/OpRemove.kt +++ b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/lists/OpRemove.kt @@ -1,6 +1,6 @@ package at.petrak.hexcasting.common.casting.operators.lists -import at.petrak.hexcasting.api.casting.ConstMediaAction +import at.petrak.hexcasting.api.casting.castables.ConstMediaAction import at.petrak.hexcasting.api.casting.asActionResult import at.petrak.hexcasting.api.casting.eval.CastingContext import at.petrak.hexcasting.api.casting.getInt diff --git a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/lists/OpReverski.kt b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/lists/OpReverski.kt index 4133b779..a1f3027c 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/lists/OpReverski.kt +++ b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/lists/OpReverski.kt @@ -1,6 +1,6 @@ package at.petrak.hexcasting.common.casting.operators.lists -import at.petrak.hexcasting.api.casting.ConstMediaAction +import at.petrak.hexcasting.api.casting.castables.ConstMediaAction import at.petrak.hexcasting.api.casting.asActionResult import at.petrak.hexcasting.api.casting.eval.CastingContext import at.petrak.hexcasting.api.casting.getList diff --git a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/lists/OpSingleton.kt b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/lists/OpSingleton.kt index f1c2534c..23196ff7 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/lists/OpSingleton.kt +++ b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/lists/OpSingleton.kt @@ -1,6 +1,6 @@ package at.petrak.hexcasting.common.casting.operators.lists -import at.petrak.hexcasting.api.casting.ConstMediaAction +import at.petrak.hexcasting.api.casting.castables.ConstMediaAction import at.petrak.hexcasting.api.casting.asActionResult import at.petrak.hexcasting.api.casting.eval.CastingContext import at.petrak.hexcasting.api.casting.iota.Iota diff --git a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/lists/OpSlice.kt b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/lists/OpSlice.kt index 1bc2ae0c..d2c8f5e0 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/lists/OpSlice.kt +++ b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/lists/OpSlice.kt @@ -1,6 +1,6 @@ package at.petrak.hexcasting.common.casting.operators.lists -import at.petrak.hexcasting.api.casting.ConstMediaAction +import at.petrak.hexcasting.api.casting.castables.ConstMediaAction import at.petrak.hexcasting.api.casting.asActionResult import at.petrak.hexcasting.api.casting.eval.CastingContext import at.petrak.hexcasting.api.casting.getList diff --git a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/lists/OpSplat.kt b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/lists/OpSplat.kt index 30af1427..c6c33016 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/lists/OpSplat.kt +++ b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/lists/OpSplat.kt @@ -1,6 +1,6 @@ package at.petrak.hexcasting.common.casting.operators.lists -import at.petrak.hexcasting.api.casting.ConstMediaAction +import at.petrak.hexcasting.api.casting.castables.ConstMediaAction import at.petrak.hexcasting.api.casting.eval.CastingContext import at.petrak.hexcasting.api.casting.getList import at.petrak.hexcasting.api.casting.iota.Iota diff --git a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/lists/OpUnCons.kt b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/lists/OpUnCons.kt index bf49d794..aa0ec4f2 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/lists/OpUnCons.kt +++ b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/lists/OpUnCons.kt @@ -1,6 +1,6 @@ package at.petrak.hexcasting.common.casting.operators.lists -import at.petrak.hexcasting.api.casting.ConstMediaAction +import at.petrak.hexcasting.api.casting.castables.ConstMediaAction import at.petrak.hexcasting.api.casting.eval.CastingContext import at.petrak.hexcasting.api.casting.getList import at.petrak.hexcasting.api.casting.iota.Iota diff --git a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/local/OpPeekLocal.kt b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/local/OpPeekLocal.kt index ba24b7a1..856edf0f 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/local/OpPeekLocal.kt +++ b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/local/OpPeekLocal.kt @@ -1,6 +1,6 @@ package at.petrak.hexcasting.common.casting.operators.local -import at.petrak.hexcasting.api.casting.Action +import at.petrak.hexcasting.api.casting.castables.Action import at.petrak.hexcasting.api.casting.OperationResult import at.petrak.hexcasting.api.casting.eval.CastingContext import at.petrak.hexcasting.api.casting.eval.vm.SpellContinuation diff --git a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/local/OpPushLocal.kt b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/local/OpPushLocal.kt index ecbf6006..47036f2d 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/local/OpPushLocal.kt +++ b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/local/OpPushLocal.kt @@ -1,6 +1,6 @@ package at.petrak.hexcasting.common.casting.operators.local -import at.petrak.hexcasting.api.casting.Action +import at.petrak.hexcasting.api.casting.castables.Action import at.petrak.hexcasting.api.casting.OperationResult import at.petrak.hexcasting.api.casting.eval.CastingContext import at.petrak.hexcasting.api.casting.eval.vm.SpellContinuation diff --git a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/math/OpAbsLen.kt b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/math/OpAbsLen.kt index e6ee7ee3..25b3e415 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/math/OpAbsLen.kt +++ b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/math/OpAbsLen.kt @@ -1,6 +1,6 @@ package at.petrak.hexcasting.common.casting.operators.math -import at.petrak.hexcasting.api.casting.ConstMediaAction +import at.petrak.hexcasting.api.casting.castables.ConstMediaAction import at.petrak.hexcasting.api.casting.asActionResult import at.petrak.hexcasting.api.casting.eval.CastingContext import at.petrak.hexcasting.api.casting.getNumOrVec diff --git a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/math/OpAdd.kt b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/math/OpAdd.kt index b7bf87df..61af4526 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/math/OpAdd.kt +++ b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/math/OpAdd.kt @@ -1,6 +1,6 @@ package at.petrak.hexcasting.common.casting.operators.math -import at.petrak.hexcasting.api.casting.ConstMediaAction +import at.petrak.hexcasting.api.casting.castables.ConstMediaAction import at.petrak.hexcasting.api.casting.asActionResult import at.petrak.hexcasting.api.casting.eval.CastingContext import at.petrak.hexcasting.api.casting.getNumOrVec diff --git a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/math/OpCeil.kt b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/math/OpCeil.kt index 85aecb0a..8060e152 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/math/OpCeil.kt +++ b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/math/OpCeil.kt @@ -1,6 +1,6 @@ package at.petrak.hexcasting.common.casting.operators.math -import at.petrak.hexcasting.api.casting.ConstMediaAction +import at.petrak.hexcasting.api.casting.castables.ConstMediaAction import at.petrak.hexcasting.api.casting.aplKinnie import at.petrak.hexcasting.api.casting.eval.CastingContext import at.petrak.hexcasting.api.casting.getNumOrVec diff --git a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/math/OpCoerceToAxial.kt b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/math/OpCoerceToAxial.kt index f795c64f..0d0a2b20 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/math/OpCoerceToAxial.kt +++ b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/math/OpCoerceToAxial.kt @@ -1,6 +1,6 @@ package at.petrak.hexcasting.common.casting.operators.math -import at.petrak.hexcasting.api.casting.ConstMediaAction +import at.petrak.hexcasting.api.casting.castables.ConstMediaAction import at.petrak.hexcasting.api.casting.asActionResult import at.petrak.hexcasting.api.casting.eval.CastingContext import at.petrak.hexcasting.api.casting.getVec3 diff --git a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/math/OpConstructVec.kt b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/math/OpConstructVec.kt index f59fc230..95d6a74d 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/math/OpConstructVec.kt +++ b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/math/OpConstructVec.kt @@ -1,6 +1,6 @@ package at.petrak.hexcasting.common.casting.operators.math -import at.petrak.hexcasting.api.casting.ConstMediaAction +import at.petrak.hexcasting.api.casting.castables.ConstMediaAction import at.petrak.hexcasting.api.casting.asActionResult import at.petrak.hexcasting.api.casting.eval.CastingContext import at.petrak.hexcasting.api.casting.getDouble diff --git a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/math/OpDeconstructVec.kt b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/math/OpDeconstructVec.kt index 319046bd..4e9df8d5 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/math/OpDeconstructVec.kt +++ b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/math/OpDeconstructVec.kt @@ -1,6 +1,6 @@ package at.petrak.hexcasting.common.casting.operators.math -import at.petrak.hexcasting.api.casting.ConstMediaAction +import at.petrak.hexcasting.api.casting.castables.ConstMediaAction import at.petrak.hexcasting.api.casting.eval.CastingContext import at.petrak.hexcasting.api.casting.getVec3 import at.petrak.hexcasting.api.casting.iota.DoubleIota diff --git a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/math/OpDivCross.kt b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/math/OpDivCross.kt index c0dc85e2..5be6bb34 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/math/OpDivCross.kt +++ b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/math/OpDivCross.kt @@ -1,6 +1,6 @@ package at.petrak.hexcasting.common.casting.operators.math -import at.petrak.hexcasting.api.casting.ConstMediaAction +import at.petrak.hexcasting.api.casting.castables.ConstMediaAction import at.petrak.hexcasting.api.casting.asActionResult import at.petrak.hexcasting.api.casting.eval.CastingContext import at.petrak.hexcasting.api.casting.getNumOrVec diff --git a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/math/OpFloor.kt b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/math/OpFloor.kt index 3edb3b22..edbb9490 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/math/OpFloor.kt +++ b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/math/OpFloor.kt @@ -1,6 +1,6 @@ package at.petrak.hexcasting.common.casting.operators.math -import at.petrak.hexcasting.api.casting.ConstMediaAction +import at.petrak.hexcasting.api.casting.castables.ConstMediaAction import at.petrak.hexcasting.api.casting.aplKinnie import at.petrak.hexcasting.api.casting.eval.CastingContext import at.petrak.hexcasting.api.casting.getNumOrVec diff --git a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/math/OpLog.kt b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/math/OpLog.kt index e97ad717..82eedc7d 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/math/OpLog.kt +++ b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/math/OpLog.kt @@ -1,6 +1,6 @@ package at.petrak.hexcasting.common.casting.operators.math -import at.petrak.hexcasting.api.casting.ConstMediaAction +import at.petrak.hexcasting.api.casting.castables.ConstMediaAction import at.petrak.hexcasting.api.casting.asActionResult import at.petrak.hexcasting.api.casting.eval.CastingContext import at.petrak.hexcasting.api.casting.getDouble diff --git a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/math/OpModulo.kt b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/math/OpModulo.kt index 21a3d884..2c443461 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/math/OpModulo.kt +++ b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/math/OpModulo.kt @@ -1,6 +1,6 @@ package at.petrak.hexcasting.common.casting.operators.math -import at.petrak.hexcasting.api.casting.ConstMediaAction +import at.petrak.hexcasting.api.casting.castables.ConstMediaAction import at.petrak.hexcasting.api.casting.asActionResult import at.petrak.hexcasting.api.casting.eval.CastingContext import at.petrak.hexcasting.api.casting.getDouble diff --git a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/math/OpMulDot.kt b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/math/OpMulDot.kt index bcdd3980..82ac93a0 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/math/OpMulDot.kt +++ b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/math/OpMulDot.kt @@ -1,6 +1,6 @@ package at.petrak.hexcasting.common.casting.operators.math -import at.petrak.hexcasting.api.casting.ConstMediaAction +import at.petrak.hexcasting.api.casting.castables.ConstMediaAction import at.petrak.hexcasting.api.casting.asActionResult import at.petrak.hexcasting.api.casting.eval.CastingContext import at.petrak.hexcasting.api.casting.getNumOrVec diff --git a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/math/OpPowProj.kt b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/math/OpPowProj.kt index b35af8a2..99e7d327 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/math/OpPowProj.kt +++ b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/math/OpPowProj.kt @@ -1,6 +1,6 @@ package at.petrak.hexcasting.common.casting.operators.math -import at.petrak.hexcasting.api.casting.ConstMediaAction +import at.petrak.hexcasting.api.casting.castables.ConstMediaAction import at.petrak.hexcasting.api.casting.asActionResult import at.petrak.hexcasting.api.casting.eval.CastingContext import at.petrak.hexcasting.api.casting.getNumOrVec diff --git a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/math/OpRandom.kt b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/math/OpRandom.kt index bba9686b..f9393cb2 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/math/OpRandom.kt +++ b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/math/OpRandom.kt @@ -1,6 +1,6 @@ package at.petrak.hexcasting.common.casting.operators.math -import at.petrak.hexcasting.api.casting.ConstMediaAction +import at.petrak.hexcasting.api.casting.castables.ConstMediaAction import at.petrak.hexcasting.api.casting.asActionResult import at.petrak.hexcasting.api.casting.eval.CastingContext import at.petrak.hexcasting.api.casting.iota.Iota diff --git a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/math/OpSub.kt b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/math/OpSub.kt index 58396552..9a2655c0 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/math/OpSub.kt +++ b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/math/OpSub.kt @@ -1,6 +1,6 @@ package at.petrak.hexcasting.common.casting.operators.math -import at.petrak.hexcasting.api.casting.ConstMediaAction +import at.petrak.hexcasting.api.casting.castables.ConstMediaAction import at.petrak.hexcasting.api.casting.asActionResult import at.petrak.hexcasting.api.casting.eval.CastingContext import at.petrak.hexcasting.api.casting.getNumOrVec diff --git a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/math/SpecialHandlerNumberLiteral.kt b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/math/SpecialHandlerNumberLiteral.kt index 00e456c6..23d21391 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/math/SpecialHandlerNumberLiteral.kt +++ b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/math/SpecialHandlerNumberLiteral.kt @@ -2,10 +2,10 @@ package at.petrak.hexcasting.common.casting.operators.math import at.petrak.hexcasting.api.HexAPI import at.petrak.hexcasting.api.HexAPI.modLoc -import at.petrak.hexcasting.api.casting.Action -import at.petrak.hexcasting.api.casting.ConstMediaAction -import at.petrak.hexcasting.api.casting.SpecialHandler import at.petrak.hexcasting.api.casting.asActionResult +import at.petrak.hexcasting.api.casting.castables.Action +import at.petrak.hexcasting.api.casting.castables.ConstMediaAction +import at.petrak.hexcasting.api.casting.castables.SpecialHandler import at.petrak.hexcasting.api.casting.eval.CastingContext import at.petrak.hexcasting.api.casting.iota.Iota import at.petrak.hexcasting.api.casting.math.HexPattern @@ -14,7 +14,7 @@ import at.petrak.hexcasting.api.utils.lightPurple import net.minecraft.network.chat.Component import net.minecraft.resources.ResourceLocation -class SpecialHandlerNumberLiteral(val x: Double) : SpecialHandler() { +class SpecialHandlerNumberLiteral(val x: Double) : SpecialHandler { override fun act(): Action { return InnerAction(this.x) } diff --git a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/math/bit/OpAnd.kt b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/math/bit/OpAnd.kt index 7a0220bc..48c9e919 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/math/bit/OpAnd.kt +++ b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/math/bit/OpAnd.kt @@ -1,6 +1,7 @@ package at.petrak.hexcasting.common.casting.operators.math.bit import at.petrak.hexcasting.api.casting.* +import at.petrak.hexcasting.api.casting.castables.ConstMediaAction import at.petrak.hexcasting.api.casting.eval.CastingContext import at.petrak.hexcasting.api.casting.iota.Iota diff --git a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/math/bit/OpNot.kt b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/math/bit/OpNot.kt index 1675db68..376c011e 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/math/bit/OpNot.kt +++ b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/math/bit/OpNot.kt @@ -1,6 +1,6 @@ package at.petrak.hexcasting.common.casting.operators.math.bit -import at.petrak.hexcasting.api.casting.ConstMediaAction +import at.petrak.hexcasting.api.casting.castables.ConstMediaAction import at.petrak.hexcasting.api.casting.asActionResult import at.petrak.hexcasting.api.casting.eval.CastingContext import at.petrak.hexcasting.api.casting.getLong diff --git a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/math/bit/OpOr.kt b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/math/bit/OpOr.kt index 02fec808..219287c8 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/math/bit/OpOr.kt +++ b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/math/bit/OpOr.kt @@ -1,6 +1,7 @@ package at.petrak.hexcasting.common.casting.operators.math.bit import at.petrak.hexcasting.api.casting.* +import at.petrak.hexcasting.api.casting.castables.ConstMediaAction import at.petrak.hexcasting.api.casting.eval.CastingContext import at.petrak.hexcasting.api.casting.iota.Iota diff --git a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/math/bit/OpToSet.kt b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/math/bit/OpToSet.kt index 9a502948..db96c907 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/math/bit/OpToSet.kt +++ b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/math/bit/OpToSet.kt @@ -1,6 +1,6 @@ package at.petrak.hexcasting.common.casting.operators.math.bit -import at.petrak.hexcasting.api.casting.ConstMediaAction +import at.petrak.hexcasting.api.casting.castables.ConstMediaAction import at.petrak.hexcasting.api.casting.asActionResult import at.petrak.hexcasting.api.casting.eval.CastingContext import at.petrak.hexcasting.api.casting.getList diff --git a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/math/bit/OpXor.kt b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/math/bit/OpXor.kt index 3df8c9f0..8a6b3769 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/math/bit/OpXor.kt +++ b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/math/bit/OpXor.kt @@ -1,6 +1,7 @@ package at.petrak.hexcasting.common.casting.operators.math.bit import at.petrak.hexcasting.api.casting.* +import at.petrak.hexcasting.api.casting.castables.ConstMediaAction import at.petrak.hexcasting.api.casting.eval.CastingContext import at.petrak.hexcasting.api.casting.iota.Iota diff --git a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/math/logic/OpBoolAnd.kt b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/math/logic/OpBoolAnd.kt index 87946d82..e4121da7 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/math/logic/OpBoolAnd.kt +++ b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/math/logic/OpBoolAnd.kt @@ -1,6 +1,6 @@ package at.petrak.hexcasting.common.casting.operators.math.logic -import at.petrak.hexcasting.api.casting.ConstMediaAction +import at.petrak.hexcasting.api.casting.castables.ConstMediaAction import at.petrak.hexcasting.api.casting.asActionResult import at.petrak.hexcasting.api.casting.eval.CastingContext import at.petrak.hexcasting.api.casting.getBool diff --git a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/math/logic/OpBoolIf.kt b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/math/logic/OpBoolIf.kt index e22c9f1d..9800d0d4 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/math/logic/OpBoolIf.kt +++ b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/math/logic/OpBoolIf.kt @@ -1,6 +1,6 @@ package at.petrak.hexcasting.common.casting.operators.math.logic -import at.petrak.hexcasting.api.casting.ConstMediaAction +import at.petrak.hexcasting.api.casting.castables.ConstMediaAction import at.petrak.hexcasting.api.casting.eval.CastingContext import at.petrak.hexcasting.api.casting.getBool import at.petrak.hexcasting.api.casting.iota.Iota diff --git a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/math/logic/OpBoolNot.kt b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/math/logic/OpBoolNot.kt index 5ef878cc..b57e9c54 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/math/logic/OpBoolNot.kt +++ b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/math/logic/OpBoolNot.kt @@ -1,6 +1,6 @@ package at.petrak.hexcasting.common.casting.operators.math.logic -import at.petrak.hexcasting.api.casting.ConstMediaAction +import at.petrak.hexcasting.api.casting.castables.ConstMediaAction import at.petrak.hexcasting.api.casting.asActionResult import at.petrak.hexcasting.api.casting.eval.CastingContext import at.petrak.hexcasting.api.casting.getBool diff --git a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/math/logic/OpBoolOr.kt b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/math/logic/OpBoolOr.kt index 275667b4..983a441a 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/math/logic/OpBoolOr.kt +++ b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/math/logic/OpBoolOr.kt @@ -1,6 +1,6 @@ package at.petrak.hexcasting.common.casting.operators.math.logic -import at.petrak.hexcasting.api.casting.ConstMediaAction +import at.petrak.hexcasting.api.casting.castables.ConstMediaAction import at.petrak.hexcasting.api.casting.asActionResult import at.petrak.hexcasting.api.casting.eval.CastingContext import at.petrak.hexcasting.api.casting.getBool diff --git a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/math/logic/OpBoolXor.kt b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/math/logic/OpBoolXor.kt index fdd59e29..ab88b82c 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/math/logic/OpBoolXor.kt +++ b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/math/logic/OpBoolXor.kt @@ -1,6 +1,6 @@ package at.petrak.hexcasting.common.casting.operators.math.logic -import at.petrak.hexcasting.api.casting.ConstMediaAction +import at.petrak.hexcasting.api.casting.castables.ConstMediaAction import at.petrak.hexcasting.api.casting.asActionResult import at.petrak.hexcasting.api.casting.eval.CastingContext import at.petrak.hexcasting.api.casting.getBool diff --git a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/math/logic/OpCoerceToBool.kt b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/math/logic/OpCoerceToBool.kt index fe097876..2d49f62b 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/math/logic/OpCoerceToBool.kt +++ b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/math/logic/OpCoerceToBool.kt @@ -1,6 +1,6 @@ package at.petrak.hexcasting.common.casting.operators.math.logic -import at.petrak.hexcasting.api.casting.ConstMediaAction +import at.petrak.hexcasting.api.casting.castables.ConstMediaAction import at.petrak.hexcasting.api.casting.asActionResult import at.petrak.hexcasting.api.casting.eval.CastingContext import at.petrak.hexcasting.api.casting.iota.Iota diff --git a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/math/logic/OpCompare.kt b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/math/logic/OpCompare.kt index a39e004a..0f7a824a 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/math/logic/OpCompare.kt +++ b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/math/logic/OpCompare.kt @@ -1,6 +1,6 @@ package at.petrak.hexcasting.common.casting.operators.math.logic -import at.petrak.hexcasting.api.casting.ConstMediaAction +import at.petrak.hexcasting.api.casting.castables.ConstMediaAction import at.petrak.hexcasting.api.casting.asActionResult import at.petrak.hexcasting.api.casting.eval.CastingContext import at.petrak.hexcasting.api.casting.getDouble diff --git a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/math/logic/OpEquality.kt b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/math/logic/OpEquality.kt index ab710224..c7022281 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/math/logic/OpEquality.kt +++ b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/math/logic/OpEquality.kt @@ -1,6 +1,6 @@ package at.petrak.hexcasting.common.casting.operators.math.logic -import at.petrak.hexcasting.api.casting.ConstMediaAction +import at.petrak.hexcasting.api.casting.castables.ConstMediaAction import at.petrak.hexcasting.api.casting.asActionResult import at.petrak.hexcasting.api.casting.eval.CastingContext import at.petrak.hexcasting.api.casting.iota.Iota diff --git a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/math/trig/OpArcCos.kt b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/math/trig/OpArcCos.kt index 42bb19ee..e6c53b0b 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/math/trig/OpArcCos.kt +++ b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/math/trig/OpArcCos.kt @@ -1,6 +1,6 @@ package at.petrak.hexcasting.common.casting.operators.math.trig -import at.petrak.hexcasting.api.casting.ConstMediaAction +import at.petrak.hexcasting.api.casting.castables.ConstMediaAction import at.petrak.hexcasting.api.casting.asActionResult import at.petrak.hexcasting.api.casting.eval.CastingContext import at.petrak.hexcasting.api.casting.getDoubleBetween diff --git a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/math/trig/OpArcSin.kt b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/math/trig/OpArcSin.kt index be2047be..6623c4b6 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/math/trig/OpArcSin.kt +++ b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/math/trig/OpArcSin.kt @@ -1,6 +1,6 @@ package at.petrak.hexcasting.common.casting.operators.math.trig -import at.petrak.hexcasting.api.casting.ConstMediaAction +import at.petrak.hexcasting.api.casting.castables.ConstMediaAction import at.petrak.hexcasting.api.casting.asActionResult import at.petrak.hexcasting.api.casting.eval.CastingContext import at.petrak.hexcasting.api.casting.getDoubleBetween diff --git a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/math/trig/OpArcTan.kt b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/math/trig/OpArcTan.kt index 99c7d099..96d71dfe 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/math/trig/OpArcTan.kt +++ b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/math/trig/OpArcTan.kt @@ -1,6 +1,6 @@ package at.petrak.hexcasting.common.casting.operators.math.trig -import at.petrak.hexcasting.api.casting.ConstMediaAction +import at.petrak.hexcasting.api.casting.castables.ConstMediaAction import at.petrak.hexcasting.api.casting.asActionResult import at.petrak.hexcasting.api.casting.eval.CastingContext import at.petrak.hexcasting.api.casting.getDouble diff --git a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/math/trig/OpArcTan2.kt b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/math/trig/OpArcTan2.kt index be950a52..c020bab2 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/math/trig/OpArcTan2.kt +++ b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/math/trig/OpArcTan2.kt @@ -1,6 +1,6 @@ package at.petrak.hexcasting.common.casting.operators.math.trig -import at.petrak.hexcasting.api.casting.ConstMediaAction +import at.petrak.hexcasting.api.casting.castables.ConstMediaAction import at.petrak.hexcasting.api.casting.asActionResult import at.petrak.hexcasting.api.casting.eval.CastingContext import at.petrak.hexcasting.api.casting.getDouble diff --git a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/math/trig/OpCos.kt b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/math/trig/OpCos.kt index 30991b65..93b7a525 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/math/trig/OpCos.kt +++ b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/math/trig/OpCos.kt @@ -1,6 +1,6 @@ package at.petrak.hexcasting.common.casting.operators.math.trig -import at.petrak.hexcasting.api.casting.ConstMediaAction +import at.petrak.hexcasting.api.casting.castables.ConstMediaAction import at.petrak.hexcasting.api.casting.asActionResult import at.petrak.hexcasting.api.casting.eval.CastingContext import at.petrak.hexcasting.api.casting.getDouble diff --git a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/math/trig/OpSin.kt b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/math/trig/OpSin.kt index 14885311..7dd60772 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/math/trig/OpSin.kt +++ b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/math/trig/OpSin.kt @@ -1,6 +1,6 @@ package at.petrak.hexcasting.common.casting.operators.math.trig -import at.petrak.hexcasting.api.casting.ConstMediaAction +import at.petrak.hexcasting.api.casting.castables.ConstMediaAction import at.petrak.hexcasting.api.casting.asActionResult import at.petrak.hexcasting.api.casting.eval.CastingContext import at.petrak.hexcasting.api.casting.getDouble diff --git a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/math/trig/OpTan.kt b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/math/trig/OpTan.kt index 93516e0b..37e701c0 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/math/trig/OpTan.kt +++ b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/math/trig/OpTan.kt @@ -1,6 +1,6 @@ package at.petrak.hexcasting.common.casting.operators.math.trig -import at.petrak.hexcasting.api.casting.ConstMediaAction +import at.petrak.hexcasting.api.casting.castables.ConstMediaAction import at.petrak.hexcasting.api.casting.asActionResult import at.petrak.hexcasting.api.casting.eval.CastingContext import at.petrak.hexcasting.api.casting.getDouble diff --git a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/rw/OpRead.kt b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/rw/OpRead.kt index 6a9a2728..d44199e6 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/rw/OpRead.kt +++ b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/rw/OpRead.kt @@ -1,6 +1,6 @@ package at.petrak.hexcasting.common.casting.operators.rw -import at.petrak.hexcasting.api.casting.ConstMediaAction +import at.petrak.hexcasting.api.casting.castables.ConstMediaAction import at.petrak.hexcasting.api.casting.eval.CastingContext import at.petrak.hexcasting.api.casting.iota.Iota import at.petrak.hexcasting.api.casting.mishaps.MishapBadOffhandItem diff --git a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/rw/OpReadable.kt b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/rw/OpReadable.kt index 03445006..7df38a70 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/rw/OpReadable.kt +++ b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/rw/OpReadable.kt @@ -1,6 +1,6 @@ package at.petrak.hexcasting.common.casting.operators.rw -import at.petrak.hexcasting.api.casting.ConstMediaAction +import at.petrak.hexcasting.api.casting.castables.ConstMediaAction import at.petrak.hexcasting.api.casting.asActionResult import at.petrak.hexcasting.api.casting.eval.CastingContext import at.petrak.hexcasting.api.casting.iota.Iota diff --git a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/rw/OpTheCoolerRead.kt b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/rw/OpTheCoolerRead.kt index 9b302e1e..1d1970af 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/rw/OpTheCoolerRead.kt +++ b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/rw/OpTheCoolerRead.kt @@ -1,6 +1,6 @@ package at.petrak.hexcasting.common.casting.operators.rw -import at.petrak.hexcasting.api.casting.ConstMediaAction +import at.petrak.hexcasting.api.casting.castables.ConstMediaAction import at.petrak.hexcasting.api.casting.eval.CastingContext import at.petrak.hexcasting.api.casting.getEntity import at.petrak.hexcasting.api.casting.iota.Iota diff --git a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/rw/OpTheCoolerReadable.kt b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/rw/OpTheCoolerReadable.kt index 2469cf53..d07be27b 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/rw/OpTheCoolerReadable.kt +++ b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/rw/OpTheCoolerReadable.kt @@ -1,6 +1,6 @@ package at.petrak.hexcasting.common.casting.operators.rw -import at.petrak.hexcasting.api.casting.ConstMediaAction +import at.petrak.hexcasting.api.casting.castables.ConstMediaAction import at.petrak.hexcasting.api.casting.asActionResult import at.petrak.hexcasting.api.casting.eval.CastingContext import at.petrak.hexcasting.api.casting.getEntity diff --git a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/rw/OpTheCoolerWritable.kt b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/rw/OpTheCoolerWritable.kt index 6318935f..b500c9ae 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/rw/OpTheCoolerWritable.kt +++ b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/rw/OpTheCoolerWritable.kt @@ -1,6 +1,6 @@ package at.petrak.hexcasting.common.casting.operators.rw -import at.petrak.hexcasting.api.casting.ConstMediaAction +import at.petrak.hexcasting.api.casting.castables.ConstMediaAction import at.petrak.hexcasting.api.casting.asActionResult import at.petrak.hexcasting.api.casting.eval.CastingContext import at.petrak.hexcasting.api.casting.getEntity diff --git a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/rw/OpTheCoolerWrite.kt b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/rw/OpTheCoolerWrite.kt index 8d9c5d5a..39c33569 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/rw/OpTheCoolerWrite.kt +++ b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/rw/OpTheCoolerWrite.kt @@ -3,7 +3,7 @@ package at.petrak.hexcasting.common.casting.operators.rw import at.petrak.hexcasting.api.addldata.ADIotaHolder 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.castables.SpellAction import at.petrak.hexcasting.api.casting.eval.CastingContext import at.petrak.hexcasting.api.casting.getEntity import at.petrak.hexcasting.api.casting.iota.Iota diff --git a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/rw/OpWritable.kt b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/rw/OpWritable.kt index f1bb59d2..725ee83e 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/rw/OpWritable.kt +++ b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/rw/OpWritable.kt @@ -1,6 +1,6 @@ package at.petrak.hexcasting.common.casting.operators.rw -import at.petrak.hexcasting.api.casting.ConstMediaAction +import at.petrak.hexcasting.api.casting.castables.ConstMediaAction import at.petrak.hexcasting.api.casting.asActionResult import at.petrak.hexcasting.api.casting.eval.CastingContext import at.petrak.hexcasting.api.casting.iota.Iota diff --git a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/rw/OpWrite.kt b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/rw/OpWrite.kt index c0f22cf7..d89ecd77 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/rw/OpWrite.kt +++ b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/rw/OpWrite.kt @@ -3,7 +3,7 @@ package at.petrak.hexcasting.common.casting.operators.rw import at.petrak.hexcasting.api.addldata.ADIotaHolder 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.castables.SpellAction import at.petrak.hexcasting.api.casting.eval.CastingContext import at.petrak.hexcasting.api.casting.iota.Iota import at.petrak.hexcasting.api.casting.mishaps.MishapBadOffhandItem diff --git a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/selectors/OpGetCaster.kt b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/selectors/OpGetCaster.kt index 354bd2cc..66bf999e 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/selectors/OpGetCaster.kt +++ b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/selectors/OpGetCaster.kt @@ -1,6 +1,6 @@ package at.petrak.hexcasting.common.casting.operators.selectors -import at.petrak.hexcasting.api.casting.ConstMediaAction +import at.petrak.hexcasting.api.casting.castables.ConstMediaAction import at.petrak.hexcasting.api.casting.asActionResult import at.petrak.hexcasting.api.casting.eval.CastingContext import at.petrak.hexcasting.api.casting.iota.Iota diff --git a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/selectors/OpGetEntitiesBy.kt b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/selectors/OpGetEntitiesBy.kt index b3438d83..a9ed4449 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/selectors/OpGetEntitiesBy.kt +++ b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/selectors/OpGetEntitiesBy.kt @@ -1,6 +1,6 @@ package at.petrak.hexcasting.common.casting.operators.selectors -import at.petrak.hexcasting.api.casting.ConstMediaAction +import at.petrak.hexcasting.api.casting.castables.ConstMediaAction import at.petrak.hexcasting.api.casting.asActionResult import at.petrak.hexcasting.api.casting.eval.CastingContext import at.petrak.hexcasting.api.casting.getPositiveDouble diff --git a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/selectors/OpGetEntityAt.kt b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/selectors/OpGetEntityAt.kt index e0a335a7..c7da7d1b 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/selectors/OpGetEntityAt.kt +++ b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/selectors/OpGetEntityAt.kt @@ -1,6 +1,6 @@ package at.petrak.hexcasting.common.casting.operators.selectors -import at.petrak.hexcasting.api.casting.ConstMediaAction +import at.petrak.hexcasting.api.casting.castables.ConstMediaAction import at.petrak.hexcasting.api.casting.asActionResult import at.petrak.hexcasting.api.casting.eval.CastingContext import at.petrak.hexcasting.api.casting.getVec3 diff --git a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/spells/OpAddMotion.kt b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/spells/OpAddMotion.kt index 4a6d72fd..815cb733 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/spells/OpAddMotion.kt +++ b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/spells/OpAddMotion.kt @@ -2,6 +2,7 @@ package at.petrak.hexcasting.common.casting.operators.spells import at.petrak.hexcasting.api.misc.MediaConstants import at.petrak.hexcasting.api.casting.* +import at.petrak.hexcasting.api.casting.castables.SpellAction import at.petrak.hexcasting.api.casting.eval.CastingContext import at.petrak.hexcasting.api.casting.iota.Iota import net.minecraft.world.entity.Entity diff --git a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/spells/OpBeep.kt b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/spells/OpBeep.kt index c7119516..6febc378 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/spells/OpBeep.kt +++ b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/spells/OpBeep.kt @@ -2,6 +2,7 @@ package at.petrak.hexcasting.common.casting.operators.spells import at.petrak.hexcasting.api.misc.MediaConstants import at.petrak.hexcasting.api.casting.* +import at.petrak.hexcasting.api.casting.castables.SpellAction import at.petrak.hexcasting.api.casting.eval.CastingContext import at.petrak.hexcasting.api.casting.iota.Iota import at.petrak.hexcasting.common.network.MsgBeepAck diff --git a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/spells/OpBlink.kt b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/spells/OpBlink.kt index f938a0c6..0b15eac4 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/spells/OpBlink.kt +++ b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/spells/OpBlink.kt @@ -4,6 +4,7 @@ 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.castables.SpellAction import at.petrak.hexcasting.api.casting.eval.CastingContext import at.petrak.hexcasting.api.casting.iota.Iota import at.petrak.hexcasting.api.casting.mishaps.MishapImmuneEntity diff --git a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/spells/OpBreakBlock.kt b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/spells/OpBreakBlock.kt index d55d9436..dc779eb8 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/spells/OpBreakBlock.kt +++ b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/spells/OpBreakBlock.kt @@ -4,7 +4,7 @@ import at.petrak.hexcasting.api.misc.MediaConstants import at.petrak.hexcasting.api.mod.HexConfig 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.castables.SpellAction import at.petrak.hexcasting.api.casting.eval.CastingContext import at.petrak.hexcasting.api.casting.getBlockPos import at.petrak.hexcasting.api.casting.iota.Iota diff --git a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/spells/OpColorize.kt b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/spells/OpColorize.kt index 3a558160..9fe56d63 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/spells/OpColorize.kt +++ b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/spells/OpColorize.kt @@ -5,7 +5,7 @@ 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.castables.SpellAction import at.petrak.hexcasting.api.casting.eval.CastingContext import at.petrak.hexcasting.api.casting.mishaps.MishapBadOffhandItem import at.petrak.hexcasting.xplat.IXplatAbstractions diff --git a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/spells/OpConjureBlock.kt b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/spells/OpConjureBlock.kt index 29f623dc..da3b9b43 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/spells/OpConjureBlock.kt +++ b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/spells/OpConjureBlock.kt @@ -3,7 +3,7 @@ package at.petrak.hexcasting.common.casting.operators.spells 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.castables.SpellAction import at.petrak.hexcasting.api.casting.eval.CastingContext import at.petrak.hexcasting.api.casting.getBlockPos import at.petrak.hexcasting.api.casting.iota.Iota 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 6281c7d3..2b40763b 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 @@ -2,7 +2,7 @@ package at.petrak.hexcasting.common.casting.operators.spells 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.castables.SpellAction import at.petrak.hexcasting.api.casting.eval.CastingContext import at.petrak.hexcasting.api.casting.getBlockPos import at.petrak.hexcasting.api.casting.iota.Iota diff --git a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/spells/OpDestroyFluid.kt b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/spells/OpDestroyFluid.kt index 25998415..6bcf9828 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/spells/OpDestroyFluid.kt +++ b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/spells/OpDestroyFluid.kt @@ -3,7 +3,7 @@ package at.petrak.hexcasting.common.casting.operators.spells 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.castables.SpellAction import at.petrak.hexcasting.api.casting.eval.CastingContext import at.petrak.hexcasting.api.casting.getBlockPos import at.petrak.hexcasting.api.casting.iota.Iota diff --git a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/spells/OpEdifySapling.kt b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/spells/OpEdifySapling.kt index a9287457..4794d306 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/spells/OpEdifySapling.kt +++ b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/spells/OpEdifySapling.kt @@ -3,7 +3,7 @@ package at.petrak.hexcasting.common.casting.operators.spells 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.castables.SpellAction import at.petrak.hexcasting.api.casting.eval.CastingContext import at.petrak.hexcasting.api.casting.getBlockPos import at.petrak.hexcasting.api.casting.iota.Iota diff --git a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/spells/OpErase.kt b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/spells/OpErase.kt index c02f9241..dd5f435d 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/spells/OpErase.kt +++ b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/spells/OpErase.kt @@ -3,7 +3,7 @@ package at.petrak.hexcasting.common.casting.operators.spells 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.castables.SpellAction import at.petrak.hexcasting.api.casting.eval.CastingContext import at.petrak.hexcasting.api.casting.iota.Iota import at.petrak.hexcasting.api.casting.mishaps.MishapBadOffhandItem diff --git a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/spells/OpExplode.kt b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/spells/OpExplode.kt index f8067d47..110c0ad5 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/spells/OpExplode.kt +++ b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/spells/OpExplode.kt @@ -2,6 +2,7 @@ package at.petrak.hexcasting.common.casting.operators.spells import at.petrak.hexcasting.api.misc.MediaConstants import at.petrak.hexcasting.api.casting.* +import at.petrak.hexcasting.api.casting.castables.SpellAction import at.petrak.hexcasting.api.casting.eval.CastingContext import at.petrak.hexcasting.api.casting.iota.Iota import net.minecraft.core.BlockPos diff --git a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/spells/OpExtinguish.kt b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/spells/OpExtinguish.kt index 91d4a615..4730839a 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/spells/OpExtinguish.kt +++ b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/spells/OpExtinguish.kt @@ -3,7 +3,7 @@ package at.petrak.hexcasting.common.casting.operators.spells 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.castables.SpellAction import at.petrak.hexcasting.api.casting.eval.CastingContext import at.petrak.hexcasting.api.casting.getBlockPos import at.petrak.hexcasting.api.casting.iota.Iota diff --git a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/spells/OpIgnite.kt b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/spells/OpIgnite.kt index 89e56e7c..676a4957 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/spells/OpIgnite.kt +++ b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/spells/OpIgnite.kt @@ -3,7 +3,7 @@ package at.petrak.hexcasting.common.casting.operators.spells 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.castables.SpellAction import at.petrak.hexcasting.api.casting.eval.CastingContext import at.petrak.hexcasting.api.casting.getBlockPos import at.petrak.hexcasting.api.casting.iota.Iota 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 ce8a668d..d98eca51 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 @@ -2,7 +2,7 @@ package at.petrak.hexcasting.common.casting.operators.spells 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.castables.SpellAction import at.petrak.hexcasting.api.casting.eval.CastingContext import at.petrak.hexcasting.api.casting.getItemEntity import at.petrak.hexcasting.api.casting.iota.Iota diff --git a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/spells/OpMakePackagedSpell.kt b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/spells/OpMakePackagedSpell.kt index 8b39069a..0357da09 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/spells/OpMakePackagedSpell.kt +++ b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/spells/OpMakePackagedSpell.kt @@ -1,6 +1,7 @@ package at.petrak.hexcasting.common.casting.operators.spells import at.petrak.hexcasting.api.casting.* +import at.petrak.hexcasting.api.casting.castables.SpellAction import at.petrak.hexcasting.api.casting.eval.CastingContext import at.petrak.hexcasting.api.casting.iota.Iota import at.petrak.hexcasting.api.casting.mishaps.MishapBadItem diff --git a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/spells/OpPlaceBlock.kt b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/spells/OpPlaceBlock.kt index e887bad1..b2878588 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/spells/OpPlaceBlock.kt +++ b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/spells/OpPlaceBlock.kt @@ -3,7 +3,7 @@ package at.petrak.hexcasting.common.casting.operators.spells 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.castables.SpellAction import at.petrak.hexcasting.api.casting.eval.CastingContext import at.petrak.hexcasting.api.casting.getBlockPos import at.petrak.hexcasting.api.casting.iota.Iota 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 254b677a..e6787d90 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 @@ -1,6 +1,7 @@ package at.petrak.hexcasting.common.casting.operators.spells import at.petrak.hexcasting.api.casting.* +import at.petrak.hexcasting.api.casting.castables.SpellAction import at.petrak.hexcasting.api.casting.eval.CastingContext import at.petrak.hexcasting.api.casting.iota.Iota import net.minecraft.world.effect.MobEffect diff --git a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/spells/OpPrint.kt b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/spells/OpPrint.kt index a1641041..b95723b0 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/spells/OpPrint.kt +++ b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/spells/OpPrint.kt @@ -1,6 +1,6 @@ package at.petrak.hexcasting.common.casting.operators.spells -import at.petrak.hexcasting.api.casting.Action +import at.petrak.hexcasting.api.casting.castables.Action import at.petrak.hexcasting.api.casting.OperationResult import at.petrak.hexcasting.api.casting.RenderedSpell import at.petrak.hexcasting.api.casting.eval.CastingContext diff --git a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/spells/OpRecharge.kt b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/spells/OpRecharge.kt index 6ef3bf63..3aa87e2a 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/spells/OpRecharge.kt +++ b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/spells/OpRecharge.kt @@ -3,7 +3,7 @@ package at.petrak.hexcasting.common.casting.operators.spells 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.castables.SpellAction import at.petrak.hexcasting.api.casting.eval.CastingContext import at.petrak.hexcasting.api.casting.getItemEntity import at.petrak.hexcasting.api.casting.iota.Iota diff --git a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/spells/OpTheOnlyReasonAnyoneDownloadedPsi.kt b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/spells/OpTheOnlyReasonAnyoneDownloadedPsi.kt index 835f9507..693fe1f5 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/spells/OpTheOnlyReasonAnyoneDownloadedPsi.kt +++ b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/spells/OpTheOnlyReasonAnyoneDownloadedPsi.kt @@ -3,7 +3,7 @@ package at.petrak.hexcasting.common.casting.operators.spells 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.castables.SpellAction import at.petrak.hexcasting.api.casting.eval.CastingContext import at.petrak.hexcasting.api.casting.getBlockPos import at.petrak.hexcasting.api.casting.iota.Iota 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 bbef2007..87a1f70f 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,6 +1,7 @@ package at.petrak.hexcasting.common.casting.operators.spells.great import at.petrak.hexcasting.api.casting.* +import at.petrak.hexcasting.api.casting.castables.SpellAction import at.petrak.hexcasting.api.casting.eval.CastingContext import at.petrak.hexcasting.api.casting.iota.Iota import at.petrak.hexcasting.api.casting.mishaps.MishapAlreadyBrainswept 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 62523ef9..a3d260b1 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,6 +1,7 @@ package at.petrak.hexcasting.common.casting.operators.spells.great import at.petrak.hexcasting.api.casting.* +import at.petrak.hexcasting.api.casting.castables.SpellAction import at.petrak.hexcasting.api.casting.eval.CastingContext import at.petrak.hexcasting.api.casting.iota.Iota import at.petrak.hexcasting.api.misc.MediaConstants 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 9972cdc6..ee4cb8ed 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 @@ -2,7 +2,7 @@ package at.petrak.hexcasting.common.casting.operators.spells.great 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.castables.SpellAction import at.petrak.hexcasting.api.casting.eval.CastingContext import at.petrak.hexcasting.api.casting.getVec3 import at.petrak.hexcasting.api.casting.iota.Iota 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 7b613754..348ced29 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,6 +1,7 @@ package at.petrak.hexcasting.common.casting.operators.spells.great import at.petrak.hexcasting.api.casting.* +import at.petrak.hexcasting.api.casting.castables.SpellAction import at.petrak.hexcasting.api.casting.eval.CastingContext import at.petrak.hexcasting.api.casting.iota.Iota import at.petrak.hexcasting.api.casting.mishaps.MishapImmuneEntity 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 6ad3c9eb..2e6979ff 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 @@ -2,7 +2,7 @@ package at.petrak.hexcasting.common.casting.operators.spells.great 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.castables.SpellAction import at.petrak.hexcasting.api.casting.eval.CastingContext import at.petrak.hexcasting.api.casting.iota.Iota import at.petrak.hexcasting.api.misc.MediaConstants 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 325c0e88..2cb26eee 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 @@ -2,7 +2,7 @@ package at.petrak.hexcasting.common.casting.operators.spells.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.castables.SpellAction import at.petrak.hexcasting.api.casting.eval.CastingContext import at.petrak.hexcasting.api.casting.getVec3 import at.petrak.hexcasting.api.casting.iota.Iota diff --git a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/spells/sentinel/OpDestroySentinel.kt b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/spells/sentinel/OpDestroySentinel.kt index 16a73361..7d55496c 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/spells/sentinel/OpDestroySentinel.kt +++ b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/spells/sentinel/OpDestroySentinel.kt @@ -6,7 +6,7 @@ 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.iota.Iota -import at.petrak.hexcasting.api.casting.SpellAction +import at.petrak.hexcasting.api.casting.castables.SpellAction import at.petrak.hexcasting.api.casting.eval.CastingContext import at.petrak.hexcasting.api.casting.mishaps.MishapLocationInWrongDimension import at.petrak.hexcasting.xplat.IXplatAbstractions diff --git a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/spells/sentinel/OpGetSentinelPos.kt b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/spells/sentinel/OpGetSentinelPos.kt index 6a32e48f..7179d318 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/spells/sentinel/OpGetSentinelPos.kt +++ b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/spells/sentinel/OpGetSentinelPos.kt @@ -1,7 +1,7 @@ package at.petrak.hexcasting.common.casting.operators.spells.sentinel import at.petrak.hexcasting.api.misc.MediaConstants -import at.petrak.hexcasting.api.casting.ConstMediaAction +import at.petrak.hexcasting.api.casting.castables.ConstMediaAction import at.petrak.hexcasting.api.casting.asActionResult import at.petrak.hexcasting.api.casting.eval.CastingContext import at.petrak.hexcasting.api.casting.iota.Iota diff --git a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/spells/sentinel/OpGetSentinelWayfind.kt b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/spells/sentinel/OpGetSentinelWayfind.kt index 959b223f..89169ef5 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/spells/sentinel/OpGetSentinelWayfind.kt +++ b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/spells/sentinel/OpGetSentinelWayfind.kt @@ -1,7 +1,7 @@ package at.petrak.hexcasting.common.casting.operators.spells.sentinel import at.petrak.hexcasting.api.misc.MediaConstants -import at.petrak.hexcasting.api.casting.ConstMediaAction +import at.petrak.hexcasting.api.casting.castables.ConstMediaAction import at.petrak.hexcasting.api.casting.asActionResult import at.petrak.hexcasting.api.casting.eval.CastingContext import at.petrak.hexcasting.api.casting.getVec3 diff --git a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/stack/OpAlwinfyHasAscendedToABeingOfPureMath.kt b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/stack/OpAlwinfyHasAscendedToABeingOfPureMath.kt index 1bbb868a..af1582fc 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/stack/OpAlwinfyHasAscendedToABeingOfPureMath.kt +++ b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/stack/OpAlwinfyHasAscendedToABeingOfPureMath.kt @@ -1,6 +1,6 @@ package at.petrak.hexcasting.common.casting.operators.stack -import at.petrak.hexcasting.api.casting.Action +import at.petrak.hexcasting.api.casting.castables.Action import at.petrak.hexcasting.api.casting.OperationResult import at.petrak.hexcasting.api.casting.eval.CastingContext import at.petrak.hexcasting.api.casting.eval.vm.SpellContinuation diff --git a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/stack/OpBitMask.kt b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/stack/OpBitMask.kt index 8dc36510..a724b694 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/stack/OpBitMask.kt +++ b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/stack/OpBitMask.kt @@ -1,6 +1,6 @@ package at.petrak.hexcasting.common.casting.operators.stack -import at.petrak.hexcasting.api.casting.Action +import at.petrak.hexcasting.api.casting.castables.Action import at.petrak.hexcasting.api.casting.OperationResult import at.petrak.hexcasting.api.casting.eval.CastingContext import at.petrak.hexcasting.api.casting.eval.vm.SpellContinuation diff --git a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/stack/OpDuplicateN.kt b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/stack/OpDuplicateN.kt index 92e77934..751b0678 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/stack/OpDuplicateN.kt +++ b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/stack/OpDuplicateN.kt @@ -1,6 +1,6 @@ package at.petrak.hexcasting.common.casting.operators.stack -import at.petrak.hexcasting.api.casting.ConstMediaAction +import at.petrak.hexcasting.api.casting.castables.ConstMediaAction import at.petrak.hexcasting.api.casting.eval.CastingContext import at.petrak.hexcasting.api.casting.getPositiveInt import at.petrak.hexcasting.api.casting.iota.Iota diff --git a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/stack/OpFisherman.kt b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/stack/OpFisherman.kt index 650ed54a..ab3384f6 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/stack/OpFisherman.kt +++ b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/stack/OpFisherman.kt @@ -1,6 +1,6 @@ package at.petrak.hexcasting.common.casting.operators.stack -import at.petrak.hexcasting.api.casting.Action +import at.petrak.hexcasting.api.casting.castables.Action import at.petrak.hexcasting.api.casting.OperationResult import at.petrak.hexcasting.api.casting.eval.CastingContext import at.petrak.hexcasting.api.casting.eval.vm.SpellContinuation diff --git a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/stack/OpFishermanButItCopies.kt b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/stack/OpFishermanButItCopies.kt index 70066b2d..d3ed3464 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/stack/OpFishermanButItCopies.kt +++ b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/stack/OpFishermanButItCopies.kt @@ -1,6 +1,6 @@ package at.petrak.hexcasting.common.casting.operators.stack -import at.petrak.hexcasting.api.casting.Action +import at.petrak.hexcasting.api.casting.castables.Action import at.petrak.hexcasting.api.casting.OperationResult import at.petrak.hexcasting.api.casting.eval.CastingContext import at.petrak.hexcasting.api.casting.eval.vm.SpellContinuation diff --git a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/stack/OpMask.kt b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/stack/OpMask.kt index 2cf5289c..d4452e27 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/stack/OpMask.kt +++ b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/stack/OpMask.kt @@ -1,6 +1,6 @@ package at.petrak.hexcasting.common.casting.operators.stack -import at.petrak.hexcasting.api.casting.ConstMediaAction +import at.petrak.hexcasting.api.casting.castables.ConstMediaAction import at.petrak.hexcasting.api.casting.eval.CastingContext import at.petrak.hexcasting.api.casting.iota.Iota import it.unimi.dsi.fastutil.booleans.BooleanList diff --git a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/stack/OpStackSize.kt b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/stack/OpStackSize.kt index 75c8a687..b67f5d1c 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/stack/OpStackSize.kt +++ b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/stack/OpStackSize.kt @@ -1,6 +1,6 @@ package at.petrak.hexcasting.common.casting.operators.stack -import at.petrak.hexcasting.api.casting.Action +import at.petrak.hexcasting.api.casting.castables.Action import at.petrak.hexcasting.api.casting.OperationResult import at.petrak.hexcasting.api.casting.eval.CastingContext import at.petrak.hexcasting.api.casting.eval.vm.SpellContinuation diff --git a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/stack/OpTwiddling.kt b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/stack/OpTwiddling.kt index d1191871..fcf880a9 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/stack/OpTwiddling.kt +++ b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/stack/OpTwiddling.kt @@ -1,6 +1,6 @@ package at.petrak.hexcasting.common.casting.operators.stack -import at.petrak.hexcasting.api.casting.ConstMediaAction +import at.petrak.hexcasting.api.casting.castables.ConstMediaAction import at.petrak.hexcasting.api.casting.eval.CastingContext import at.petrak.hexcasting.api.casting.iota.Iota diff --git a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/stack/SpecialHandlerMask.kt b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/stack/SpecialHandlerMask.kt index 6f71a36b..a93f8370 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/stack/SpecialHandlerMask.kt +++ b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/stack/SpecialHandlerMask.kt @@ -2,9 +2,9 @@ package at.petrak.hexcasting.common.casting.operators.stack import at.petrak.hexcasting.api.HexAPI import at.petrak.hexcasting.api.HexAPI.modLoc -import at.petrak.hexcasting.api.casting.Action -import at.petrak.hexcasting.api.casting.ConstMediaAction -import at.petrak.hexcasting.api.casting.SpecialHandler +import at.petrak.hexcasting.api.casting.castables.Action +import at.petrak.hexcasting.api.casting.castables.ConstMediaAction +import at.petrak.hexcasting.api.casting.castables.SpecialHandler import at.petrak.hexcasting.api.casting.eval.CastingContext import at.petrak.hexcasting.api.casting.iota.Iota import at.petrak.hexcasting.api.casting.math.HexAngle @@ -16,7 +16,7 @@ import it.unimi.dsi.fastutil.booleans.BooleanList import net.minecraft.network.chat.Component import net.minecraft.resources.ResourceLocation -class SpecialHandlerMask(val mask: BooleanList) : SpecialHandler() { +class SpecialHandlerMask(val mask: BooleanList) : SpecialHandler { override fun act(): Action { return InnerAction(this.mask) } 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 9bb54cf1..c8ec11cb 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 @@ -1,6 +1,6 @@ package at.petrak.hexcasting.common.lib.hex; -import at.petrak.hexcasting.api.casting.Action; +import at.petrak.hexcasting.api.casting.castables.Action; import at.petrak.hexcasting.api.casting.ActionRegistryEntry; import at.petrak.hexcasting.api.casting.iota.BooleanIota; import at.petrak.hexcasting.api.casting.iota.DoubleIota; diff --git a/Common/src/main/java/at/petrak/hexcasting/common/lib/hex/HexSpecialHandlers.java b/Common/src/main/java/at/petrak/hexcasting/common/lib/hex/HexSpecialHandlers.java index af21ee21..bd8c6837 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/lib/hex/HexSpecialHandlers.java +++ b/Common/src/main/java/at/petrak/hexcasting/common/lib/hex/HexSpecialHandlers.java @@ -1,6 +1,6 @@ package at.petrak.hexcasting.common.lib.hex; -import at.petrak.hexcasting.api.casting.SpecialHandler; +import at.petrak.hexcasting.api.casting.castables.SpecialHandler; import at.petrak.hexcasting.common.casting.operators.math.SpecialHandlerNumberLiteral; import at.petrak.hexcasting.common.casting.operators.stack.SpecialHandlerMask; import at.petrak.hexcasting.xplat.IXplatAbstractions; diff --git a/Common/src/main/java/at/petrak/hexcasting/interop/pehkui/OpGetScale.kt b/Common/src/main/java/at/petrak/hexcasting/interop/pehkui/OpGetScale.kt index 83acb6ec..4260283f 100644 --- a/Common/src/main/java/at/petrak/hexcasting/interop/pehkui/OpGetScale.kt +++ b/Common/src/main/java/at/petrak/hexcasting/interop/pehkui/OpGetScale.kt @@ -1,6 +1,6 @@ package at.petrak.hexcasting.interop.pehkui -import at.petrak.hexcasting.api.casting.ConstMediaAction +import at.petrak.hexcasting.api.casting.castables.ConstMediaAction import at.petrak.hexcasting.api.casting.asActionResult import at.petrak.hexcasting.api.casting.eval.CastingContext import at.petrak.hexcasting.api.casting.getEntity diff --git a/Common/src/main/java/at/petrak/hexcasting/interop/pehkui/OpSetScale.kt b/Common/src/main/java/at/petrak/hexcasting/interop/pehkui/OpSetScale.kt index 98e0f199..c840d449 100644 --- a/Common/src/main/java/at/petrak/hexcasting/interop/pehkui/OpSetScale.kt +++ b/Common/src/main/java/at/petrak/hexcasting/interop/pehkui/OpSetScale.kt @@ -1,6 +1,7 @@ package at.petrak.hexcasting.interop.pehkui import at.petrak.hexcasting.api.casting.* +import at.petrak.hexcasting.api.casting.castables.SpellAction import at.petrak.hexcasting.api.casting.eval.CastingContext import at.petrak.hexcasting.api.casting.iota.Iota import at.petrak.hexcasting.xplat.IXplatAbstractions diff --git a/Common/src/main/java/at/petrak/hexcasting/xplat/IXplatAbstractions.java b/Common/src/main/java/at/petrak/hexcasting/xplat/IXplatAbstractions.java index e6b41fe9..8db8bc9e 100644 --- a/Common/src/main/java/at/petrak/hexcasting/xplat/IXplatAbstractions.java +++ b/Common/src/main/java/at/petrak/hexcasting/xplat/IXplatAbstractions.java @@ -5,7 +5,7 @@ import at.petrak.hexcasting.api.addldata.ADHexHolder; import at.petrak.hexcasting.api.addldata.ADIotaHolder; import at.petrak.hexcasting.api.addldata.ADMediaHolder; import at.petrak.hexcasting.api.casting.ActionRegistryEntry; -import at.petrak.hexcasting.api.casting.SpecialHandler; +import at.petrak.hexcasting.api.casting.castables.SpecialHandler; import at.petrak.hexcasting.api.casting.eval.CastingHarness; import at.petrak.hexcasting.api.casting.eval.ResolvedPattern; import at.petrak.hexcasting.api.casting.eval.sideeffects.EvalSound; diff --git a/Fabric/src/main/java/at/petrak/hexcasting/fabric/interop/gravity/OpChangeGravity.kt b/Fabric/src/main/java/at/petrak/hexcasting/fabric/interop/gravity/OpChangeGravity.kt index e67af28c..2cbbbd57 100644 --- a/Fabric/src/main/java/at/petrak/hexcasting/fabric/interop/gravity/OpChangeGravity.kt +++ b/Fabric/src/main/java/at/petrak/hexcasting/fabric/interop/gravity/OpChangeGravity.kt @@ -1,6 +1,7 @@ package at.petrak.hexcasting.fabric.interop.gravity import at.petrak.hexcasting.api.casting.* +import at.petrak.hexcasting.api.casting.castables.SpellAction import at.petrak.hexcasting.api.casting.eval.CastingContext import at.petrak.hexcasting.api.casting.iota.Iota import com.fusionflux.gravity_api.api.GravityChangerAPI diff --git a/Fabric/src/main/java/at/petrak/hexcasting/fabric/interop/gravity/OpGetGravity.kt b/Fabric/src/main/java/at/petrak/hexcasting/fabric/interop/gravity/OpGetGravity.kt index 09cd40b1..65483598 100644 --- a/Fabric/src/main/java/at/petrak/hexcasting/fabric/interop/gravity/OpGetGravity.kt +++ b/Fabric/src/main/java/at/petrak/hexcasting/fabric/interop/gravity/OpGetGravity.kt @@ -1,6 +1,6 @@ package at.petrak.hexcasting.fabric.interop.gravity -import at.petrak.hexcasting.api.casting.ConstMediaAction +import at.petrak.hexcasting.api.casting.castables.ConstMediaAction import at.petrak.hexcasting.api.casting.asActionResult import at.petrak.hexcasting.api.casting.eval.CastingContext import at.petrak.hexcasting.api.casting.getEntity diff --git a/Fabric/src/main/java/at/petrak/hexcasting/fabric/xplat/FabricXplatImpl.java b/Fabric/src/main/java/at/petrak/hexcasting/fabric/xplat/FabricXplatImpl.java index b6be7559..1032bb4c 100644 --- a/Fabric/src/main/java/at/petrak/hexcasting/fabric/xplat/FabricXplatImpl.java +++ b/Fabric/src/main/java/at/petrak/hexcasting/fabric/xplat/FabricXplatImpl.java @@ -5,7 +5,7 @@ import at.petrak.hexcasting.api.addldata.ADHexHolder; import at.petrak.hexcasting.api.addldata.ADIotaHolder; import at.petrak.hexcasting.api.addldata.ADMediaHolder; import at.petrak.hexcasting.api.casting.ActionRegistryEntry; -import at.petrak.hexcasting.api.casting.SpecialHandler; +import at.petrak.hexcasting.api.casting.castables.SpecialHandler; import at.petrak.hexcasting.api.casting.eval.CastingHarness; import at.petrak.hexcasting.api.casting.eval.ResolvedPattern; import at.petrak.hexcasting.api.casting.eval.sideeffects.EvalSound; diff --git a/Forge/src/main/java/at/petrak/hexcasting/forge/xplat/ForgeXplatImpl.java b/Forge/src/main/java/at/petrak/hexcasting/forge/xplat/ForgeXplatImpl.java index 5882fc2b..31f2b763 100644 --- a/Forge/src/main/java/at/petrak/hexcasting/forge/xplat/ForgeXplatImpl.java +++ b/Forge/src/main/java/at/petrak/hexcasting/forge/xplat/ForgeXplatImpl.java @@ -6,7 +6,7 @@ import at.petrak.hexcasting.api.addldata.ADHexHolder; import at.petrak.hexcasting.api.addldata.ADIotaHolder; import at.petrak.hexcasting.api.addldata.ADMediaHolder; import at.petrak.hexcasting.api.casting.ActionRegistryEntry; -import at.petrak.hexcasting.api.casting.SpecialHandler; +import at.petrak.hexcasting.api.casting.castables.SpecialHandler; import at.petrak.hexcasting.api.casting.eval.CastingContext; import at.petrak.hexcasting.api.casting.eval.CastingHarness; import at.petrak.hexcasting.api.casting.eval.ResolvedPattern; From 57b415e0254c440be1090b6804921915e755b830 Mon Sep 17 00:00:00 2001 From: "petrak@" Date: Sat, 21 Jan 2023 17:40:54 -0600 Subject: [PATCH 43/95] re-impl halt --- .../casting/operators/eval/OpEvalDelay.kt | 18 ------------------ .../hexcasting/common/lib/hex/HexActions.java | 5 ++++- .../en_us/entries/patterns/meta.json | 10 ++++++++++ 3 files changed, 14 insertions(+), 19 deletions(-) delete mode 100644 Common/src/main/java/at/petrak/hexcasting/common/casting/operators/eval/OpEvalDelay.kt diff --git a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/eval/OpEvalDelay.kt b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/eval/OpEvalDelay.kt deleted file mode 100644 index dd2cab70..00000000 --- a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/eval/OpEvalDelay.kt +++ /dev/null @@ -1,18 +0,0 @@ -package at.petrak.hexcasting.common.casting.operators.eval - -import at.petrak.hexcasting.api.casting.castables.Action -import at.petrak.hexcasting.api.casting.OperationResult -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 - -object OpEvalDelay : Action { - override fun operate( - continuation: SpellContinuation, - stack: MutableList, - ravenmind: Iota?, - ctx: CastingContext - ): OperationResult { - return OperationResult(continuation, stack, ravenmind, listOf()) - } -} 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 c8ec11cb..51b024f6 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 @@ -1,7 +1,7 @@ package at.petrak.hexcasting.common.lib.hex; -import at.petrak.hexcasting.api.casting.castables.Action; import at.petrak.hexcasting.api.casting.ActionRegistryEntry; +import at.petrak.hexcasting.api.casting.castables.Action; import at.petrak.hexcasting.api.casting.iota.BooleanIota; import at.petrak.hexcasting.api.casting.iota.DoubleIota; import at.petrak.hexcasting.api.casting.iota.NullIota; @@ -18,6 +18,7 @@ import at.petrak.hexcasting.common.casting.operators.circles.OpImpetusDir; import at.petrak.hexcasting.common.casting.operators.circles.OpImpetusPos; import at.petrak.hexcasting.common.casting.operators.eval.OpEval; import at.petrak.hexcasting.common.casting.operators.eval.OpForEach; +import at.petrak.hexcasting.common.casting.operators.eval.OpHalt; import at.petrak.hexcasting.common.casting.operators.lists.*; import at.petrak.hexcasting.common.casting.operators.local.OpPeekLocal; import at.petrak.hexcasting.common.casting.operators.local.OpPushLocal; @@ -373,6 +374,8 @@ public class HexActions { // eval being a space filling curve feels apt doesn't it public static final ActionRegistryEntry EVAL = make("eval", new ActionRegistryEntry(HexPattern.fromAngles("deaqq", HexDir.SOUTH_EAST), OpEval.INSTANCE)); + public static final ActionRegistryEntry HALT = make("halt", + new ActionRegistryEntry(HexPattern.fromAngles("aqdee", HexDir.SOUTH_WEST), OpHalt.INSTANCE)); // TODO: install Iris' gambit public static final ActionRegistryEntry READ = make("read", diff --git a/Common/src/main/resources/data/hexcasting/patchouli_books/thehexbook/en_us/entries/patterns/meta.json b/Common/src/main/resources/data/hexcasting/patchouli_books/thehexbook/en_us/entries/patterns/meta.json index a9beb442..b38c35e0 100644 --- a/Common/src/main/resources/data/hexcasting/patchouli_books/thehexbook/en_us/entries/patterns/meta.json +++ b/Common/src/main/resources/data/hexcasting/patchouli_books/thehexbook/en_us/entries/patterns/meta.json @@ -29,6 +29,16 @@ { "type": "patchouli:text", "text": "hexcasting.page.meta.for_each.2" + }, + { + "type": "hexcasting:pattern", + "op_id": "hexcasting:halt", + "anchor": "hexcasting:halt", + "text": "hexcasting.page.meta.halt.1" + }, + { + "type": "patchouli:text", + "text": "hexcasting.page.meta.halt.2" } ] } From 8b0a01e82536513eec61700baab28fa256edca66 Mon Sep 17 00:00:00 2001 From: "petrak@" Date: Sat, 21 Jan 2023 20:29:09 -0600 Subject: [PATCH 44/95] close #378 --- .../java/at/petrak/hexcasting/api/HexAPI.java | 24 +- .../circle/BlockEntityAbstractImpetus.java | 4 +- .../hexcasting/api/casting/RenderedSpell.kt | 4 +- .../api/casting/castables/Action.kt | 6 +- .../api/casting/castables/ConstMediaAction.kt | 6 +- .../api/casting/castables/SpellAction.kt | 10 +- ...astingContext.kt => CastingEnvironment.kt} | 2 +- .../api/casting/eval/CastingHarness.kt | 12 +- .../api/casting/eval/SpellCircleContext.kt | 2 +- .../hexcasting/api/casting/mishaps/Mishap.kt | 24 +- .../mishaps/MishapAlreadyBrainswept.kt | 10 +- .../api/casting/mishaps/MishapBadBlock.kt | 10 +- .../casting/mishaps/MishapBadBrainsweep.kt | 10 +- .../api/casting/mishaps/MishapBadEntity.kt | 8 +- .../api/casting/mishaps/MishapBadItem.kt | 8 +- .../casting/mishaps/MishapBadOffhandItem.kt | 8 +- .../casting/mishaps/MishapDisallowedSpell.kt | 10 +- .../api/casting/mishaps/MishapDivideByZero.kt | 8 +- .../casting/mishaps/MishapEntityTooFarAway.kt | 8 +- .../api/casting/mishaps/MishapError.kt | 8 +- .../api/casting/mishaps/MishapEvalTooDeep.kt | 8 +- .../api/casting/mishaps/MishapImmuneEntity.kt | 8 +- .../api/casting/mishaps/MishapInvalidIota.kt | 8 +- .../casting/mishaps/MishapInvalidPattern.kt | 10 +- .../mishaps/MishapInvalidSpellDatumType.kt | 8 +- .../mishaps/MishapLocationInWrongDimension.kt | 8 +- .../mishaps/MishapLocationTooFarAway.kt | 8 +- .../casting/mishaps/MishapNoAkashicRecord.kt | 8 +- .../casting/mishaps/MishapNoSpellCircle.kt | 8 +- .../casting/mishaps/MishapNotEnoughArgs.kt | 8 +- .../api/casting/mishaps/MishapOthersName.kt | 8 +- .../api/casting/mishaps/MishapShameOnYou.kt | 8 +- .../mishaps/MishapTooManyCloseParens.kt | 8 +- .../casting/mishaps/MishapUnescapedValue.kt | 8 +- .../api/misc/DiscoveryHandlers.java | 14 +- .../casting/operators/OpBlockAxisRaycast.kt | 4 +- .../casting/operators/OpBlockRaycast.kt | 4 +- .../casting/operators/OpEntityHeight.kt | 4 +- .../common/casting/operators/OpEntityLook.kt | 4 +- .../common/casting/operators/OpEntityPos.kt | 4 +- .../casting/operators/OpEntityRaycast.kt | 4 +- .../casting/operators/OpEntityVelocity.kt | 4 +- .../operators/akashic/OpAkashicRead.kt | 4 +- .../operators/akashic/OpAkashicWrite.kt | 6 +- .../operators/circles/OpCircleBounds.kt | 4 +- .../casting/operators/circles/OpImpetusDir.kt | 4 +- .../casting/operators/circles/OpImpetusPos.kt | 4 +- .../common/casting/operators/eval/OpEval.kt | 4 +- .../casting/operators/eval/OpForEach.kt | 4 +- .../common/casting/operators/eval/OpHalt.kt | 4 +- .../casting/operators/lists/OpAppend.kt | 4 +- .../casting/operators/lists/OpConcat.kt | 4 +- .../common/casting/operators/lists/OpCons.kt | 4 +- .../casting/operators/lists/OpEmptyList.kt | 4 +- .../common/casting/operators/lists/OpIndex.kt | 4 +- .../casting/operators/lists/OpIndexOf.kt | 4 +- .../casting/operators/lists/OpLastNToList.kt | 4 +- .../casting/operators/lists/OpListSize.kt | 4 +- .../operators/lists/OpModifyInPlace.kt | 4 +- .../casting/operators/lists/OpRemove.kt | 4 +- .../casting/operators/lists/OpReverski.kt | 4 +- .../casting/operators/lists/OpSingleton.kt | 4 +- .../common/casting/operators/lists/OpSlice.kt | 4 +- .../common/casting/operators/lists/OpSplat.kt | 4 +- .../casting/operators/lists/OpUnCons.kt | 4 +- .../casting/operators/local/OpPeekLocal.kt | 4 +- .../casting/operators/local/OpPushLocal.kt | 4 +- .../common/casting/operators/math/OpAbsLen.kt | 4 +- .../common/casting/operators/math/OpAdd.kt | 4 +- .../common/casting/operators/math/OpCeil.kt | 4 +- .../casting/operators/math/OpCoerceToAxial.kt | 4 +- .../casting/operators/math/OpConstructVec.kt | 4 +- .../operators/math/OpDeconstructVec.kt | 4 +- .../casting/operators/math/OpDivCross.kt | 4 +- .../common/casting/operators/math/OpFloor.kt | 4 +- .../common/casting/operators/math/OpLog.kt | 4 +- .../common/casting/operators/math/OpModulo.kt | 4 +- .../common/casting/operators/math/OpMulDot.kt | 4 +- .../casting/operators/math/OpPowProj.kt | 4 +- .../common/casting/operators/math/OpRandom.kt | 4 +- .../common/casting/operators/math/OpSub.kt | 4 +- .../math/SpecialHandlerNumberLiteral.kt | 15 +- .../casting/operators/math/bit/OpAnd.kt | 4 +- .../casting/operators/math/bit/OpNot.kt | 4 +- .../common/casting/operators/math/bit/OpOr.kt | 4 +- .../casting/operators/math/bit/OpToSet.kt | 4 +- .../casting/operators/math/bit/OpXor.kt | 4 +- .../casting/operators/math/logic/OpBoolAnd.kt | 4 +- .../casting/operators/math/logic/OpBoolIf.kt | 4 +- .../casting/operators/math/logic/OpBoolNot.kt | 4 +- .../casting/operators/math/logic/OpBoolOr.kt | 4 +- .../casting/operators/math/logic/OpBoolXor.kt | 4 +- .../operators/math/logic/OpCoerceToBool.kt | 4 +- .../casting/operators/math/logic/OpCompare.kt | 4 +- .../operators/math/logic/OpEquality.kt | 4 +- .../casting/operators/math/trig/OpArcCos.kt | 4 +- .../casting/operators/math/trig/OpArcSin.kt | 4 +- .../casting/operators/math/trig/OpArcTan.kt | 4 +- .../casting/operators/math/trig/OpArcTan2.kt | 4 +- .../casting/operators/math/trig/OpCos.kt | 4 +- .../casting/operators/math/trig/OpSin.kt | 4 +- .../casting/operators/math/trig/OpTan.kt | 4 +- .../common/casting/operators/rw/OpRead.kt | 4 +- .../common/casting/operators/rw/OpReadable.kt | 4 +- .../casting/operators/rw/OpTheCoolerRead.kt | 4 +- .../operators/rw/OpTheCoolerReadable.kt | 4 +- .../operators/rw/OpTheCoolerWritable.kt | 4 +- .../casting/operators/rw/OpTheCoolerWrite.kt | 6 +- .../common/casting/operators/rw/OpWritable.kt | 4 +- .../common/casting/operators/rw/OpWrite.kt | 6 +- .../operators/selectors/OpGetCaster.kt | 4 +- .../operators/selectors/OpGetEntitiesBy.kt | 6 +- .../operators/selectors/OpGetEntityAt.kt | 4 +- .../casting/operators/spells/OpAddMotion.kt | 6 +- .../common/casting/operators/spells/OpBeep.kt | 8 +- .../casting/operators/spells/OpBlink.kt | 6 +- .../casting/operators/spells/OpBreakBlock.kt | 6 +- .../casting/operators/spells/OpColorize.kt | 6 +- .../operators/spells/OpConjureBlock.kt | 6 +- .../casting/operators/spells/OpCreateFluid.kt | 6 +- .../operators/spells/OpDestroyFluid.kt | 6 +- .../operators/spells/OpEdifySapling.kt | 6 +- .../casting/operators/spells/OpErase.kt | 6 +- .../casting/operators/spells/OpExplode.kt | 6 +- .../casting/operators/spells/OpExtinguish.kt | 6 +- .../casting/operators/spells/OpIgnite.kt | 8 +- .../casting/operators/spells/OpMakeBattery.kt | 6 +- .../operators/spells/OpMakePackagedSpell.kt | 6 +- .../casting/operators/spells/OpPlaceBlock.kt | 6 +- .../operators/spells/OpPotionEffect.kt | 6 +- .../casting/operators/spells/OpPrint.kt | 6 +- .../casting/operators/spells/OpRecharge.kt | 6 +- .../OpTheOnlyReasonAnyoneDownloadedPsi.kt | 6 +- .../operators/spells/great/OpBrainsweep.kt | 8 +- .../operators/spells/great/OpFlight.kt | 6 +- .../operators/spells/great/OpLightning.kt | 6 +- .../operators/spells/great/OpTeleport.kt | 6 +- .../operators/spells/great/OpWeather.kt | 6 +- .../spells/sentinel/OpCreateSentinel.kt | 6 +- .../spells/sentinel/OpDestroySentinel.kt | 6 +- .../spells/sentinel/OpGetSentinelPos.kt | 4 +- .../spells/sentinel/OpGetSentinelWayfind.kt | 4 +- .../OpAlwinfyHasAscendedToABeingOfPureMath.kt | 4 +- .../casting/operators/stack/OpBitMask.kt | 4 +- .../casting/operators/stack/OpDuplicateN.kt | 4 +- .../casting/operators/stack/OpFisherman.kt | 4 +- .../operators/stack/OpFishermanButItCopies.kt | 4 +- .../common/casting/operators/stack/OpMask.kt | 4 +- .../casting/operators/stack/OpStackSize.kt | 4 +- .../casting/operators/stack/OpTwiddling.kt | 4 +- .../operators/stack/SpecialHandlerMask.kt | 12 +- .../common/items/magic/ItemPackagedHex.java | 4 +- .../interop/patchouli/PatternProcessor.java | 2 +- .../hexcasting/interop/pehkui/OpGetScale.kt | 4 +- .../hexcasting/interop/pehkui/OpSetScale.kt | 6 +- .../assets/hexcasting/lang/en_us.json | 413 +++++++++--------- .../patterns/great_spells/brainsweep.json | 2 +- .../patterns/great_spells/create_lava.json | 2 +- .../entries/patterns/great_spells/flight.json | 2 +- .../great_spells/greater_sentinel.json | 2 +- .../patterns/great_spells/make_battery.json | 2 +- .../patterns/great_spells/teleport.json | 2 +- .../entries/patterns/spells/colorize.json | 2 +- .../hexcasting/fabric/cc/CCHarness.java | 4 +- .../fabric/interop/gravity/OpChangeGravity.kt | 6 +- .../fabric/interop/gravity/OpGetGravity.kt | 4 +- .../forge/xplat/ForgeXplatImpl.java | 4 +- 167 files changed, 670 insertions(+), 652 deletions(-) rename Common/src/main/java/at/petrak/hexcasting/api/casting/eval/{CastingContext.kt => CastingEnvironment.kt} (99%) diff --git a/Common/src/main/java/at/petrak/hexcasting/api/HexAPI.java b/Common/src/main/java/at/petrak/hexcasting/api/HexAPI.java index 4872b945..9a4884fc 100644 --- a/Common/src/main/java/at/petrak/hexcasting/api/HexAPI.java +++ b/Common/src/main/java/at/petrak/hexcasting/api/HexAPI.java @@ -35,18 +35,34 @@ public interface HexAPI { * Special handlers should be calling {@link SpecialHandler#getName()} */ default String getActionI18nKey(ResourceKey action) { - return "hexcasting.spell.%s".formatted(action.location()); + return "hexcasting.action.%s".formatted(action.location().toString()); } - default String getActionI18nKey(ResourceLocation action) { - return "hexcasting.spell.%s".formatted(action.toString()); + default String getSpecialHandlerI18nKey(ResourceKey> action) { + return "hexcasting.special.%s".formatted(action.location().toString()); } - default Component getActionI18(ResourceLocation key, boolean isGreat) { + /** + * Currently introspection/retrospection/consideration are hardcoded, but at least their names won't be + */ + default String getRawHookI18nKey(ResourceLocation name) { + return "hexcasting.rawhook.%s".formatted(name); + } + + default Component getActionI18n(ResourceKey key, boolean isGreat) { return Component.translatable(getActionI18nKey(key)) .withStyle(isGreat ? ChatFormatting.GOLD : ChatFormatting.LIGHT_PURPLE); } + default Component getSpecialHandlerI18n(ResourceKey> key) { + return Component.translatable(getSpecialHandlerI18nKey(key)) + .withStyle(ChatFormatting.LIGHT_PURPLE); + } + + default Component getRawHookI18n(ResourceLocation name) { + return Component.translatable(getRawHookI18nKey(name)).withStyle(ChatFormatting.LIGHT_PURPLE); + } + static HexAPI instance() { return INSTANCE.get(); } diff --git a/Common/src/main/java/at/petrak/hexcasting/api/block/circle/BlockEntityAbstractImpetus.java b/Common/src/main/java/at/petrak/hexcasting/api/block/circle/BlockEntityAbstractImpetus.java index 91f40752..7d931f82 100644 --- a/Common/src/main/java/at/petrak/hexcasting/api/block/circle/BlockEntityAbstractImpetus.java +++ b/Common/src/main/java/at/petrak/hexcasting/api/block/circle/BlockEntityAbstractImpetus.java @@ -5,7 +5,7 @@ import at.petrak.hexcasting.api.misc.FrozenColorizer; import at.petrak.hexcasting.api.misc.MediaConstants; import at.petrak.hexcasting.api.mod.HexConfig; import at.petrak.hexcasting.api.casting.ParticleSpray; -import at.petrak.hexcasting.api.casting.eval.CastingContext; +import at.petrak.hexcasting.api.casting.eval.CastingEnvironment; import at.petrak.hexcasting.api.casting.eval.CastingHarness; import at.petrak.hexcasting.api.casting.eval.SpellCircleContext; import at.petrak.hexcasting.api.casting.iota.PatternIota; @@ -282,7 +282,7 @@ public abstract class BlockEntityAbstractImpetus extends HexBlockEntity implemen if (player instanceof ServerPlayer splayer) { var bounds = getBounds(this.trackedBlocks); - var ctx = new CastingContext(splayer, InteractionHand.MAIN_HAND, + var ctx = new CastingEnvironment(splayer, InteractionHand.MAIN_HAND, new SpellCircleContext(this.getBlockPos(), bounds, this.activatorAlwaysInRange())); var harness = new CastingHarness(ctx); diff --git a/Common/src/main/java/at/petrak/hexcasting/api/casting/RenderedSpell.kt b/Common/src/main/java/at/petrak/hexcasting/api/casting/RenderedSpell.kt index 828f9966..1240d3b7 100644 --- a/Common/src/main/java/at/petrak/hexcasting/api/casting/RenderedSpell.kt +++ b/Common/src/main/java/at/petrak/hexcasting/api/casting/RenderedSpell.kt @@ -1,7 +1,7 @@ package at.petrak.hexcasting.api.casting -import at.petrak.hexcasting.api.casting.eval.CastingContext +import at.petrak.hexcasting.api.casting.eval.CastingEnvironment interface RenderedSpell { - fun cast(ctx: CastingContext) + fun cast(ctx: CastingEnvironment) } diff --git a/Common/src/main/java/at/petrak/hexcasting/api/casting/castables/Action.kt b/Common/src/main/java/at/petrak/hexcasting/api/casting/castables/Action.kt index 24ff61bf..862288db 100644 --- a/Common/src/main/java/at/petrak/hexcasting/api/casting/castables/Action.kt +++ b/Common/src/main/java/at/petrak/hexcasting/api/casting/castables/Action.kt @@ -1,7 +1,7 @@ package at.petrak.hexcasting.api.casting.castables import at.petrak.hexcasting.api.casting.OperationResult -import at.petrak.hexcasting.api.casting.eval.CastingContext +import at.petrak.hexcasting.api.casting.eval.CastingEnvironment import at.petrak.hexcasting.api.casting.eval.vm.SpellContinuation import at.petrak.hexcasting.api.casting.iota.Iota import net.minecraft.world.phys.Vec3 @@ -32,7 +32,7 @@ interface Action { continuation: SpellContinuation, stack: MutableList, ravenmind: Iota?, - ctx: CastingContext + ctx: CastingEnvironment ): OperationResult companion object { @@ -49,7 +49,7 @@ interface Action { override val argc: Int get() = 0 - override fun execute(args: List, ctx: CastingContext): List = + override fun execute(args: List, ctx: CastingEnvironment): List = listOf(x) } diff --git a/Common/src/main/java/at/petrak/hexcasting/api/casting/castables/ConstMediaAction.kt b/Common/src/main/java/at/petrak/hexcasting/api/casting/castables/ConstMediaAction.kt index aa33a4b5..587f0b64 100644 --- a/Common/src/main/java/at/petrak/hexcasting/api/casting/castables/ConstMediaAction.kt +++ b/Common/src/main/java/at/petrak/hexcasting/api/casting/castables/ConstMediaAction.kt @@ -1,7 +1,7 @@ package at.petrak.hexcasting.api.casting.castables import at.petrak.hexcasting.api.casting.OperationResult -import at.petrak.hexcasting.api.casting.eval.CastingContext +import at.petrak.hexcasting.api.casting.eval.CastingEnvironment import at.petrak.hexcasting.api.casting.eval.vm.SpellContinuation import at.petrak.hexcasting.api.casting.eval.sideeffects.OperatorSideEffect import at.petrak.hexcasting.api.casting.iota.Iota @@ -15,13 +15,13 @@ interface ConstMediaAction : Action { val mediaCost: Int get() = 0 - fun execute(args: List, ctx: CastingContext): List + fun execute(args: List, ctx: CastingEnvironment): List override fun operate( continuation: SpellContinuation, stack: MutableList, ravenmind: Iota?, - ctx: CastingContext + ctx: CastingEnvironment ): OperationResult { if (this.argc > stack.size) throw MishapNotEnoughArgs(this.argc, stack.size) diff --git a/Common/src/main/java/at/petrak/hexcasting/api/casting/castables/SpellAction.kt b/Common/src/main/java/at/petrak/hexcasting/api/casting/castables/SpellAction.kt index d6440d22..41621be0 100644 --- a/Common/src/main/java/at/petrak/hexcasting/api/casting/castables/SpellAction.kt +++ b/Common/src/main/java/at/petrak/hexcasting/api/casting/castables/SpellAction.kt @@ -3,7 +3,7 @@ package at.petrak.hexcasting.api.casting.castables import at.petrak.hexcasting.api.casting.OperationResult import at.petrak.hexcasting.api.casting.ParticleSpray import at.petrak.hexcasting.api.casting.RenderedSpell -import at.petrak.hexcasting.api.casting.eval.CastingContext +import at.petrak.hexcasting.api.casting.eval.CastingEnvironment 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 @@ -12,20 +12,20 @@ import at.petrak.hexcasting.api.casting.mishaps.MishapNotEnoughArgs interface SpellAction : Action { val argc: Int - fun hasCastingSound(ctx: CastingContext): Boolean = true + fun hasCastingSound(ctx: CastingEnvironment): Boolean = true - fun awardsCastingStat(ctx: CastingContext): Boolean = true + fun awardsCastingStat(ctx: CastingEnvironment): Boolean = true fun execute( args: List, - ctx: CastingContext + ctx: CastingEnvironment ): Triple>? override fun operate( continuation: SpellContinuation, stack: MutableList, ravenmind: Iota?, - ctx: CastingContext + ctx: CastingEnvironment ): OperationResult { if (this.argc > stack.size) throw MishapNotEnoughArgs(this.argc, stack.size) diff --git a/Common/src/main/java/at/petrak/hexcasting/api/casting/eval/CastingContext.kt b/Common/src/main/java/at/petrak/hexcasting/api/casting/eval/CastingEnvironment.kt similarity index 99% rename from Common/src/main/java/at/petrak/hexcasting/api/casting/eval/CastingContext.kt rename to Common/src/main/java/at/petrak/hexcasting/api/casting/eval/CastingEnvironment.kt index 19b89cf0..0a71f482 100644 --- a/Common/src/main/java/at/petrak/hexcasting/api/casting/eval/CastingContext.kt +++ b/Common/src/main/java/at/petrak/hexcasting/api/casting/eval/CastingEnvironment.kt @@ -25,7 +25,7 @@ import kotlin.math.min /** * Transient info about the moment the spell started being cast. */ -data class CastingContext( +data class CastingEnvironment( val caster: ServerPlayer, val castingHand: InteractionHand, val source: CastSource, 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 38085c20..72cd4b65 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 @@ -54,13 +54,13 @@ class CastingHarness private constructor( var parenCount: Int, var parenthesized: List, var escapeNext: Boolean, - val ctx: CastingContext, + val ctx: CastingEnvironment, val prepackagedColorizer: FrozenColorizer? // for trinkets with colorizers ) { @JvmOverloads constructor( - ctx: CastingContext, + ctx: CastingEnvironment, prepackagedColorizer: FrozenColorizer? = null ) : this(mutableListOf(), null, 0, mutableListOf(), false, ctx, prepackagedColorizer) @@ -160,7 +160,7 @@ class CastingHarness private constructor( e, Mishap.Context( (iota as? PatternIota)?.pattern ?: HexPattern(HexDir.WEST), - HexAPI.instance().getActionI18(HexAPI.modLoc("retrospection"), false) + HexAPI.instance().getRawHookI18n(HexAPI.modLoc("close_paren")) ) ) ), @@ -224,7 +224,7 @@ class CastingHarness private constructor( 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) + castedName = HexAPI.instance().getActionI18n(key, reqsEnlightenment) if (!ctx.isCasterEnlightened && reqsEnlightenment) { Either.right(listOf(OperatorSideEffect.RequiredEnlightenment(canEnlighten))) @@ -291,7 +291,7 @@ class CastingHarness private constructor( } // TODO again this should be per VM - var soundType = if (this.ctx.source == CastingContext.CastSource.STAFF) { + var soundType = if (this.ctx.source == CastingEnvironment.CastSource.STAFF) { HexEvalSounds.OPERATOR } else { HexEvalSounds.NOTHING @@ -623,7 +623,7 @@ class CastingHarness private constructor( } @JvmStatic - fun fromNBT(nbt: CompoundTag, ctx: CastingContext): CastingHarness { + fun fromNBT(nbt: CompoundTag, ctx: CastingEnvironment): CastingHarness { return try { val stack = mutableListOf() val stackTag = nbt.getList(TAG_STACK, Tag.TAG_COMPOUND) diff --git a/Common/src/main/java/at/petrak/hexcasting/api/casting/eval/SpellCircleContext.kt b/Common/src/main/java/at/petrak/hexcasting/api/casting/eval/SpellCircleContext.kt index bc404876..269d6465 100644 --- a/Common/src/main/java/at/petrak/hexcasting/api/casting/eval/SpellCircleContext.kt +++ b/Common/src/main/java/at/petrak/hexcasting/api/casting/eval/SpellCircleContext.kt @@ -6,7 +6,7 @@ import net.minecraft.nbt.CompoundTag import net.minecraft.world.phys.AABB /** - * Optional field on a [CastingContext] for the spell circle + * Optional field on a [CastingEnvironment] for the spell circle */ data class SpellCircleContext(val impetusPos: BlockPos, val aabb: AABB, val activatorAlwaysInRange: Boolean) { fun serializeToNBT() = NBTBuilder { diff --git a/Common/src/main/java/at/petrak/hexcasting/api/casting/mishaps/Mishap.kt b/Common/src/main/java/at/petrak/hexcasting/api/casting/mishaps/Mishap.kt index 7d4121ad..ff1517ba 100644 --- a/Common/src/main/java/at/petrak/hexcasting/api/casting/mishaps/Mishap.kt +++ b/Common/src/main/java/at/petrak/hexcasting/api/casting/mishaps/Mishap.kt @@ -1,7 +1,7 @@ package at.petrak.hexcasting.api.casting.mishaps import at.petrak.hexcasting.api.casting.ParticleSpray -import at.petrak.hexcasting.api.casting.eval.CastingContext +import at.petrak.hexcasting.api.casting.eval.CastingEnvironment import at.petrak.hexcasting.api.casting.eval.ResolvedPatternType import at.petrak.hexcasting.api.casting.iota.Iota import at.petrak.hexcasting.api.casting.math.HexPattern @@ -25,29 +25,29 @@ import net.minecraft.world.phys.Vec3 abstract class Mishap : Throwable() { /** Mishaps spray half-red, half-this-color. */ - abstract fun accentColor(ctx: CastingContext, errorCtx: Context): FrozenColorizer + abstract fun accentColor(ctx: CastingEnvironment, errorCtx: Context): FrozenColorizer - open fun particleSpray(ctx: CastingContext): ParticleSpray { + open fun particleSpray(ctx: CastingEnvironment): ParticleSpray { return ParticleSpray(ctx.position.add(0.0, 0.2, 0.0), Vec3(0.0, 2.0, 0.0), 0.2, Math.PI / 4, 40) } - open fun resolutionType(ctx: CastingContext): ResolvedPatternType = ResolvedPatternType.ERRORED + open fun resolutionType(ctx: CastingEnvironment): ResolvedPatternType = ResolvedPatternType.ERRORED /** * Execute the actual effect, not any sfx. * * You can also mess up the stack with this. */ - abstract fun execute(ctx: CastingContext, errorCtx: Context, stack: MutableList) + abstract fun execute(ctx: CastingEnvironment, errorCtx: Context, stack: MutableList) - abstract protected fun errorMessage(ctx: CastingContext, errorCtx: Context): Component + abstract protected fun errorMessage(ctx: CastingEnvironment, errorCtx: Context): Component /** * Every error message should be prefixed with the name of the action... */ - public fun errorMessageWithName(ctx: CastingContext, errorCtx: Context): Component { + public fun errorMessageWithName(ctx: CastingEnvironment, errorCtx: Context): Component { return if (errorCtx.name != null) { - errorCtx.name.copy().append(": ").append(this.errorMessage(ctx, errorCtx)) + "hexcasting.mishap".asTranslatedComponent(errorCtx.name, this.errorMessage(ctx, errorCtx)) } else { this.errorMessage(ctx, errorCtx) } @@ -67,7 +67,7 @@ abstract class Mishap : Throwable() { protected fun actionName(name: Component?): Component = name ?: "hexcasting.spell.null".asTranslatedComponent.lightPurple - protected fun yeetHeldItemsTowards(ctx: CastingContext, targetPos: Vec3) { + protected fun yeetHeldItemsTowards(ctx: CastingEnvironment, targetPos: Vec3) { // Knock the player's items out of their hands val items = mutableListOf() for (hand in InteractionHand.values()) { @@ -84,7 +84,7 @@ abstract class Mishap : Throwable() { } } - protected fun yeetHeldItem(ctx: CastingContext, hand: InteractionHand) { + protected fun yeetHeldItem(ctx: CastingEnvironment, hand: InteractionHand) { val item = ctx.caster.getItemInHand(hand).copy() if (hand == ctx.castingHand && IXplatAbstractions.INSTANCE.findHexHolder(item) != null) return @@ -94,7 +94,7 @@ abstract class Mishap : Throwable() { yeetItem(item, ctx, delta) } - protected fun yeetItem(stack: ItemStack, ctx: CastingContext, delta: Vec3) { + protected fun yeetItem(stack: ItemStack, ctx: CastingEnvironment, delta: Vec3) { val entity = ItemEntity( ctx.world, ctx.position.x, ctx.position.y, ctx.position.z, @@ -107,7 +107,7 @@ abstract class Mishap : Throwable() { ctx.world.addWithUUID(entity) } - protected fun blockAtPos(ctx: CastingContext, pos: BlockPos): Component { + protected fun blockAtPos(ctx: CastingEnvironment, pos: BlockPos): Component { return ctx.world.getBlockState(pos).block.name } diff --git a/Common/src/main/java/at/petrak/hexcasting/api/casting/mishaps/MishapAlreadyBrainswept.kt b/Common/src/main/java/at/petrak/hexcasting/api/casting/mishaps/MishapAlreadyBrainswept.kt index 07e656b3..50d8506d 100644 --- a/Common/src/main/java/at/petrak/hexcasting/api/casting/mishaps/MishapAlreadyBrainswept.kt +++ b/Common/src/main/java/at/petrak/hexcasting/api/casting/mishaps/MishapAlreadyBrainswept.kt @@ -3,23 +3,23 @@ package at.petrak.hexcasting.api.casting.mishaps import at.petrak.hexcasting.api.misc.FrozenColorizer import at.petrak.hexcasting.api.misc.HexDamageSources import at.petrak.hexcasting.api.casting.ParticleSpray -import at.petrak.hexcasting.api.casting.eval.CastingContext +import at.petrak.hexcasting.api.casting.eval.CastingEnvironment import at.petrak.hexcasting.api.casting.iota.Iota import net.minecraft.world.entity.Mob import net.minecraft.world.item.DyeColor class MishapAlreadyBrainswept(val mob: Mob) : Mishap() { - override fun accentColor(ctx: CastingContext, errorCtx: Context): FrozenColorizer = + override fun accentColor(ctx: CastingEnvironment, errorCtx: Context): FrozenColorizer = dyeColor(DyeColor.GREEN) - override fun execute(ctx: CastingContext, errorCtx: Context, stack: MutableList) { + override fun execute(ctx: CastingEnvironment, errorCtx: Context, stack: MutableList) { mob.hurt(HexDamageSources.overcastDamageFrom(ctx.caster), mob.health) } - override fun particleSpray(ctx: CastingContext) = + override fun particleSpray(ctx: CastingEnvironment) = ParticleSpray.burst(mob.eyePosition, 1.0) - override fun errorMessage(ctx: CastingContext, errorCtx: Context) = + override fun errorMessage(ctx: CastingEnvironment, errorCtx: Context) = error("already_brainswept") } diff --git a/Common/src/main/java/at/petrak/hexcasting/api/casting/mishaps/MishapBadBlock.kt b/Common/src/main/java/at/petrak/hexcasting/api/casting/mishaps/MishapBadBlock.kt index d239af9a..0f469358 100644 --- a/Common/src/main/java/at/petrak/hexcasting/api/casting/mishaps/MishapBadBlock.kt +++ b/Common/src/main/java/at/petrak/hexcasting/api/casting/mishaps/MishapBadBlock.kt @@ -3,7 +3,7 @@ package at.petrak.hexcasting.api.casting.mishaps import at.petrak.hexcasting.api.misc.FrozenColorizer import at.petrak.hexcasting.api.casting.ParticleSpray import at.petrak.hexcasting.api.casting.iota.Iota -import at.petrak.hexcasting.api.casting.eval.CastingContext +import at.petrak.hexcasting.api.casting.eval.CastingEnvironment import at.petrak.hexcasting.api.utils.asTranslatedComponent import net.minecraft.core.BlockPos import net.minecraft.network.chat.Component @@ -12,17 +12,17 @@ import net.minecraft.world.level.Explosion import net.minecraft.world.phys.Vec3 class MishapBadBlock(val pos: BlockPos, val expected: Component) : Mishap() { - override fun accentColor(ctx: CastingContext, errorCtx: Context): FrozenColorizer = + override fun accentColor(ctx: CastingEnvironment, errorCtx: Context): FrozenColorizer = dyeColor(DyeColor.LIME) - override fun execute(ctx: CastingContext, errorCtx: Context, stack: MutableList) { + override fun execute(ctx: CastingEnvironment, errorCtx: Context, stack: MutableList) { ctx.world.explode(null, pos.x + 0.5, pos.y + 0.5, pos.z + 0.5, 0.25f, Explosion.BlockInteraction.NONE) } - override fun particleSpray(ctx: CastingContext) = + override fun particleSpray(ctx: CastingEnvironment) = ParticleSpray.burst(Vec3.atCenterOf(pos), 1.0) - override fun errorMessage(ctx: CastingContext, errorCtx: Context) = + override fun errorMessage(ctx: CastingEnvironment, errorCtx: Context) = error("bad_block", expected, this.pos.toShortString(), blockAtPos(ctx, this.pos)) companion object { diff --git a/Common/src/main/java/at/petrak/hexcasting/api/casting/mishaps/MishapBadBrainsweep.kt b/Common/src/main/java/at/petrak/hexcasting/api/casting/mishaps/MishapBadBrainsweep.kt index 59a441eb..cb8e7463 100644 --- a/Common/src/main/java/at/petrak/hexcasting/api/casting/mishaps/MishapBadBrainsweep.kt +++ b/Common/src/main/java/at/petrak/hexcasting/api/casting/mishaps/MishapBadBrainsweep.kt @@ -3,7 +3,7 @@ package at.petrak.hexcasting.api.casting.mishaps import at.petrak.hexcasting.api.misc.FrozenColorizer import at.petrak.hexcasting.api.misc.HexDamageSources import at.petrak.hexcasting.api.casting.ParticleSpray -import at.petrak.hexcasting.api.casting.eval.CastingContext +import at.petrak.hexcasting.api.casting.eval.CastingEnvironment import at.petrak.hexcasting.api.casting.iota.Iota import net.minecraft.core.BlockPos import net.minecraft.world.entity.Mob @@ -11,17 +11,17 @@ import net.minecraft.world.item.DyeColor import net.minecraft.world.phys.Vec3 class MishapBadBrainsweep(val mob: Mob, val pos: BlockPos) : Mishap() { - override fun accentColor(ctx: CastingContext, errorCtx: Context): FrozenColorizer = + override fun accentColor(ctx: CastingEnvironment, errorCtx: Context): FrozenColorizer = dyeColor(DyeColor.GREEN) - override fun execute(ctx: CastingContext, errorCtx: Context, stack: MutableList) { + override fun execute(ctx: CastingEnvironment, errorCtx: Context, stack: MutableList) { trulyHurt(mob, HexDamageSources.overcastDamageFrom(ctx.caster), mob.health) } - override fun particleSpray(ctx: CastingContext): ParticleSpray { + override fun particleSpray(ctx: CastingEnvironment): ParticleSpray { return ParticleSpray.burst(Vec3.atCenterOf(pos), 1.0) } - override fun errorMessage(ctx: CastingContext, errorCtx: Context) = + override fun errorMessage(ctx: CastingEnvironment, errorCtx: Context) = error("bad_brainsweep", blockAtPos(ctx, this.pos)) } diff --git a/Common/src/main/java/at/petrak/hexcasting/api/casting/mishaps/MishapBadEntity.kt b/Common/src/main/java/at/petrak/hexcasting/api/casting/mishaps/MishapBadEntity.kt index 2a5be33a..143be43e 100644 --- a/Common/src/main/java/at/petrak/hexcasting/api/casting/mishaps/MishapBadEntity.kt +++ b/Common/src/main/java/at/petrak/hexcasting/api/casting/mishaps/MishapBadEntity.kt @@ -1,6 +1,6 @@ package at.petrak.hexcasting.api.casting.mishaps -import at.petrak.hexcasting.api.casting.eval.CastingContext +import at.petrak.hexcasting.api.casting.eval.CastingEnvironment import at.petrak.hexcasting.api.casting.iota.Iota import at.petrak.hexcasting.api.misc.FrozenColorizer import at.petrak.hexcasting.api.utils.aqua @@ -11,14 +11,14 @@ import net.minecraft.world.entity.item.ItemEntity import net.minecraft.world.item.DyeColor class MishapBadEntity(val entity: Entity, val wanted: Component) : Mishap() { - override fun accentColor(ctx: CastingContext, errorCtx: Context): FrozenColorizer = + override fun accentColor(ctx: CastingEnvironment, errorCtx: Context): FrozenColorizer = dyeColor(DyeColor.BROWN) - override fun execute(ctx: CastingContext, errorCtx: Context, stack: MutableList) { + override fun execute(ctx: CastingEnvironment, errorCtx: Context, stack: MutableList) { yeetHeldItemsTowards(ctx, entity.position()) } - override fun errorMessage(ctx: CastingContext, errorCtx: Context) = + override fun errorMessage(ctx: CastingEnvironment, errorCtx: Context) = error("bad_entity", wanted, entity.displayName.plainCopy().aqua) companion object { diff --git a/Common/src/main/java/at/petrak/hexcasting/api/casting/mishaps/MishapBadItem.kt b/Common/src/main/java/at/petrak/hexcasting/api/casting/mishaps/MishapBadItem.kt index e2b13656..44a74fa9 100644 --- a/Common/src/main/java/at/petrak/hexcasting/api/casting/mishaps/MishapBadItem.kt +++ b/Common/src/main/java/at/petrak/hexcasting/api/casting/mishaps/MishapBadItem.kt @@ -1,6 +1,6 @@ package at.petrak.hexcasting.api.casting.mishaps -import at.petrak.hexcasting.api.casting.eval.CastingContext +import at.petrak.hexcasting.api.casting.eval.CastingEnvironment import at.petrak.hexcasting.api.casting.iota.Iota import at.petrak.hexcasting.api.misc.FrozenColorizer import at.petrak.hexcasting.api.utils.asTranslatedComponent @@ -9,14 +9,14 @@ import net.minecraft.world.entity.item.ItemEntity import net.minecraft.world.item.DyeColor class MishapBadItem(val item: ItemEntity, val wanted: Component) : Mishap() { - override fun accentColor(ctx: CastingContext, errorCtx: Context): FrozenColorizer = + override fun accentColor(ctx: CastingEnvironment, errorCtx: Context): FrozenColorizer = dyeColor(DyeColor.BROWN) - override fun execute(ctx: CastingContext, errorCtx: Context, stack: MutableList) { + override fun execute(ctx: CastingEnvironment, errorCtx: Context, stack: MutableList) { item.deltaMovement = item.deltaMovement.add((Math.random() - 0.5) * 0.05, 0.75, (Math.random() - 0.5) * 0.05) } - override fun errorMessage(ctx: CastingContext, errorCtx: Context) = if (item.item.isEmpty) + override fun errorMessage(ctx: CastingEnvironment, errorCtx: Context) = if (item.item.isEmpty) error("no_item", wanted) else error("bad_item", wanted, item.item.count, item.item.displayName) diff --git a/Common/src/main/java/at/petrak/hexcasting/api/casting/mishaps/MishapBadOffhandItem.kt b/Common/src/main/java/at/petrak/hexcasting/api/casting/mishaps/MishapBadOffhandItem.kt index 82633c99..afda2de1 100644 --- a/Common/src/main/java/at/petrak/hexcasting/api/casting/mishaps/MishapBadOffhandItem.kt +++ b/Common/src/main/java/at/petrak/hexcasting/api/casting/mishaps/MishapBadOffhandItem.kt @@ -1,6 +1,6 @@ package at.petrak.hexcasting.api.casting.mishaps -import at.petrak.hexcasting.api.casting.eval.CastingContext +import at.petrak.hexcasting.api.casting.eval.CastingEnvironment import at.petrak.hexcasting.api.casting.iota.Iota import at.petrak.hexcasting.api.misc.FrozenColorizer import at.petrak.hexcasting.api.utils.asTranslatedComponent @@ -10,14 +10,14 @@ import net.minecraft.world.item.DyeColor import net.minecraft.world.item.ItemStack class MishapBadOffhandItem(val item: ItemStack, val hand: InteractionHand, val wanted: Component) : Mishap() { - override fun accentColor(ctx: CastingContext, errorCtx: Context): FrozenColorizer = + override fun accentColor(ctx: CastingEnvironment, errorCtx: Context): FrozenColorizer = dyeColor(DyeColor.BROWN) - override fun execute(ctx: CastingContext, errorCtx: Context, stack: MutableList) { + override fun execute(ctx: CastingEnvironment, errorCtx: Context, stack: MutableList) { yeetHeldItem(ctx, hand) } - override fun errorMessage(ctx: CastingContext, errorCtx: Context) = if (item.isEmpty) + override fun errorMessage(ctx: CastingEnvironment, errorCtx: Context) = if (item.isEmpty) error("no_item.offhand", wanted) else error("bad_item.offhand", wanted, item.count, item.displayName) diff --git a/Common/src/main/java/at/petrak/hexcasting/api/casting/mishaps/MishapDisallowedSpell.kt b/Common/src/main/java/at/petrak/hexcasting/api/casting/mishaps/MishapDisallowedSpell.kt index d040d1b8..a4cb2af6 100644 --- a/Common/src/main/java/at/petrak/hexcasting/api/casting/mishaps/MishapDisallowedSpell.kt +++ b/Common/src/main/java/at/petrak/hexcasting/api/casting/mishaps/MishapDisallowedSpell.kt @@ -1,21 +1,21 @@ package at.petrak.hexcasting.api.casting.mishaps -import at.petrak.hexcasting.api.casting.eval.CastingContext +import at.petrak.hexcasting.api.casting.eval.CastingEnvironment import at.petrak.hexcasting.api.casting.eval.ResolvedPatternType import at.petrak.hexcasting.api.casting.iota.Iota import at.petrak.hexcasting.api.misc.FrozenColorizer import net.minecraft.world.item.DyeColor class MishapDisallowedSpell(val type: String = "disallowed") : Mishap() { - override fun accentColor(ctx: CastingContext, errorCtx: Context): FrozenColorizer = + override fun accentColor(ctx: CastingEnvironment, errorCtx: Context): FrozenColorizer = dyeColor(DyeColor.BLACK) - override fun resolutionType(ctx: CastingContext) = ResolvedPatternType.INVALID + override fun resolutionType(ctx: CastingEnvironment) = ResolvedPatternType.INVALID - override fun execute(ctx: CastingContext, errorCtx: Context, stack: MutableList) { + override fun execute(ctx: CastingEnvironment, errorCtx: Context, stack: MutableList) { // NO-OP } - override fun errorMessage(ctx: CastingContext, errorCtx: Context) = + override fun errorMessage(ctx: CastingEnvironment, errorCtx: Context) = error(type) } diff --git a/Common/src/main/java/at/petrak/hexcasting/api/casting/mishaps/MishapDivideByZero.kt b/Common/src/main/java/at/petrak/hexcasting/api/casting/mishaps/MishapDivideByZero.kt index 6915184e..8d99eb3b 100644 --- a/Common/src/main/java/at/petrak/hexcasting/api/casting/mishaps/MishapDivideByZero.kt +++ b/Common/src/main/java/at/petrak/hexcasting/api/casting/mishaps/MishapDivideByZero.kt @@ -2,7 +2,7 @@ package at.petrak.hexcasting.api.casting.mishaps import at.petrak.hexcasting.api.misc.FrozenColorizer import at.petrak.hexcasting.api.misc.HexDamageSources -import at.petrak.hexcasting.api.casting.eval.CastingContext +import at.petrak.hexcasting.api.casting.eval.CastingEnvironment import at.petrak.hexcasting.api.casting.iota.DoubleIota import at.petrak.hexcasting.api.casting.iota.GarbageIota import at.petrak.hexcasting.api.casting.iota.Iota @@ -14,15 +14,15 @@ import net.minecraft.world.phys.Vec3 class MishapDivideByZero(val operand1: Component, val operand2: Component, val suffix: String = "divide") : Mishap() { - override fun accentColor(ctx: CastingContext, errorCtx: Context): FrozenColorizer = + override fun accentColor(ctx: CastingEnvironment, errorCtx: Context): FrozenColorizer = dyeColor(DyeColor.RED) - override fun execute(ctx: CastingContext, errorCtx: Context, stack: MutableList) { + override fun execute(ctx: CastingEnvironment, errorCtx: Context, stack: MutableList) { stack.add(GarbageIota()) trulyHurt(ctx.caster, HexDamageSources.OVERCAST, ctx.caster.health / 2) } - override fun errorMessage(ctx: CastingContext, errorCtx: Context) = + override fun errorMessage(ctx: CastingEnvironment, errorCtx: Context) = error("divide_by_zero.$suffix", operand1, operand2) companion object { diff --git a/Common/src/main/java/at/petrak/hexcasting/api/casting/mishaps/MishapEntityTooFarAway.kt b/Common/src/main/java/at/petrak/hexcasting/api/casting/mishaps/MishapEntityTooFarAway.kt index d7000a83..37cc1e98 100644 --- a/Common/src/main/java/at/petrak/hexcasting/api/casting/mishaps/MishapEntityTooFarAway.kt +++ b/Common/src/main/java/at/petrak/hexcasting/api/casting/mishaps/MishapEntityTooFarAway.kt @@ -1,6 +1,6 @@ package at.petrak.hexcasting.api.casting.mishaps -import at.petrak.hexcasting.api.casting.eval.CastingContext +import at.petrak.hexcasting.api.casting.eval.CastingEnvironment import at.petrak.hexcasting.api.casting.iota.Iota import at.petrak.hexcasting.api.misc.FrozenColorizer import net.minecraft.network.chat.Component @@ -8,14 +8,14 @@ import net.minecraft.world.entity.Entity import net.minecraft.world.item.DyeColor class MishapEntityTooFarAway(val entity: Entity) : Mishap() { - override fun accentColor(ctx: CastingContext, errorCtx: Context): FrozenColorizer = + override fun accentColor(ctx: CastingEnvironment, errorCtx: Context): FrozenColorizer = dyeColor(DyeColor.PINK) - override fun execute(ctx: CastingContext, errorCtx: Context, stack: MutableList) { + override fun execute(ctx: CastingEnvironment, errorCtx: Context, stack: MutableList) { // Knock the player's items out of their hands yeetHeldItemsTowards(ctx, entity.position()) } - override fun errorMessage(ctx: CastingContext, errorCtx: Context): Component = + override fun errorMessage(ctx: CastingEnvironment, errorCtx: Context): Component = error("entity_too_far", entity.displayName) } diff --git a/Common/src/main/java/at/petrak/hexcasting/api/casting/mishaps/MishapError.kt b/Common/src/main/java/at/petrak/hexcasting/api/casting/mishaps/MishapError.kt index c9ae9491..8a5cec36 100644 --- a/Common/src/main/java/at/petrak/hexcasting/api/casting/mishaps/MishapError.kt +++ b/Common/src/main/java/at/petrak/hexcasting/api/casting/mishaps/MishapError.kt @@ -1,18 +1,18 @@ package at.petrak.hexcasting.api.casting.mishaps -import at.petrak.hexcasting.api.casting.eval.CastingContext +import at.petrak.hexcasting.api.casting.eval.CastingEnvironment import at.petrak.hexcasting.api.casting.iota.Iota import at.petrak.hexcasting.api.misc.FrozenColorizer import net.minecraft.world.item.DyeColor class MishapError(val exception: Exception) : Mishap() { - override fun accentColor(ctx: CastingContext, errorCtx: Context): FrozenColorizer = + override fun accentColor(ctx: CastingEnvironment, errorCtx: Context): FrozenColorizer = dyeColor(DyeColor.BLACK) - override fun execute(ctx: CastingContext, errorCtx: Context, stack: MutableList) { + override fun execute(ctx: CastingEnvironment, errorCtx: Context, stack: MutableList) { // NO-OP } - override fun errorMessage(ctx: CastingContext, errorCtx: Context) = + override fun errorMessage(ctx: CastingEnvironment, errorCtx: Context) = error("unknown", exception) } diff --git a/Common/src/main/java/at/petrak/hexcasting/api/casting/mishaps/MishapEvalTooDeep.kt b/Common/src/main/java/at/petrak/hexcasting/api/casting/mishaps/MishapEvalTooDeep.kt index b9aefc0c..b773a235 100644 --- a/Common/src/main/java/at/petrak/hexcasting/api/casting/mishaps/MishapEvalTooDeep.kt +++ b/Common/src/main/java/at/petrak/hexcasting/api/casting/mishaps/MishapEvalTooDeep.kt @@ -2,17 +2,17 @@ package at.petrak.hexcasting.api.casting.mishaps import at.petrak.hexcasting.api.misc.FrozenColorizer import at.petrak.hexcasting.api.casting.iota.Iota -import at.petrak.hexcasting.api.casting.eval.CastingContext +import at.petrak.hexcasting.api.casting.eval.CastingEnvironment import net.minecraft.world.item.DyeColor class MishapEvalTooDeep : Mishap() { - override fun accentColor(ctx: CastingContext, errorCtx: Context): FrozenColorizer = + override fun accentColor(ctx: CastingEnvironment, errorCtx: Context): FrozenColorizer = dyeColor(DyeColor.BLUE) - override fun execute(ctx: CastingContext, errorCtx: Context, stack: MutableList) { + override fun execute(ctx: CastingEnvironment, errorCtx: Context, stack: MutableList) { ctx.caster.airSupply -= 290 } - override fun errorMessage(ctx: CastingContext, errorCtx: Context) = + override fun errorMessage(ctx: CastingEnvironment, errorCtx: Context) = error("eval_too_deep") } diff --git a/Common/src/main/java/at/petrak/hexcasting/api/casting/mishaps/MishapImmuneEntity.kt b/Common/src/main/java/at/petrak/hexcasting/api/casting/mishaps/MishapImmuneEntity.kt index 07182411..4065d505 100644 --- a/Common/src/main/java/at/petrak/hexcasting/api/casting/mishaps/MishapImmuneEntity.kt +++ b/Common/src/main/java/at/petrak/hexcasting/api/casting/mishaps/MishapImmuneEntity.kt @@ -1,6 +1,6 @@ package at.petrak.hexcasting.api.casting.mishaps -import at.petrak.hexcasting.api.casting.eval.CastingContext +import at.petrak.hexcasting.api.casting.eval.CastingEnvironment import at.petrak.hexcasting.api.casting.iota.Iota import at.petrak.hexcasting.api.misc.FrozenColorizer import at.petrak.hexcasting.api.utils.aqua @@ -8,13 +8,13 @@ import net.minecraft.world.entity.Entity import net.minecraft.world.item.DyeColor class MishapImmuneEntity(val entity: Entity) : Mishap() { - override fun accentColor(ctx: CastingContext, errorCtx: Context): FrozenColorizer = + override fun accentColor(ctx: CastingEnvironment, errorCtx: Context): FrozenColorizer = dyeColor(DyeColor.BLUE) - override fun execute(ctx: CastingContext, errorCtx: Context, stack: MutableList) { + override fun execute(ctx: CastingEnvironment, errorCtx: Context, stack: MutableList) { yeetHeldItemsTowards(ctx, entity.position()) } - override fun errorMessage(ctx: CastingContext, errorCtx: Context) = + override fun errorMessage(ctx: CastingEnvironment, errorCtx: Context) = error("immune_entity", entity.displayName.plainCopy().aqua) } diff --git a/Common/src/main/java/at/petrak/hexcasting/api/casting/mishaps/MishapInvalidIota.kt b/Common/src/main/java/at/petrak/hexcasting/api/casting/mishaps/MishapInvalidIota.kt index a1a555f0..adaddfdd 100644 --- a/Common/src/main/java/at/petrak/hexcasting/api/casting/mishaps/MishapInvalidIota.kt +++ b/Common/src/main/java/at/petrak/hexcasting/api/casting/mishaps/MishapInvalidIota.kt @@ -1,6 +1,6 @@ package at.petrak.hexcasting.api.casting.mishaps -import at.petrak.hexcasting.api.casting.eval.CastingContext +import at.petrak.hexcasting.api.casting.eval.CastingEnvironment import at.petrak.hexcasting.api.casting.iota.GarbageIota import at.petrak.hexcasting.api.casting.iota.Iota import at.petrak.hexcasting.api.misc.FrozenColorizer @@ -18,14 +18,14 @@ class MishapInvalidIota( val reverseIdx: Int, val expected: Component ) : Mishap() { - override fun accentColor(ctx: CastingContext, errorCtx: Context): FrozenColorizer = + override fun accentColor(ctx: CastingEnvironment, errorCtx: Context): FrozenColorizer = dyeColor(DyeColor.GRAY) - override fun execute(ctx: CastingContext, errorCtx: Context, stack: MutableList) { + override fun execute(ctx: CastingEnvironment, errorCtx: Context, stack: MutableList) { stack[stack.size - 1 - reverseIdx] = GarbageIota(); } - override fun errorMessage(ctx: CastingContext, errorCtx: Context) = + override fun errorMessage(ctx: CastingEnvironment, errorCtx: Context) = error( "invalid_value", expected, reverseIdx, perpetrator.display() diff --git a/Common/src/main/java/at/petrak/hexcasting/api/casting/mishaps/MishapInvalidPattern.kt b/Common/src/main/java/at/petrak/hexcasting/api/casting/mishaps/MishapInvalidPattern.kt index 8a2ff5ee..242247e1 100644 --- a/Common/src/main/java/at/petrak/hexcasting/api/casting/mishaps/MishapInvalidPattern.kt +++ b/Common/src/main/java/at/petrak/hexcasting/api/casting/mishaps/MishapInvalidPattern.kt @@ -1,22 +1,22 @@ package at.petrak.hexcasting.api.casting.mishaps import at.petrak.hexcasting.api.misc.FrozenColorizer -import at.petrak.hexcasting.api.casting.eval.CastingContext +import at.petrak.hexcasting.api.casting.eval.CastingEnvironment import at.petrak.hexcasting.api.casting.eval.ResolvedPatternType import at.petrak.hexcasting.api.casting.iota.GarbageIota import at.petrak.hexcasting.api.casting.iota.Iota import net.minecraft.world.item.DyeColor class MishapInvalidPattern : Mishap() { - override fun accentColor(ctx: CastingContext, errorCtx: Context): FrozenColorizer = + override fun accentColor(ctx: CastingEnvironment, errorCtx: Context): FrozenColorizer = dyeColor(DyeColor.YELLOW) - override fun resolutionType(ctx: CastingContext) = ResolvedPatternType.INVALID + override fun resolutionType(ctx: CastingEnvironment) = ResolvedPatternType.INVALID - override fun execute(ctx: CastingContext, errorCtx: Context, stack: MutableList) { + override fun execute(ctx: CastingEnvironment, errorCtx: Context, stack: MutableList) { stack.add(GarbageIota()) } - override fun errorMessage(ctx: CastingContext, errorCtx: Context) = + override fun errorMessage(ctx: CastingEnvironment, errorCtx: Context) = error("invalid_pattern") } diff --git a/Common/src/main/java/at/petrak/hexcasting/api/casting/mishaps/MishapInvalidSpellDatumType.kt b/Common/src/main/java/at/petrak/hexcasting/api/casting/mishaps/MishapInvalidSpellDatumType.kt index 721ccdfd..a4b743df 100644 --- a/Common/src/main/java/at/petrak/hexcasting/api/casting/mishaps/MishapInvalidSpellDatumType.kt +++ b/Common/src/main/java/at/petrak/hexcasting/api/casting/mishaps/MishapInvalidSpellDatumType.kt @@ -2,20 +2,20 @@ package at.petrak.hexcasting.api.casting.mishaps import at.petrak.hexcasting.api.misc.FrozenColorizer import at.petrak.hexcasting.api.casting.iota.Iota -import at.petrak.hexcasting.api.casting.eval.CastingContext +import at.petrak.hexcasting.api.casting.eval.CastingEnvironment import net.minecraft.world.item.DyeColor /** * this is bad */ class MishapInvalidSpellDatumType(val perpetrator: Any) : Mishap() { - override fun accentColor(ctx: CastingContext, errorCtx: Context): FrozenColorizer = + override fun accentColor(ctx: CastingEnvironment, errorCtx: Context): FrozenColorizer = dyeColor(DyeColor.BLACK) - override fun execute(ctx: CastingContext, errorCtx: Context, stack: MutableList) { + override fun execute(ctx: CastingEnvironment, errorCtx: Context, stack: MutableList) { // NO-OP } - override fun errorMessage(ctx: CastingContext, errorCtx: Context) = + override fun errorMessage(ctx: CastingEnvironment, errorCtx: Context) = error("invalid_spell_datum_type", this.perpetrator.toString(), this.perpetrator.javaClass.typeName) } diff --git a/Common/src/main/java/at/petrak/hexcasting/api/casting/mishaps/MishapLocationInWrongDimension.kt b/Common/src/main/java/at/petrak/hexcasting/api/casting/mishaps/MishapLocationInWrongDimension.kt index 2afd9c1b..aeb7a933 100644 --- a/Common/src/main/java/at/petrak/hexcasting/api/casting/mishaps/MishapLocationInWrongDimension.kt +++ b/Common/src/main/java/at/petrak/hexcasting/api/casting/mishaps/MishapLocationInWrongDimension.kt @@ -1,6 +1,6 @@ package at.petrak.hexcasting.api.casting.mishaps -import at.petrak.hexcasting.api.casting.eval.CastingContext +import at.petrak.hexcasting.api.casting.eval.CastingEnvironment import at.petrak.hexcasting.api.casting.iota.GarbageIota import at.petrak.hexcasting.api.casting.iota.Iota import at.petrak.hexcasting.api.misc.FrozenColorizer @@ -9,14 +9,14 @@ import net.minecraft.resources.ResourceLocation import net.minecraft.world.item.DyeColor class MishapLocationInWrongDimension(val properDimension: ResourceLocation) : Mishap() { - override fun accentColor(ctx: CastingContext, errorCtx: Context): FrozenColorizer = + override fun accentColor(ctx: CastingEnvironment, errorCtx: Context): FrozenColorizer = dyeColor(DyeColor.MAGENTA) - override fun execute(ctx: CastingContext, errorCtx: Context, stack: MutableList) { + override fun execute(ctx: CastingEnvironment, errorCtx: Context, stack: MutableList) { stack.add(GarbageIota()) } - override fun errorMessage(ctx: CastingContext, errorCtx: Context): Component = + override fun errorMessage(ctx: CastingEnvironment, errorCtx: Context): Component = error( "wrong_dimension", properDimension.toString(), ctx.world.dimension().location().toString() diff --git a/Common/src/main/java/at/petrak/hexcasting/api/casting/mishaps/MishapLocationTooFarAway.kt b/Common/src/main/java/at/petrak/hexcasting/api/casting/mishaps/MishapLocationTooFarAway.kt index 84dcd915..5869754a 100644 --- a/Common/src/main/java/at/petrak/hexcasting/api/casting/mishaps/MishapLocationTooFarAway.kt +++ b/Common/src/main/java/at/petrak/hexcasting/api/casting/mishaps/MishapLocationTooFarAway.kt @@ -1,6 +1,6 @@ package at.petrak.hexcasting.api.casting.mishaps -import at.petrak.hexcasting.api.casting.eval.CastingContext +import at.petrak.hexcasting.api.casting.eval.CastingEnvironment import at.petrak.hexcasting.api.casting.iota.Iota import at.petrak.hexcasting.api.casting.iota.Vec3Iota import at.petrak.hexcasting.api.misc.FrozenColorizer @@ -9,13 +9,13 @@ import net.minecraft.world.item.DyeColor import net.minecraft.world.phys.Vec3 class MishapLocationTooFarAway(val location: Vec3, val type: String = "too_far") : Mishap() { - override fun accentColor(ctx: CastingContext, errorCtx: Context): FrozenColorizer = + override fun accentColor(ctx: CastingEnvironment, errorCtx: Context): FrozenColorizer = dyeColor(DyeColor.MAGENTA) - override fun execute(ctx: CastingContext, errorCtx: Context, stack: MutableList) { + override fun execute(ctx: CastingEnvironment, errorCtx: Context, stack: MutableList) { yeetHeldItemsTowards(ctx, location) } - override fun errorMessage(ctx: CastingContext, errorCtx: Context): Component = + override fun errorMessage(ctx: CastingEnvironment, errorCtx: Context): Component = error("location_$type", Vec3Iota.display(location)) } diff --git a/Common/src/main/java/at/petrak/hexcasting/api/casting/mishaps/MishapNoAkashicRecord.kt b/Common/src/main/java/at/petrak/hexcasting/api/casting/mishaps/MishapNoAkashicRecord.kt index 01aecb8d..f48ec9f8 100644 --- a/Common/src/main/java/at/petrak/hexcasting/api/casting/mishaps/MishapNoAkashicRecord.kt +++ b/Common/src/main/java/at/petrak/hexcasting/api/casting/mishaps/MishapNoAkashicRecord.kt @@ -2,18 +2,18 @@ package at.petrak.hexcasting.api.casting.mishaps import at.petrak.hexcasting.api.misc.FrozenColorizer import at.petrak.hexcasting.api.casting.iota.Iota -import at.petrak.hexcasting.api.casting.eval.CastingContext +import at.petrak.hexcasting.api.casting.eval.CastingEnvironment import net.minecraft.core.BlockPos import net.minecraft.world.item.DyeColor class MishapNoAkashicRecord(val pos: BlockPos) : Mishap() { - override fun accentColor(ctx: CastingContext, errorCtx: Context): FrozenColorizer = + override fun accentColor(ctx: CastingEnvironment, errorCtx: Context): FrozenColorizer = dyeColor(DyeColor.PURPLE) - override fun execute(ctx: CastingContext, errorCtx: Context, stack: MutableList) { + override fun execute(ctx: CastingEnvironment, errorCtx: Context, stack: MutableList) { ctx.caster.giveExperiencePoints(-100) } - override fun errorMessage(ctx: CastingContext, errorCtx: Context) = + override fun errorMessage(ctx: CastingEnvironment, errorCtx: Context) = error("no_akashic_record", pos.toShortString()) } diff --git a/Common/src/main/java/at/petrak/hexcasting/api/casting/mishaps/MishapNoSpellCircle.kt b/Common/src/main/java/at/petrak/hexcasting/api/casting/mishaps/MishapNoSpellCircle.kt index 989a4dc3..db6bfe57 100644 --- a/Common/src/main/java/at/petrak/hexcasting/api/casting/mishaps/MishapNoSpellCircle.kt +++ b/Common/src/main/java/at/petrak/hexcasting/api/casting/mishaps/MishapNoSpellCircle.kt @@ -1,6 +1,6 @@ package at.petrak.hexcasting.api.casting.mishaps -import at.petrak.hexcasting.api.casting.eval.CastingContext +import at.petrak.hexcasting.api.casting.eval.CastingEnvironment import at.petrak.hexcasting.api.casting.iota.Iota import at.petrak.hexcasting.api.misc.FrozenColorizer import net.minecraft.world.entity.player.Player @@ -9,7 +9,7 @@ import net.minecraft.world.item.ItemStack import net.minecraft.world.item.enchantment.EnchantmentHelper class MishapNoSpellCircle : Mishap() { - override fun accentColor(ctx: CastingContext, errorCtx: Context): FrozenColorizer = + override fun accentColor(ctx: CastingEnvironment, errorCtx: Context): FrozenColorizer = dyeColor(DyeColor.LIGHT_BLUE) private inline fun dropAll(player: Player, stacks: MutableList, filter: (ItemStack) -> Boolean = { true }) { @@ -22,7 +22,7 @@ class MishapNoSpellCircle : Mishap() { } } - override fun execute(ctx: CastingContext, errorCtx: Context, stack: MutableList) { + override fun execute(ctx: CastingEnvironment, errorCtx: Context, stack: MutableList) { dropAll(ctx.caster, ctx.caster.inventory.items) dropAll(ctx.caster, ctx.caster.inventory.offhand) dropAll(ctx.caster, ctx.caster.inventory.armor) { @@ -30,6 +30,6 @@ class MishapNoSpellCircle : Mishap() { } } - override fun errorMessage(ctx: CastingContext, errorCtx: Context) = + override fun errorMessage(ctx: CastingEnvironment, errorCtx: Context) = error("no_spell_circle") } diff --git a/Common/src/main/java/at/petrak/hexcasting/api/casting/mishaps/MishapNotEnoughArgs.kt b/Common/src/main/java/at/petrak/hexcasting/api/casting/mishaps/MishapNotEnoughArgs.kt index b02ab738..aa7b7e06 100644 --- a/Common/src/main/java/at/petrak/hexcasting/api/casting/mishaps/MishapNotEnoughArgs.kt +++ b/Common/src/main/java/at/petrak/hexcasting/api/casting/mishaps/MishapNotEnoughArgs.kt @@ -1,20 +1,20 @@ package at.petrak.hexcasting.api.casting.mishaps -import at.petrak.hexcasting.api.casting.eval.CastingContext +import at.petrak.hexcasting.api.casting.eval.CastingEnvironment import at.petrak.hexcasting.api.casting.iota.GarbageIota import at.petrak.hexcasting.api.casting.iota.Iota import at.petrak.hexcasting.api.misc.FrozenColorizer import net.minecraft.world.item.DyeColor class MishapNotEnoughArgs(val expected: Int, val got: Int) : Mishap() { - override fun accentColor(ctx: CastingContext, errorCtx: Context): FrozenColorizer = + override fun accentColor(ctx: CastingEnvironment, errorCtx: Context): FrozenColorizer = dyeColor(DyeColor.LIGHT_GRAY) - override fun execute(ctx: CastingContext, errorCtx: Context, stack: MutableList) { + override fun execute(ctx: CastingEnvironment, errorCtx: Context, stack: MutableList) { repeat(expected - got) { stack.add(GarbageIota()) } } - override fun errorMessage(ctx: CastingContext, errorCtx: Context) = + override fun errorMessage(ctx: CastingEnvironment, errorCtx: Context) = if (got == 0) error("no_args", expected) else diff --git a/Common/src/main/java/at/petrak/hexcasting/api/casting/mishaps/MishapOthersName.kt b/Common/src/main/java/at/petrak/hexcasting/api/casting/mishaps/MishapOthersName.kt index 1b313a49..b7c0cdd5 100644 --- a/Common/src/main/java/at/petrak/hexcasting/api/casting/mishaps/MishapOthersName.kt +++ b/Common/src/main/java/at/petrak/hexcasting/api/casting/mishaps/MishapOthersName.kt @@ -1,7 +1,7 @@ package at.petrak.hexcasting.api.casting.mishaps import at.petrak.hexcasting.api.misc.FrozenColorizer -import at.petrak.hexcasting.api.casting.eval.CastingContext +import at.petrak.hexcasting.api.casting.eval.CastingEnvironment import at.petrak.hexcasting.api.casting.iota.EntityIota import at.petrak.hexcasting.api.casting.iota.Iota import at.petrak.hexcasting.api.casting.iota.ListIota @@ -14,15 +14,15 @@ import net.minecraft.world.item.DyeColor * Also throwable for your *own* name, for cases like Chronicler's Gambit */ class MishapOthersName(val confidant: Player) : Mishap() { - override fun accentColor(ctx: CastingContext, errorCtx: Context): FrozenColorizer = + override fun accentColor(ctx: CastingEnvironment, errorCtx: Context): FrozenColorizer = dyeColor(DyeColor.BLACK) - override fun execute(ctx: CastingContext, errorCtx: Context, stack: MutableList) { + override fun execute(ctx: CastingEnvironment, errorCtx: Context, stack: MutableList) { val seconds = if (this.confidant == ctx.caster) 5 else 60; ctx.caster.addEffect(MobEffectInstance(MobEffects.BLINDNESS, seconds * 20)) } - override fun errorMessage(ctx: CastingContext, errorCtx: Context) = + override fun errorMessage(ctx: CastingEnvironment, errorCtx: Context) = if (this.confidant == ctx.caster) error("others_name.self") else diff --git a/Common/src/main/java/at/petrak/hexcasting/api/casting/mishaps/MishapShameOnYou.kt b/Common/src/main/java/at/petrak/hexcasting/api/casting/mishaps/MishapShameOnYou.kt index d624c1c9..1eaf2144 100644 --- a/Common/src/main/java/at/petrak/hexcasting/api/casting/mishaps/MishapShameOnYou.kt +++ b/Common/src/main/java/at/petrak/hexcasting/api/casting/mishaps/MishapShameOnYou.kt @@ -2,17 +2,17 @@ package at.petrak.hexcasting.api.casting.mishaps import at.petrak.hexcasting.api.misc.FrozenColorizer import at.petrak.hexcasting.api.misc.HexDamageSources -import at.petrak.hexcasting.api.casting.eval.CastingContext +import at.petrak.hexcasting.api.casting.eval.CastingEnvironment import at.petrak.hexcasting.api.casting.iota.Iota import net.minecraft.world.item.DyeColor class MishapShameOnYou() : Mishap() { - override fun accentColor(ctx: CastingContext, errorCtx: Context): FrozenColorizer = + override fun accentColor(ctx: CastingEnvironment, errorCtx: Context): FrozenColorizer = dyeColor(DyeColor.BLACK) - override fun execute(ctx: CastingContext, errorCtx: Context, stack: MutableList) { + override fun execute(ctx: CastingEnvironment, errorCtx: Context, stack: MutableList) { Mishap.trulyHurt(ctx.caster, HexDamageSources.SHAME, 69420f) } - override fun errorMessage(ctx: CastingContext, errorCtx: Context) = error("shame") + override fun errorMessage(ctx: CastingEnvironment, errorCtx: Context) = error("shame") } diff --git a/Common/src/main/java/at/petrak/hexcasting/api/casting/mishaps/MishapTooManyCloseParens.kt b/Common/src/main/java/at/petrak/hexcasting/api/casting/mishaps/MishapTooManyCloseParens.kt index 568a0d2f..f3a9ada7 100644 --- a/Common/src/main/java/at/petrak/hexcasting/api/casting/mishaps/MishapTooManyCloseParens.kt +++ b/Common/src/main/java/at/petrak/hexcasting/api/casting/mishaps/MishapTooManyCloseParens.kt @@ -1,20 +1,20 @@ package at.petrak.hexcasting.api.casting.mishaps import at.petrak.hexcasting.api.misc.FrozenColorizer -import at.petrak.hexcasting.api.casting.eval.CastingContext +import at.petrak.hexcasting.api.casting.eval.CastingEnvironment import at.petrak.hexcasting.api.casting.iota.Iota import at.petrak.hexcasting.api.casting.iota.PatternIota import net.minecraft.world.item.DyeColor class MishapTooManyCloseParens : Mishap() { - override fun accentColor(ctx: CastingContext, errorCtx: Context): FrozenColorizer = + override fun accentColor(ctx: CastingEnvironment, errorCtx: Context): FrozenColorizer = dyeColor(DyeColor.ORANGE) - override fun execute(ctx: CastingContext, errorCtx: Context, stack: MutableList) { + override fun execute(ctx: CastingEnvironment, errorCtx: Context, stack: MutableList) { // TODO this is a kinda shitty mishap stack.add(PatternIota(errorCtx.pattern)) } - override fun errorMessage(ctx: CastingContext, errorCtx: Context) = + override fun errorMessage(ctx: CastingEnvironment, errorCtx: Context) = error("too_many_close_parens") } diff --git a/Common/src/main/java/at/petrak/hexcasting/api/casting/mishaps/MishapUnescapedValue.kt b/Common/src/main/java/at/petrak/hexcasting/api/casting/mishaps/MishapUnescapedValue.kt index 318b784f..bc9cec5e 100644 --- a/Common/src/main/java/at/petrak/hexcasting/api/casting/mishaps/MishapUnescapedValue.kt +++ b/Common/src/main/java/at/petrak/hexcasting/api/casting/mishaps/MishapUnescapedValue.kt @@ -2,7 +2,7 @@ package at.petrak.hexcasting.api.casting.mishaps import at.petrak.hexcasting.api.misc.FrozenColorizer import at.petrak.hexcasting.api.casting.iota.Iota -import at.petrak.hexcasting.api.casting.eval.CastingContext +import at.petrak.hexcasting.api.casting.eval.CastingEnvironment import net.minecraft.world.item.DyeColor /** @@ -11,10 +11,10 @@ import net.minecraft.world.item.DyeColor class MishapUnescapedValue( val perpetrator: Iota ) : Mishap() { - override fun accentColor(ctx: CastingContext, errorCtx: Context): FrozenColorizer = + override fun accentColor(ctx: CastingEnvironment, errorCtx: Context): FrozenColorizer = dyeColor(DyeColor.GRAY) - override fun execute(ctx: CastingContext, errorCtx: Context, stack: MutableList) { + override fun execute(ctx: CastingEnvironment, errorCtx: Context, stack: MutableList) { // TODO /* val idx = stack.indexOfLast { it.getType() == DatumType.LIST } @@ -30,6 +30,6 @@ class MishapUnescapedValue( */ } - override fun errorMessage(ctx: CastingContext, errorCtx: Context) = + override fun errorMessage(ctx: CastingEnvironment, errorCtx: Context) = error("unescaped", perpetrator.display()) } diff --git a/Common/src/main/java/at/petrak/hexcasting/api/misc/DiscoveryHandlers.java b/Common/src/main/java/at/petrak/hexcasting/api/misc/DiscoveryHandlers.java index da42b7c1..a4dc4400 100644 --- a/Common/src/main/java/at/petrak/hexcasting/api/misc/DiscoveryHandlers.java +++ b/Common/src/main/java/at/petrak/hexcasting/api/misc/DiscoveryHandlers.java @@ -1,7 +1,7 @@ package at.petrak.hexcasting.api.misc; import at.petrak.hexcasting.api.addldata.ADMediaHolder; -import at.petrak.hexcasting.api.casting.eval.CastingContext; +import at.petrak.hexcasting.api.casting.eval.CastingEnvironment; import at.petrak.hexcasting.api.casting.eval.CastingHarness; import com.google.common.collect.Lists; import net.minecraft.world.entity.player.Player; @@ -17,8 +17,8 @@ public class DiscoveryHandlers { private static final List> HAS_LENS_PREDICATE = new ArrayList<>(); private static final List>> MEDIA_HOLDER_DISCOVERY = new ArrayList<>(); private static final List> GRID_SCALE_MODIFIERS = new ArrayList<>(); - private static final List>> ITEM_SLOT_DISCOVERER = new ArrayList<>(); - private static final List>> OPERATIVE_SLOT_DISCOVERER = new ArrayList<>(); + private static final List>> ITEM_SLOT_DISCOVERER = new ArrayList<>(); + private static final List>> OPERATIVE_SLOT_DISCOVERER = new ArrayList<>(); private static final List> DEBUG_DISCOVERER = new ArrayList<>(); public static boolean hasLens(Player player) { @@ -46,7 +46,7 @@ public class DiscoveryHandlers { return mod; } - public static List collectItemSlots(CastingContext ctx) { + public static List collectItemSlots(CastingEnvironment ctx) { List stacks = Lists.newArrayList(); for (var discoverer : ITEM_SLOT_DISCOVERER) { stacks.addAll(discoverer.apply(ctx)); @@ -54,7 +54,7 @@ public class DiscoveryHandlers { return stacks; } - public static List collectOperableSlots(CastingContext ctx) { + public static List collectOperableSlots(CastingEnvironment ctx) { List stacks = Lists.newArrayList(); for (var discoverer : OPERATIVE_SLOT_DISCOVERER) { stacks.addAll(discoverer.apply(ctx)); @@ -84,11 +84,11 @@ public class DiscoveryHandlers { GRID_SCALE_MODIFIERS.add(modifier); } - public static void addItemSlotDiscoverer(Function> discoverer) { + public static void addItemSlotDiscoverer(Function> discoverer) { ITEM_SLOT_DISCOVERER.add(discoverer); } - public static void addOperativeSlotDiscoverer(Function> discoverer) { + public static void addOperativeSlotDiscoverer(Function> discoverer) { OPERATIVE_SLOT_DISCOVERER.add(discoverer); } diff --git a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/OpBlockAxisRaycast.kt b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/OpBlockAxisRaycast.kt index 2ee687ad..0c66f9f0 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/OpBlockAxisRaycast.kt +++ b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/OpBlockAxisRaycast.kt @@ -4,7 +4,7 @@ import at.petrak.hexcasting.api.misc.MediaConstants import at.petrak.hexcasting.api.casting.castables.Action import at.petrak.hexcasting.api.casting.castables.ConstMediaAction import at.petrak.hexcasting.api.casting.asActionResult -import at.petrak.hexcasting.api.casting.eval.CastingContext +import at.petrak.hexcasting.api.casting.eval.CastingEnvironment import at.petrak.hexcasting.api.casting.getVec3 import at.petrak.hexcasting.api.casting.iota.Iota import at.petrak.hexcasting.api.casting.iota.NullIota @@ -15,7 +15,7 @@ import net.minecraft.world.phys.Vec3 object OpBlockAxisRaycast : ConstMediaAction { override val argc = 2 override val mediaCost = MediaConstants.DUST_UNIT / 100 - override fun execute(args: List, ctx: CastingContext): List { + override fun execute(args: List, ctx: CastingEnvironment): List { val origin = args.getVec3(0, argc) val look = args.getVec3(1, argc) diff --git a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/OpBlockRaycast.kt b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/OpBlockRaycast.kt index 667ff3c7..2fe8b621 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/OpBlockRaycast.kt +++ b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/OpBlockRaycast.kt @@ -4,7 +4,7 @@ import at.petrak.hexcasting.api.misc.MediaConstants import at.petrak.hexcasting.api.casting.castables.Action import at.petrak.hexcasting.api.casting.castables.ConstMediaAction import at.petrak.hexcasting.api.casting.asActionResult -import at.petrak.hexcasting.api.casting.eval.CastingContext +import at.petrak.hexcasting.api.casting.eval.CastingEnvironment import at.petrak.hexcasting.api.casting.getVec3 import at.petrak.hexcasting.api.casting.iota.Iota import at.petrak.hexcasting.api.casting.iota.NullIota @@ -15,7 +15,7 @@ import net.minecraft.world.phys.Vec3 object OpBlockRaycast : ConstMediaAction { override val argc = 2 override val mediaCost = MediaConstants.DUST_UNIT / 100 - override fun execute(args: List, ctx: CastingContext): List { + override fun execute(args: List, ctx: CastingEnvironment): List { val origin = args.getVec3(0, argc) val look = args.getVec3(1, argc) diff --git a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/OpEntityHeight.kt b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/OpEntityHeight.kt index 0415470f..90c7da4b 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/OpEntityHeight.kt +++ b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/OpEntityHeight.kt @@ -2,14 +2,14 @@ package at.petrak.hexcasting.common.casting.operators import at.petrak.hexcasting.api.casting.castables.ConstMediaAction import at.petrak.hexcasting.api.casting.asActionResult -import at.petrak.hexcasting.api.casting.eval.CastingContext +import at.petrak.hexcasting.api.casting.eval.CastingEnvironment import at.petrak.hexcasting.api.casting.getEntity import at.petrak.hexcasting.api.casting.iota.Iota object OpEntityHeight : ConstMediaAction { override val argc = 1 - override fun execute(args: List, ctx: CastingContext): List { + override fun execute(args: List, ctx: CastingEnvironment): List { val e = args.getEntity(0, argc) ctx.assertEntityInRange(e) return e.bbHeight.asActionResult diff --git a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/OpEntityLook.kt b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/OpEntityLook.kt index 0633a499..70847fed 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/OpEntityLook.kt +++ b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/OpEntityLook.kt @@ -2,14 +2,14 @@ package at.petrak.hexcasting.common.casting.operators import at.petrak.hexcasting.api.casting.castables.ConstMediaAction import at.petrak.hexcasting.api.casting.asActionResult -import at.petrak.hexcasting.api.casting.eval.CastingContext +import at.petrak.hexcasting.api.casting.eval.CastingEnvironment import at.petrak.hexcasting.api.casting.getEntity import at.petrak.hexcasting.api.casting.iota.Iota object OpEntityLook : ConstMediaAction { override val argc = 1 - override fun execute(args: List, ctx: CastingContext): List { + override fun execute(args: List, ctx: CastingEnvironment): List { val e = args.getEntity(0, argc) ctx.assertEntityInRange(e) return e.lookAngle.asActionResult diff --git a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/OpEntityPos.kt b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/OpEntityPos.kt index e6356957..7ce85110 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/OpEntityPos.kt +++ b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/OpEntityPos.kt @@ -2,14 +2,14 @@ package at.petrak.hexcasting.common.casting.operators import at.petrak.hexcasting.api.casting.castables.ConstMediaAction import at.petrak.hexcasting.api.casting.asActionResult -import at.petrak.hexcasting.api.casting.eval.CastingContext +import at.petrak.hexcasting.api.casting.eval.CastingEnvironment import at.petrak.hexcasting.api.casting.getEntity import at.petrak.hexcasting.api.casting.iota.Iota class OpEntityPos(val feet: Boolean) : ConstMediaAction { override val argc = 1 - override fun execute(args: List, ctx: CastingContext): List { + override fun execute(args: List, ctx: CastingEnvironment): List { val e = args.getEntity(0, argc) ctx.assertEntityInRange(e) return (if (this.feet) e.position() else e.eyePosition).asActionResult diff --git a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/OpEntityRaycast.kt b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/OpEntityRaycast.kt index 90e98c73..b5744a25 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/OpEntityRaycast.kt +++ b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/OpEntityRaycast.kt @@ -4,7 +4,7 @@ import at.petrak.hexcasting.api.misc.MediaConstants import at.petrak.hexcasting.api.casting.castables.Action import at.petrak.hexcasting.api.casting.castables.ConstMediaAction import at.petrak.hexcasting.api.casting.asActionResult -import at.petrak.hexcasting.api.casting.eval.CastingContext +import at.petrak.hexcasting.api.casting.eval.CastingEnvironment import at.petrak.hexcasting.api.casting.getVec3 import at.petrak.hexcasting.api.casting.iota.Iota import at.petrak.hexcasting.api.casting.iota.NullIota @@ -14,7 +14,7 @@ import net.minecraft.world.phys.AABB object OpEntityRaycast : ConstMediaAction { override val argc = 2 override val mediaCost = MediaConstants.DUST_UNIT / 100 - override fun execute(args: List, ctx: CastingContext): List { + override fun execute(args: List, ctx: CastingEnvironment): List { val origin = args.getVec3(0, argc) val look = args.getVec3(1, argc) val endp = Action.raycastEnd(origin, look) diff --git a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/OpEntityVelocity.kt b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/OpEntityVelocity.kt index 39807d56..5430e154 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/OpEntityVelocity.kt +++ b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/OpEntityVelocity.kt @@ -2,7 +2,7 @@ package at.petrak.hexcasting.common.casting.operators import at.petrak.hexcasting.api.casting.castables.ConstMediaAction import at.petrak.hexcasting.api.casting.asActionResult -import at.petrak.hexcasting.api.casting.eval.CastingContext +import at.petrak.hexcasting.api.casting.eval.CastingEnvironment import at.petrak.hexcasting.api.casting.getEntity import at.petrak.hexcasting.api.casting.iota.Iota import at.petrak.hexcasting.common.misc.PlayerPositionRecorder @@ -11,7 +11,7 @@ import net.minecraft.server.level.ServerPlayer object OpEntityVelocity : ConstMediaAction { override val argc = 1 - override fun execute(args: List, ctx: CastingContext): List { + override fun execute(args: List, ctx: CastingEnvironment): List { val e = args.getEntity(0, argc) ctx.assertEntityInRange(e) diff --git a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/akashic/OpAkashicRead.kt b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/akashic/OpAkashicRead.kt index 0e8a850c..77c40fc0 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/akashic/OpAkashicRead.kt +++ b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/akashic/OpAkashicRead.kt @@ -2,7 +2,7 @@ package at.petrak.hexcasting.common.casting.operators.akashic import at.petrak.hexcasting.api.misc.MediaConstants import at.petrak.hexcasting.api.casting.castables.ConstMediaAction -import at.petrak.hexcasting.api.casting.eval.CastingContext +import at.petrak.hexcasting.api.casting.eval.CastingEnvironment import at.petrak.hexcasting.api.casting.getBlockPos import at.petrak.hexcasting.api.casting.getPattern import at.petrak.hexcasting.api.casting.iota.Iota @@ -14,7 +14,7 @@ object OpAkashicRead : ConstMediaAction { override val argc = 2 override val mediaCost = MediaConstants.DUST_UNIT - override fun execute(args: List, ctx: CastingContext): List { + override fun execute(args: List, ctx: CastingEnvironment): List { val pos = args.getBlockPos(0, argc) val key = args.getPattern(1, argc) 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 02a2da90..43f5e70a 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 @@ -2,7 +2,7 @@ package at.petrak.hexcasting.common.casting.operators.akashic import at.petrak.hexcasting.api.casting.* import at.petrak.hexcasting.api.casting.castables.SpellAction -import at.petrak.hexcasting.api.casting.eval.CastingContext +import at.petrak.hexcasting.api.casting.eval.CastingEnvironment import at.petrak.hexcasting.api.casting.iota.Iota import at.petrak.hexcasting.api.casting.math.HexPattern import at.petrak.hexcasting.api.casting.mishaps.MishapNoAkashicRecord @@ -18,7 +18,7 @@ object OpAkashicWrite : SpellAction { override fun execute( args: List, - ctx: CastingContext + ctx: CastingEnvironment ): Triple> { val pos = args.getBlockPos(0, argc) val key = args.getPattern(1, argc) @@ -49,7 +49,7 @@ object OpAkashicWrite : SpellAction { val datum: Iota ) : RenderedSpell { - override fun cast(ctx: CastingContext) { + override fun cast(ctx: CastingEnvironment) { record.addNewDatum(recordPos, ctx.world, key, datum) ctx.world.playSound( diff --git a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/circles/OpCircleBounds.kt b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/circles/OpCircleBounds.kt index 86eef2e3..a0ec8c31 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/circles/OpCircleBounds.kt +++ b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/circles/OpCircleBounds.kt @@ -2,7 +2,7 @@ package at.petrak.hexcasting.common.casting.operators.circles import at.petrak.hexcasting.api.casting.castables.ConstMediaAction import at.petrak.hexcasting.api.casting.asActionResult -import at.petrak.hexcasting.api.casting.eval.CastingContext +import at.petrak.hexcasting.api.casting.eval.CastingEnvironment import at.petrak.hexcasting.api.casting.iota.Iota import at.petrak.hexcasting.api.casting.mishaps.MishapNoSpellCircle import net.minecraft.world.phys.Vec3 @@ -10,7 +10,7 @@ import net.minecraft.world.phys.Vec3 class OpCircleBounds(val max: Boolean) : ConstMediaAction { override val argc = 0 - override fun execute(args: List, ctx: CastingContext): List { + override fun execute(args: List, ctx: CastingEnvironment): List { if (ctx.spellCircle == null) throw MishapNoSpellCircle() diff --git a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/circles/OpImpetusDir.kt b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/circles/OpImpetusDir.kt index 30ad718b..ea46b582 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/circles/OpImpetusDir.kt +++ b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/circles/OpImpetusDir.kt @@ -3,14 +3,14 @@ package at.petrak.hexcasting.common.casting.operators.circles import at.petrak.hexcasting.api.block.circle.BlockAbstractImpetus import at.petrak.hexcasting.api.casting.castables.ConstMediaAction import at.petrak.hexcasting.api.casting.asActionResult -import at.petrak.hexcasting.api.casting.eval.CastingContext +import at.petrak.hexcasting.api.casting.eval.CastingEnvironment import at.petrak.hexcasting.api.casting.iota.Iota import at.petrak.hexcasting.api.casting.mishaps.MishapNoSpellCircle object OpImpetusDir : ConstMediaAction { override val argc = 0 - override fun execute(args: List, ctx: CastingContext): List { + override fun execute(args: List, ctx: CastingEnvironment): List { if (ctx.spellCircle == null) throw MishapNoSpellCircle() diff --git a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/circles/OpImpetusPos.kt b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/circles/OpImpetusPos.kt index dcc68497..62382aba 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/circles/OpImpetusPos.kt +++ b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/circles/OpImpetusPos.kt @@ -2,14 +2,14 @@ package at.petrak.hexcasting.common.casting.operators.circles import at.petrak.hexcasting.api.casting.castables.ConstMediaAction import at.petrak.hexcasting.api.casting.asActionResult -import at.petrak.hexcasting.api.casting.eval.CastingContext +import at.petrak.hexcasting.api.casting.eval.CastingEnvironment import at.petrak.hexcasting.api.casting.iota.Iota import at.petrak.hexcasting.api.casting.mishaps.MishapNoSpellCircle object OpImpetusPos : ConstMediaAction { override val argc = 0 - override fun execute(args: List, ctx: CastingContext): List { + override fun execute(args: List, ctx: CastingEnvironment): List { if (ctx.spellCircle == null) throw MishapNoSpellCircle() diff --git a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/eval/OpEval.kt b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/eval/OpEval.kt index a9dee28d..d5b2fd94 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/eval/OpEval.kt +++ b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/eval/OpEval.kt @@ -3,7 +3,7 @@ package at.petrak.hexcasting.common.casting.operators.eval import at.petrak.hexcasting.api.casting.castables.Action import at.petrak.hexcasting.api.casting.OperationResult import at.petrak.hexcasting.api.casting.SpellList -import at.petrak.hexcasting.api.casting.eval.CastingContext +import at.petrak.hexcasting.api.casting.eval.CastingEnvironment import at.petrak.hexcasting.api.casting.eval.vm.FrameEvaluate import at.petrak.hexcasting.api.casting.eval.vm.FrameFinishEval import at.petrak.hexcasting.api.casting.eval.vm.SpellContinuation @@ -17,7 +17,7 @@ object OpEval : Action { continuation: SpellContinuation, stack: MutableList, ravenmind: Iota?, - ctx: CastingContext + ctx: CastingEnvironment ): OperationResult { val datum = stack.removeLastOrNull() ?: throw MishapNotEnoughArgs(1, 0) val instrs = evaluatable(datum, 0) diff --git a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/eval/OpForEach.kt b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/eval/OpForEach.kt index d011651e..7b569e15 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/eval/OpForEach.kt +++ b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/eval/OpForEach.kt @@ -2,7 +2,7 @@ package at.petrak.hexcasting.common.casting.operators.eval import at.petrak.hexcasting.api.casting.castables.Action import at.petrak.hexcasting.api.casting.OperationResult -import at.petrak.hexcasting.api.casting.eval.CastingContext +import at.petrak.hexcasting.api.casting.eval.CastingEnvironment import at.petrak.hexcasting.api.casting.eval.vm.FrameForEach import at.petrak.hexcasting.api.casting.eval.vm.SpellContinuation import at.petrak.hexcasting.api.casting.getList @@ -14,7 +14,7 @@ object OpForEach : Action { continuation: SpellContinuation, stack: MutableList, ravenmind: Iota?, - ctx: CastingContext + ctx: CastingEnvironment ): OperationResult { if (stack.size < 2) throw MishapNotEnoughArgs(2, stack.size) diff --git a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/eval/OpHalt.kt b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/eval/OpHalt.kt index 7baf550d..c1a30d88 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/eval/OpHalt.kt +++ b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/eval/OpHalt.kt @@ -2,7 +2,7 @@ package at.petrak.hexcasting.common.casting.operators.eval import at.petrak.hexcasting.api.casting.castables.Action import at.petrak.hexcasting.api.casting.OperationResult -import at.petrak.hexcasting.api.casting.eval.CastingContext +import at.petrak.hexcasting.api.casting.eval.CastingEnvironment import at.petrak.hexcasting.api.casting.eval.vm.SpellContinuation import at.petrak.hexcasting.api.casting.iota.Iota @@ -11,7 +11,7 @@ object OpHalt : Action { continuation: SpellContinuation, stack: MutableList, ravenmind: Iota?, - ctx: CastingContext + ctx: CastingEnvironment ): OperationResult { var newStack = stack.toList() var done = false diff --git a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/lists/OpAppend.kt b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/lists/OpAppend.kt index 91677a8c..b4f1451c 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/lists/OpAppend.kt +++ b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/lists/OpAppend.kt @@ -2,13 +2,13 @@ package at.petrak.hexcasting.common.casting.operators.lists import at.petrak.hexcasting.api.casting.castables.ConstMediaAction import at.petrak.hexcasting.api.casting.asActionResult -import at.petrak.hexcasting.api.casting.eval.CastingContext +import at.petrak.hexcasting.api.casting.eval.CastingEnvironment import at.petrak.hexcasting.api.casting.getList import at.petrak.hexcasting.api.casting.iota.Iota object OpAppend : ConstMediaAction { override val argc = 2 - override fun execute(args: List, ctx: CastingContext): List { + override fun execute(args: List, ctx: CastingEnvironment): List { val list = args.getList(0, argc).toMutableList() val datum = args[1] list.add(datum) diff --git a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/lists/OpConcat.kt b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/lists/OpConcat.kt index ff1e3832..4575fe52 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/lists/OpConcat.kt +++ b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/lists/OpConcat.kt @@ -2,13 +2,13 @@ package at.petrak.hexcasting.common.casting.operators.lists import at.petrak.hexcasting.api.casting.castables.ConstMediaAction import at.petrak.hexcasting.api.casting.asActionResult -import at.petrak.hexcasting.api.casting.eval.CastingContext +import at.petrak.hexcasting.api.casting.eval.CastingEnvironment import at.petrak.hexcasting.api.casting.getList import at.petrak.hexcasting.api.casting.iota.Iota object OpConcat : ConstMediaAction { override val argc = 2 - override fun execute(args: List, ctx: CastingContext): List { + override fun execute(args: List, ctx: CastingEnvironment): List { val lhs = args.getList(0, argc).toMutableList() val rhs = args.getList(1, argc) lhs.addAll(rhs) diff --git a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/lists/OpCons.kt b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/lists/OpCons.kt index 92e5cac5..0249e110 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/lists/OpCons.kt +++ b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/lists/OpCons.kt @@ -3,13 +3,13 @@ package at.petrak.hexcasting.common.casting.operators.lists import at.petrak.hexcasting.api.casting.castables.ConstMediaAction import at.petrak.hexcasting.api.casting.SpellList import at.petrak.hexcasting.api.casting.asActionResult -import at.petrak.hexcasting.api.casting.eval.CastingContext +import at.petrak.hexcasting.api.casting.eval.CastingEnvironment import at.petrak.hexcasting.api.casting.getList import at.petrak.hexcasting.api.casting.iota.Iota object OpCons : ConstMediaAction { override val argc = 2 - override fun execute(args: List, ctx: CastingContext): List { + override fun execute(args: List, ctx: CastingEnvironment): List { val bottom = args.getList(0, argc) val top = args[1] return SpellList.LPair(top, bottom).asActionResult diff --git a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/lists/OpEmptyList.kt b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/lists/OpEmptyList.kt index f1fadd54..54a90fab 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/lists/OpEmptyList.kt +++ b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/lists/OpEmptyList.kt @@ -3,11 +3,11 @@ package at.petrak.hexcasting.common.casting.operators.lists import at.petrak.hexcasting.api.casting.castables.ConstMediaAction import at.petrak.hexcasting.api.casting.iota.Iota import at.petrak.hexcasting.api.casting.asActionResult -import at.petrak.hexcasting.api.casting.eval.CastingContext +import at.petrak.hexcasting.api.casting.eval.CastingEnvironment object OpEmptyList : ConstMediaAction { override val argc = 0 - override fun execute(args: List, ctx: CastingContext): List { + override fun execute(args: List, ctx: CastingEnvironment): List { return emptyList().asActionResult // sorry for taking all the easy impls, hudeler } } diff --git a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/lists/OpIndex.kt b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/lists/OpIndex.kt index 9f01433f..87873fd7 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/lists/OpIndex.kt +++ b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/lists/OpIndex.kt @@ -1,7 +1,7 @@ package at.petrak.hexcasting.common.casting.operators.lists import at.petrak.hexcasting.api.casting.castables.ConstMediaAction -import at.petrak.hexcasting.api.casting.eval.CastingContext +import at.petrak.hexcasting.api.casting.eval.CastingEnvironment import at.petrak.hexcasting.api.casting.getDouble import at.petrak.hexcasting.api.casting.getList import at.petrak.hexcasting.api.casting.iota.Iota @@ -10,7 +10,7 @@ import kotlin.math.roundToInt object OpIndex : ConstMediaAction { override val argc = 2 - override fun execute(args: List, ctx: CastingContext): List { + override fun execute(args: List, ctx: CastingEnvironment): List { val list = args.getList(0, argc).toMutableList() val index = args.getDouble(1, argc) val x = list.getOrElse(index.roundToInt()) { NullIota() } diff --git a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/lists/OpIndexOf.kt b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/lists/OpIndexOf.kt index cb571cae..32cbb566 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/lists/OpIndexOf.kt +++ b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/lists/OpIndexOf.kt @@ -2,7 +2,7 @@ package at.petrak.hexcasting.common.casting.operators.lists import at.petrak.hexcasting.api.casting.castables.ConstMediaAction import at.petrak.hexcasting.api.casting.asActionResult -import at.petrak.hexcasting.api.casting.eval.CastingContext +import at.petrak.hexcasting.api.casting.eval.CastingEnvironment import at.petrak.hexcasting.api.casting.getList import at.petrak.hexcasting.api.casting.iota.Iota @@ -10,7 +10,7 @@ object OpIndexOf : ConstMediaAction { override val argc: Int get() = 2 - override fun execute(args: List, ctx: CastingContext): List { + override fun execute(args: List, ctx: CastingEnvironment): List { val list = args.getList(0, argc).toMutableList() val value = args[1] return list.indexOfFirst { Iota.tolerates(value, it) }.asActionResult diff --git a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/lists/OpLastNToList.kt b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/lists/OpLastNToList.kt index 5cbb550e..458a3445 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/lists/OpLastNToList.kt +++ b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/lists/OpLastNToList.kt @@ -3,7 +3,7 @@ package at.petrak.hexcasting.common.casting.operators.lists import at.petrak.hexcasting.api.casting.castables.Action import at.petrak.hexcasting.api.casting.OperationResult import at.petrak.hexcasting.api.casting.asActionResult -import at.petrak.hexcasting.api.casting.eval.CastingContext +import at.petrak.hexcasting.api.casting.eval.CastingEnvironment import at.petrak.hexcasting.api.casting.eval.vm.SpellContinuation import at.petrak.hexcasting.api.casting.getPositiveIntUnderInclusive import at.petrak.hexcasting.api.casting.iota.Iota @@ -14,7 +14,7 @@ object OpLastNToList : Action { continuation: SpellContinuation, stack: MutableList, ravenmind: Iota?, - ctx: CastingContext + ctx: CastingEnvironment ): OperationResult { if (stack.isEmpty()) throw MishapNotEnoughArgs(1, 0) diff --git a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/lists/OpListSize.kt b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/lists/OpListSize.kt index e08d3c87..a6e454b0 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/lists/OpListSize.kt +++ b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/lists/OpListSize.kt @@ -2,14 +2,14 @@ package at.petrak.hexcasting.common.casting.operators.lists import at.petrak.hexcasting.api.casting.castables.ConstMediaAction import at.petrak.hexcasting.api.casting.asActionResult -import at.petrak.hexcasting.api.casting.eval.CastingContext +import at.petrak.hexcasting.api.casting.eval.CastingEnvironment import at.petrak.hexcasting.api.casting.getList import at.petrak.hexcasting.api.casting.iota.Iota // it's still called beancounter's distillation in my heart object OpListSize : ConstMediaAction { override val argc = 1 - override fun execute(args: List, ctx: CastingContext): List { + override fun execute(args: List, ctx: CastingEnvironment): List { return args.getList(0, argc).toList().size.asActionResult // mmm one-liner } } diff --git a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/lists/OpModifyInPlace.kt b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/lists/OpModifyInPlace.kt index 3abf5c8b..91a97e0f 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/lists/OpModifyInPlace.kt +++ b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/lists/OpModifyInPlace.kt @@ -2,12 +2,12 @@ package at.petrak.hexcasting.common.casting.operators.lists import at.petrak.hexcasting.api.casting.* import at.petrak.hexcasting.api.casting.castables.ConstMediaAction -import at.petrak.hexcasting.api.casting.eval.CastingContext +import at.petrak.hexcasting.api.casting.eval.CastingEnvironment import at.petrak.hexcasting.api.casting.iota.Iota object OpModifyInPlace : ConstMediaAction { override val argc = 3 - override fun execute(args: List, ctx: CastingContext): List { + override fun execute(args: List, ctx: CastingEnvironment): List { val list = args.getList(0, argc) val index = args.getPositiveIntUnder(1, list.size(), argc) val iota = args[2] diff --git a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/lists/OpRemove.kt b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/lists/OpRemove.kt index 5c22b957..5db9a0c8 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/lists/OpRemove.kt +++ b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/lists/OpRemove.kt @@ -2,7 +2,7 @@ package at.petrak.hexcasting.common.casting.operators.lists import at.petrak.hexcasting.api.casting.castables.ConstMediaAction import at.petrak.hexcasting.api.casting.asActionResult -import at.petrak.hexcasting.api.casting.eval.CastingContext +import at.petrak.hexcasting.api.casting.eval.CastingEnvironment import at.petrak.hexcasting.api.casting.getInt import at.petrak.hexcasting.api.casting.getList import at.petrak.hexcasting.api.casting.iota.Iota @@ -11,7 +11,7 @@ object OpRemove : ConstMediaAction { override val argc: Int get() = 2 - override fun execute(args: List, ctx: CastingContext): List { + override fun execute(args: List, ctx: CastingEnvironment): List { val list = args.getList(0, argc).toMutableList() val index = args.getInt(1, argc) if (index < 0 || index >= list.size) diff --git a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/lists/OpReverski.kt b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/lists/OpReverski.kt index a1f3027c..c111f3af 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/lists/OpReverski.kt +++ b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/lists/OpReverski.kt @@ -2,13 +2,13 @@ package at.petrak.hexcasting.common.casting.operators.lists import at.petrak.hexcasting.api.casting.castables.ConstMediaAction import at.petrak.hexcasting.api.casting.asActionResult -import at.petrak.hexcasting.api.casting.eval.CastingContext +import at.petrak.hexcasting.api.casting.eval.CastingEnvironment import at.petrak.hexcasting.api.casting.getList import at.petrak.hexcasting.api.casting.iota.Iota object OpReverski : ConstMediaAction { override val argc = 1 - override fun execute(args: List, ctx: CastingContext): List { + override fun execute(args: List, ctx: CastingEnvironment): List { return args.getList(0, argc).toList().asReversed().asActionResult // okay kotlin kinda pogged for this } } diff --git a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/lists/OpSingleton.kt b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/lists/OpSingleton.kt index 23196ff7..2cd740a2 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/lists/OpSingleton.kt +++ b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/lists/OpSingleton.kt @@ -2,12 +2,12 @@ package at.petrak.hexcasting.common.casting.operators.lists import at.petrak.hexcasting.api.casting.castables.ConstMediaAction import at.petrak.hexcasting.api.casting.asActionResult -import at.petrak.hexcasting.api.casting.eval.CastingContext +import at.petrak.hexcasting.api.casting.eval.CastingEnvironment import at.petrak.hexcasting.api.casting.iota.Iota object OpSingleton : ConstMediaAction { override val argc = 1 - override fun execute(args: List, ctx: CastingContext): List { + override fun execute(args: List, ctx: CastingEnvironment): List { return listOf(args[0]).asActionResult // god i love one-liners } } diff --git a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/lists/OpSlice.kt b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/lists/OpSlice.kt index d2c8f5e0..181be4b6 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/lists/OpSlice.kt +++ b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/lists/OpSlice.kt @@ -2,7 +2,7 @@ package at.petrak.hexcasting.common.casting.operators.lists import at.petrak.hexcasting.api.casting.castables.ConstMediaAction import at.petrak.hexcasting.api.casting.asActionResult -import at.petrak.hexcasting.api.casting.eval.CastingContext +import at.petrak.hexcasting.api.casting.eval.CastingEnvironment import at.petrak.hexcasting.api.casting.getList import at.petrak.hexcasting.api.casting.getPositiveIntUnderInclusive import at.petrak.hexcasting.api.casting.iota.Iota @@ -11,7 +11,7 @@ import kotlin.math.min object OpSlice : ConstMediaAction { override val argc = 3 - override fun execute(args: List, ctx: CastingContext): List { + override fun execute(args: List, ctx: CastingEnvironment): List { val list = args.getList(0, argc).toList() val index1 = args.getPositiveIntUnderInclusive(1, list.size, argc) val index2 = args.getPositiveIntUnderInclusive(2, list.size, argc) diff --git a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/lists/OpSplat.kt b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/lists/OpSplat.kt index c6c33016..9d48f3cc 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/lists/OpSplat.kt +++ b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/lists/OpSplat.kt @@ -1,7 +1,7 @@ package at.petrak.hexcasting.common.casting.operators.lists import at.petrak.hexcasting.api.casting.castables.ConstMediaAction -import at.petrak.hexcasting.api.casting.eval.CastingContext +import at.petrak.hexcasting.api.casting.eval.CastingEnvironment import at.petrak.hexcasting.api.casting.getList import at.petrak.hexcasting.api.casting.iota.Iota @@ -9,6 +9,6 @@ object OpSplat : ConstMediaAction { override val argc: Int get() = 1 - override fun execute(args: List, ctx: CastingContext): List = + override fun execute(args: List, ctx: CastingEnvironment): List = args.getList(0, argc).toList() } diff --git a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/lists/OpUnCons.kt b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/lists/OpUnCons.kt index aa0ec4f2..3f1bd66d 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/lists/OpUnCons.kt +++ b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/lists/OpUnCons.kt @@ -1,7 +1,7 @@ package at.petrak.hexcasting.common.casting.operators.lists import at.petrak.hexcasting.api.casting.castables.ConstMediaAction -import at.petrak.hexcasting.api.casting.eval.CastingContext +import at.petrak.hexcasting.api.casting.eval.CastingEnvironment import at.petrak.hexcasting.api.casting.getList import at.petrak.hexcasting.api.casting.iota.Iota import at.petrak.hexcasting.api.casting.iota.ListIota @@ -9,7 +9,7 @@ import at.petrak.hexcasting.api.casting.iota.NullIota object OpUnCons : ConstMediaAction { override val argc = 1 - override fun execute(args: List, ctx: CastingContext): List { + override fun execute(args: List, ctx: CastingEnvironment): List { val list = args.getList(0, argc) if (list.nonEmpty) { return listOf(ListIota(list.cdr), list.car) diff --git a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/local/OpPeekLocal.kt b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/local/OpPeekLocal.kt index 856edf0f..239f98f4 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/local/OpPeekLocal.kt +++ b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/local/OpPeekLocal.kt @@ -2,7 +2,7 @@ package at.petrak.hexcasting.common.casting.operators.local import at.petrak.hexcasting.api.casting.castables.Action import at.petrak.hexcasting.api.casting.OperationResult -import at.petrak.hexcasting.api.casting.eval.CastingContext +import at.petrak.hexcasting.api.casting.eval.CastingEnvironment import at.petrak.hexcasting.api.casting.eval.vm.SpellContinuation import at.petrak.hexcasting.api.casting.iota.Iota import at.petrak.hexcasting.api.casting.orNull @@ -12,7 +12,7 @@ object OpPeekLocal : Action { continuation: SpellContinuation, stack: MutableList, ravenmind: Iota?, - ctx: CastingContext + ctx: CastingEnvironment ): OperationResult { stack.add(ravenmind.orNull()) return OperationResult(continuation, stack, ravenmind, listOf()) diff --git a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/local/OpPushLocal.kt b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/local/OpPushLocal.kt index 47036f2d..829bcd68 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/local/OpPushLocal.kt +++ b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/local/OpPushLocal.kt @@ -2,7 +2,7 @@ package at.petrak.hexcasting.common.casting.operators.local import at.petrak.hexcasting.api.casting.castables.Action import at.petrak.hexcasting.api.casting.OperationResult -import at.petrak.hexcasting.api.casting.eval.CastingContext +import at.petrak.hexcasting.api.casting.eval.CastingEnvironment 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 @@ -12,7 +12,7 @@ object OpPushLocal : Action { continuation: SpellContinuation, stack: MutableList, ravenmind: Iota?, - ctx: CastingContext + ctx: CastingEnvironment ): OperationResult { if (stack.isEmpty()) throw MishapNotEnoughArgs(1, 0) diff --git a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/math/OpAbsLen.kt b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/math/OpAbsLen.kt index 25b3e415..4144d59e 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/math/OpAbsLen.kt +++ b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/math/OpAbsLen.kt @@ -2,7 +2,7 @@ package at.petrak.hexcasting.common.casting.operators.math import at.petrak.hexcasting.api.casting.castables.ConstMediaAction import at.petrak.hexcasting.api.casting.asActionResult -import at.petrak.hexcasting.api.casting.eval.CastingContext +import at.petrak.hexcasting.api.casting.eval.CastingEnvironment import at.petrak.hexcasting.api.casting.getNumOrVec import at.petrak.hexcasting.api.casting.iota.Iota import kotlin.math.absoluteValue @@ -11,7 +11,7 @@ object OpAbsLen : ConstMediaAction { override val argc: Int get() = 1 - override fun execute(args: List, ctx: CastingContext): List { + override fun execute(args: List, ctx: CastingEnvironment): List { val x = args.getNumOrVec(0, argc) return x.map({ num -> num.absoluteValue }, { vec -> vec.length() }).asActionResult diff --git a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/math/OpAdd.kt b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/math/OpAdd.kt index 61af4526..14d5b7a0 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/math/OpAdd.kt +++ b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/math/OpAdd.kt @@ -2,7 +2,7 @@ package at.petrak.hexcasting.common.casting.operators.math import at.petrak.hexcasting.api.casting.castables.ConstMediaAction import at.petrak.hexcasting.api.casting.asActionResult -import at.petrak.hexcasting.api.casting.eval.CastingContext +import at.petrak.hexcasting.api.casting.eval.CastingEnvironment import at.petrak.hexcasting.api.casting.getNumOrVec import at.petrak.hexcasting.api.casting.iota.Iota @@ -10,7 +10,7 @@ object OpAdd : ConstMediaAction { override val argc: Int get() = 2 - override fun execute(args: List, ctx: CastingContext): List { + override fun execute(args: List, ctx: CastingEnvironment): List { val lhs = args.getNumOrVec(0, argc) val rhs = args.getNumOrVec(1, argc) diff --git a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/math/OpCeil.kt b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/math/OpCeil.kt index 8060e152..ed3a5079 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/math/OpCeil.kt +++ b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/math/OpCeil.kt @@ -2,7 +2,7 @@ package at.petrak.hexcasting.common.casting.operators.math import at.petrak.hexcasting.api.casting.castables.ConstMediaAction import at.petrak.hexcasting.api.casting.aplKinnie -import at.petrak.hexcasting.api.casting.eval.CastingContext +import at.petrak.hexcasting.api.casting.eval.CastingEnvironment import at.petrak.hexcasting.api.casting.getNumOrVec import at.petrak.hexcasting.api.casting.iota.Iota import kotlin.math.ceil @@ -11,7 +11,7 @@ object OpCeil : ConstMediaAction { override val argc: Int get() = 1 - override fun execute(args: List, ctx: CastingContext): List { + override fun execute(args: List, ctx: CastingEnvironment): List { val value = args.getNumOrVec(0, argc) // i hate this fucking syntax what the hell is ::ceil are you a goddamn homestuck ::c return listOf(aplKinnie(value, ::ceil)) diff --git a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/math/OpCoerceToAxial.kt b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/math/OpCoerceToAxial.kt index 0d0a2b20..7c87129b 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/math/OpCoerceToAxial.kt +++ b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/math/OpCoerceToAxial.kt @@ -2,7 +2,7 @@ package at.petrak.hexcasting.common.casting.operators.math import at.petrak.hexcasting.api.casting.castables.ConstMediaAction import at.petrak.hexcasting.api.casting.asActionResult -import at.petrak.hexcasting.api.casting.eval.CastingContext +import at.petrak.hexcasting.api.casting.eval.CastingEnvironment import at.petrak.hexcasting.api.casting.getVec3 import at.petrak.hexcasting.api.casting.iota.Iota import net.minecraft.core.Direction @@ -12,7 +12,7 @@ object OpCoerceToAxial : ConstMediaAction { override val argc: Int get() = 1 - override fun execute(args: List, ctx: CastingContext): List { + override fun execute(args: List, ctx: CastingEnvironment): List { val vec = args.getVec3(0, argc) if (vec == Vec3.ZERO) return vec.asActionResult diff --git a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/math/OpConstructVec.kt b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/math/OpConstructVec.kt index 95d6a74d..79d20540 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/math/OpConstructVec.kt +++ b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/math/OpConstructVec.kt @@ -2,14 +2,14 @@ package at.petrak.hexcasting.common.casting.operators.math import at.petrak.hexcasting.api.casting.castables.ConstMediaAction import at.petrak.hexcasting.api.casting.asActionResult -import at.petrak.hexcasting.api.casting.eval.CastingContext +import at.petrak.hexcasting.api.casting.eval.CastingEnvironment import at.petrak.hexcasting.api.casting.getDouble import at.petrak.hexcasting.api.casting.iota.Iota import net.minecraft.world.phys.Vec3 object OpConstructVec : ConstMediaAction { override val argc = 3 - override fun execute(args: List, ctx: CastingContext): List { + override fun execute(args: List, ctx: CastingEnvironment): List { val x = args.getDouble(0, argc) val y = args.getDouble(1, argc) val z = args.getDouble(2, argc) diff --git a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/math/OpDeconstructVec.kt b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/math/OpDeconstructVec.kt index 4e9df8d5..a9dc7e28 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/math/OpDeconstructVec.kt +++ b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/math/OpDeconstructVec.kt @@ -1,14 +1,14 @@ package at.petrak.hexcasting.common.casting.operators.math import at.petrak.hexcasting.api.casting.castables.ConstMediaAction -import at.petrak.hexcasting.api.casting.eval.CastingContext +import at.petrak.hexcasting.api.casting.eval.CastingEnvironment import at.petrak.hexcasting.api.casting.getVec3 import at.petrak.hexcasting.api.casting.iota.DoubleIota import at.petrak.hexcasting.api.casting.iota.Iota object OpDeconstructVec : ConstMediaAction { override val argc = 1 - override fun execute(args: List, ctx: CastingContext): List { + override fun execute(args: List, ctx: CastingEnvironment): List { val v = args.getVec3(0, argc) return listOf(DoubleIota(v.x), DoubleIota(v.y), DoubleIota(v.z)) } diff --git a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/math/OpDivCross.kt b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/math/OpDivCross.kt index 5be6bb34..aa863d04 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/math/OpDivCross.kt +++ b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/math/OpDivCross.kt @@ -2,7 +2,7 @@ package at.petrak.hexcasting.common.casting.operators.math import at.petrak.hexcasting.api.casting.castables.ConstMediaAction import at.petrak.hexcasting.api.casting.asActionResult -import at.petrak.hexcasting.api.casting.eval.CastingContext +import at.petrak.hexcasting.api.casting.eval.CastingEnvironment import at.petrak.hexcasting.api.casting.getNumOrVec import at.petrak.hexcasting.api.casting.iota.Iota import at.petrak.hexcasting.api.casting.mishaps.MishapDivideByZero @@ -12,7 +12,7 @@ object OpDivCross : ConstMediaAction { override val argc: Int get() = 2 - override fun execute(args: List, ctx: CastingContext): List { + override fun execute(args: List, ctx: CastingEnvironment): List { val lhs = args.getNumOrVec(0, argc) val rhs = args.getNumOrVec(1, argc) val theMishap = MishapDivideByZero.of(args[0], args[1]) diff --git a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/math/OpFloor.kt b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/math/OpFloor.kt index edbb9490..aa8c48e1 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/math/OpFloor.kt +++ b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/math/OpFloor.kt @@ -2,7 +2,7 @@ package at.petrak.hexcasting.common.casting.operators.math import at.petrak.hexcasting.api.casting.castables.ConstMediaAction import at.petrak.hexcasting.api.casting.aplKinnie -import at.petrak.hexcasting.api.casting.eval.CastingContext +import at.petrak.hexcasting.api.casting.eval.CastingEnvironment import at.petrak.hexcasting.api.casting.getNumOrVec import at.petrak.hexcasting.api.casting.iota.Iota import kotlin.math.floor @@ -11,7 +11,7 @@ object OpFloor : ConstMediaAction { override val argc: Int get() = 1 - override fun execute(args: List, ctx: CastingContext): List { + override fun execute(args: List, ctx: CastingEnvironment): List { val value = args.getNumOrVec(0, argc) return listOf(aplKinnie(value, ::floor)) } diff --git a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/math/OpLog.kt b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/math/OpLog.kt index 82eedc7d..f10c323c 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/math/OpLog.kt +++ b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/math/OpLog.kt @@ -2,7 +2,7 @@ package at.petrak.hexcasting.common.casting.operators.math import at.petrak.hexcasting.api.casting.castables.ConstMediaAction import at.petrak.hexcasting.api.casting.asActionResult -import at.petrak.hexcasting.api.casting.eval.CastingContext +import at.petrak.hexcasting.api.casting.eval.CastingEnvironment import at.petrak.hexcasting.api.casting.getDouble import at.petrak.hexcasting.api.casting.iota.Iota import at.petrak.hexcasting.api.casting.mishaps.MishapDivideByZero @@ -12,7 +12,7 @@ object OpLog : ConstMediaAction { override val argc: Int get() = 2 - override fun execute(args: List, ctx: CastingContext): List { + override fun execute(args: List, ctx: CastingEnvironment): List { val value = args.getDouble(0, argc) val base = args.getDouble(1, argc) if (value <= 0.0 || base <= 0.0 || base == 1.0) diff --git a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/math/OpModulo.kt b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/math/OpModulo.kt index 2c443461..5f100fc4 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/math/OpModulo.kt +++ b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/math/OpModulo.kt @@ -2,7 +2,7 @@ package at.petrak.hexcasting.common.casting.operators.math import at.petrak.hexcasting.api.casting.castables.ConstMediaAction import at.petrak.hexcasting.api.casting.asActionResult -import at.petrak.hexcasting.api.casting.eval.CastingContext +import at.petrak.hexcasting.api.casting.eval.CastingEnvironment import at.petrak.hexcasting.api.casting.getDouble import at.petrak.hexcasting.api.casting.iota.Iota import at.petrak.hexcasting.api.casting.mishaps.MishapDivideByZero @@ -11,7 +11,7 @@ object OpModulo : ConstMediaAction { override val argc: Int get() = 2 - override fun execute(args: List, ctx: CastingContext): List { + override fun execute(args: List, ctx: CastingEnvironment): List { // TODO: some wAckY vector operation to go in the vector x vector overload val l = args.getDouble(0, argc) val r = args.getDouble(1, argc) diff --git a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/math/OpMulDot.kt b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/math/OpMulDot.kt index 82ac93a0..88527141 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/math/OpMulDot.kt +++ b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/math/OpMulDot.kt @@ -2,7 +2,7 @@ package at.petrak.hexcasting.common.casting.operators.math import at.petrak.hexcasting.api.casting.castables.ConstMediaAction import at.petrak.hexcasting.api.casting.asActionResult -import at.petrak.hexcasting.api.casting.eval.CastingContext +import at.petrak.hexcasting.api.casting.eval.CastingEnvironment import at.petrak.hexcasting.api.casting.getNumOrVec import at.petrak.hexcasting.api.casting.iota.Iota @@ -10,7 +10,7 @@ object OpMulDot : ConstMediaAction { override val argc: Int get() = 2 - override fun execute(args: List, ctx: CastingContext): List { + override fun execute(args: List, ctx: CastingEnvironment): List { val lhs = args.getNumOrVec(0, OpAdd.argc) val rhs = args.getNumOrVec(1, OpAdd.argc) diff --git a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/math/OpPowProj.kt b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/math/OpPowProj.kt index 99e7d327..36f6934c 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/math/OpPowProj.kt +++ b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/math/OpPowProj.kt @@ -2,7 +2,7 @@ package at.petrak.hexcasting.common.casting.operators.math import at.petrak.hexcasting.api.casting.castables.ConstMediaAction import at.petrak.hexcasting.api.casting.asActionResult -import at.petrak.hexcasting.api.casting.eval.CastingContext +import at.petrak.hexcasting.api.casting.eval.CastingEnvironment import at.petrak.hexcasting.api.casting.getNumOrVec import at.petrak.hexcasting.api.casting.iota.Iota import at.petrak.hexcasting.api.casting.mishaps.MishapDivideByZero @@ -13,7 +13,7 @@ object OpPowProj : ConstMediaAction { override val argc: Int get() = 2 - override fun execute(args: List, ctx: CastingContext): List { + override fun execute(args: List, ctx: CastingEnvironment): List { val lhs = args.getNumOrVec(0, OpAdd.argc) val rhs = args.getNumOrVec(1, OpAdd.argc) val theMishap = MishapDivideByZero.of(args[0], args[1], "exponent") diff --git a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/math/OpRandom.kt b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/math/OpRandom.kt index f9393cb2..6ba6b0c7 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/math/OpRandom.kt +++ b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/math/OpRandom.kt @@ -2,14 +2,14 @@ package at.petrak.hexcasting.common.casting.operators.math import at.petrak.hexcasting.api.casting.castables.ConstMediaAction import at.petrak.hexcasting.api.casting.asActionResult -import at.petrak.hexcasting.api.casting.eval.CastingContext +import at.petrak.hexcasting.api.casting.eval.CastingEnvironment import at.petrak.hexcasting.api.casting.iota.Iota object OpRandom : ConstMediaAction { override val argc: Int get() = 0 - override fun execute(args: List, ctx: CastingContext): List { + override fun execute(args: List, ctx: CastingEnvironment): List { return ctx.world.random.nextDouble().asActionResult } } diff --git a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/math/OpSub.kt b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/math/OpSub.kt index 9a2655c0..ec3cfbe7 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/math/OpSub.kt +++ b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/math/OpSub.kt @@ -2,7 +2,7 @@ package at.petrak.hexcasting.common.casting.operators.math import at.petrak.hexcasting.api.casting.castables.ConstMediaAction import at.petrak.hexcasting.api.casting.asActionResult -import at.petrak.hexcasting.api.casting.eval.CastingContext +import at.petrak.hexcasting.api.casting.eval.CastingEnvironment import at.petrak.hexcasting.api.casting.getNumOrVec import at.petrak.hexcasting.api.casting.iota.Iota import net.minecraft.world.phys.Vec3 @@ -11,7 +11,7 @@ object OpSub : ConstMediaAction { override val argc: Int get() = 2 - override fun execute(args: List, ctx: CastingContext): List { + override fun execute(args: List, ctx: CastingEnvironment): List { val lhs = args.getNumOrVec(0, OpAdd.argc) val rhs = args.getNumOrVec(1, OpAdd.argc) diff --git a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/math/SpecialHandlerNumberLiteral.kt b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/math/SpecialHandlerNumberLiteral.kt index 23d21391..67b11900 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/math/SpecialHandlerNumberLiteral.kt +++ b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/math/SpecialHandlerNumberLiteral.kt @@ -1,18 +1,18 @@ package at.petrak.hexcasting.common.casting.operators.math import at.petrak.hexcasting.api.HexAPI -import at.petrak.hexcasting.api.HexAPI.modLoc import at.petrak.hexcasting.api.casting.asActionResult import at.petrak.hexcasting.api.casting.castables.Action import at.petrak.hexcasting.api.casting.castables.ConstMediaAction import at.petrak.hexcasting.api.casting.castables.SpecialHandler -import at.petrak.hexcasting.api.casting.eval.CastingContext +import at.petrak.hexcasting.api.casting.eval.CastingEnvironment import at.petrak.hexcasting.api.casting.iota.Iota import at.petrak.hexcasting.api.casting.math.HexPattern import at.petrak.hexcasting.api.utils.asTranslatedComponent import at.petrak.hexcasting.api.utils.lightPurple +import at.petrak.hexcasting.common.lib.hex.HexSpecialHandlers +import at.petrak.hexcasting.xplat.IXplatAbstractions import net.minecraft.network.chat.Component -import net.minecraft.resources.ResourceLocation class SpecialHandlerNumberLiteral(val x: Double) : SpecialHandler { override fun act(): Action { @@ -20,14 +20,15 @@ class SpecialHandlerNumberLiteral(val x: Double) : SpecialHandler { } override fun getName(): Component { - return HexAPI.instance().getActionI18nKey(NAME) + val key = IXplatAbstractions.INSTANCE.specialHandlerRegistry.getResourceKey(HexSpecialHandlers.NUMBER).get() + return HexAPI.instance().getSpecialHandlerI18nKey(key) .asTranslatedComponent(Action.DOUBLE_FORMATTER.format(x)).lightPurple } class InnerAction(val x: Double) : ConstMediaAction { override val argc = 0 - override fun execute(args: List, ctx: CastingContext): List { + override fun execute(args: List, ctx: CastingEnvironment): List { return this.x.asActionResult } } @@ -74,8 +75,4 @@ class SpecialHandlerNumberLiteral(val x: Double) : SpecialHandler { } } - - companion object { - public val NAME: ResourceLocation = modLoc("number") - } } \ No newline at end of file diff --git a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/math/bit/OpAnd.kt b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/math/bit/OpAnd.kt index 48c9e919..bd4331c4 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/math/bit/OpAnd.kt +++ b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/math/bit/OpAnd.kt @@ -2,13 +2,13 @@ package at.petrak.hexcasting.common.casting.operators.math.bit import at.petrak.hexcasting.api.casting.* import at.petrak.hexcasting.api.casting.castables.ConstMediaAction -import at.petrak.hexcasting.api.casting.eval.CastingContext +import at.petrak.hexcasting.api.casting.eval.CastingEnvironment import at.petrak.hexcasting.api.casting.iota.Iota object OpAnd : ConstMediaAction { override val argc = 2 - override fun execute(args: List, ctx: CastingContext): List { + override fun execute(args: List, ctx: CastingEnvironment): List { val firstParam = args.getLongOrList(0, argc) return firstParam.map( diff --git a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/math/bit/OpNot.kt b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/math/bit/OpNot.kt index 376c011e..46c9d6dc 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/math/bit/OpNot.kt +++ b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/math/bit/OpNot.kt @@ -2,14 +2,14 @@ package at.petrak.hexcasting.common.casting.operators.math.bit import at.petrak.hexcasting.api.casting.castables.ConstMediaAction import at.petrak.hexcasting.api.casting.asActionResult -import at.petrak.hexcasting.api.casting.eval.CastingContext +import at.petrak.hexcasting.api.casting.eval.CastingEnvironment import at.petrak.hexcasting.api.casting.getLong import at.petrak.hexcasting.api.casting.iota.Iota object OpNot : ConstMediaAction { override val argc = 1 - override fun execute(args: List, ctx: CastingContext): List { + override fun execute(args: List, ctx: CastingEnvironment): List { val num = args.getLong(0, argc) return num.inv().asActionResult } diff --git a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/math/bit/OpOr.kt b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/math/bit/OpOr.kt index 219287c8..b48db649 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/math/bit/OpOr.kt +++ b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/math/bit/OpOr.kt @@ -2,13 +2,13 @@ package at.petrak.hexcasting.common.casting.operators.math.bit import at.petrak.hexcasting.api.casting.* import at.petrak.hexcasting.api.casting.castables.ConstMediaAction -import at.petrak.hexcasting.api.casting.eval.CastingContext +import at.petrak.hexcasting.api.casting.eval.CastingEnvironment import at.petrak.hexcasting.api.casting.iota.Iota object OpOr : ConstMediaAction { override val argc = 2 - override fun execute(args: List, ctx: CastingContext): List { + override fun execute(args: List, ctx: CastingEnvironment): List { val firstParam = args.getLongOrList(0, argc) return firstParam.map( diff --git a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/math/bit/OpToSet.kt b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/math/bit/OpToSet.kt index db96c907..3563483c 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/math/bit/OpToSet.kt +++ b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/math/bit/OpToSet.kt @@ -2,14 +2,14 @@ package at.petrak.hexcasting.common.casting.operators.math.bit import at.petrak.hexcasting.api.casting.castables.ConstMediaAction import at.petrak.hexcasting.api.casting.asActionResult -import at.petrak.hexcasting.api.casting.eval.CastingContext +import at.petrak.hexcasting.api.casting.eval.CastingEnvironment import at.petrak.hexcasting.api.casting.getList import at.petrak.hexcasting.api.casting.iota.Iota object OpToSet : ConstMediaAction { override val argc = 1 - override fun execute(args: List, ctx: CastingContext): List { + override fun execute(args: List, ctx: CastingEnvironment): List { val list = args.getList(0, argc) val out = mutableListOf() diff --git a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/math/bit/OpXor.kt b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/math/bit/OpXor.kt index 8a6b3769..0951ac32 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/math/bit/OpXor.kt +++ b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/math/bit/OpXor.kt @@ -2,13 +2,13 @@ package at.petrak.hexcasting.common.casting.operators.math.bit import at.petrak.hexcasting.api.casting.* import at.petrak.hexcasting.api.casting.castables.ConstMediaAction -import at.petrak.hexcasting.api.casting.eval.CastingContext +import at.petrak.hexcasting.api.casting.eval.CastingEnvironment import at.petrak.hexcasting.api.casting.iota.Iota object OpXor : ConstMediaAction { override val argc = 2 - override fun execute(args: List, ctx: CastingContext): List { + override fun execute(args: List, ctx: CastingEnvironment): List { val firstParam = args.getLongOrList(0, argc) return firstParam.map( diff --git a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/math/logic/OpBoolAnd.kt b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/math/logic/OpBoolAnd.kt index e4121da7..c80a3bc3 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/math/logic/OpBoolAnd.kt +++ b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/math/logic/OpBoolAnd.kt @@ -2,14 +2,14 @@ package at.petrak.hexcasting.common.casting.operators.math.logic import at.petrak.hexcasting.api.casting.castables.ConstMediaAction import at.petrak.hexcasting.api.casting.asActionResult -import at.petrak.hexcasting.api.casting.eval.CastingContext +import at.petrak.hexcasting.api.casting.eval.CastingEnvironment import at.petrak.hexcasting.api.casting.getBool import at.petrak.hexcasting.api.casting.iota.Iota object OpBoolAnd : ConstMediaAction { override val argc = 2 - override fun execute(args: List, ctx: CastingContext): List { + override fun execute(args: List, ctx: CastingEnvironment): List { val lhs = args.getBool(0, argc) val rhs = args.getBool(1, argc) return (lhs && rhs).asActionResult diff --git a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/math/logic/OpBoolIf.kt b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/math/logic/OpBoolIf.kt index 9800d0d4..402078ad 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/math/logic/OpBoolIf.kt +++ b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/math/logic/OpBoolIf.kt @@ -1,14 +1,14 @@ package at.petrak.hexcasting.common.casting.operators.math.logic import at.petrak.hexcasting.api.casting.castables.ConstMediaAction -import at.petrak.hexcasting.api.casting.eval.CastingContext +import at.petrak.hexcasting.api.casting.eval.CastingEnvironment import at.petrak.hexcasting.api.casting.getBool import at.petrak.hexcasting.api.casting.iota.Iota object OpBoolIf : ConstMediaAction { override val argc = 3 - override fun execute(args: List, ctx: CastingContext): List { + override fun execute(args: List, ctx: CastingEnvironment): List { val cond = args.getBool(0, argc) val t = args[1] val f = args[2] diff --git a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/math/logic/OpBoolNot.kt b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/math/logic/OpBoolNot.kt index b57e9c54..8c71010f 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/math/logic/OpBoolNot.kt +++ b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/math/logic/OpBoolNot.kt @@ -2,14 +2,14 @@ package at.petrak.hexcasting.common.casting.operators.math.logic import at.petrak.hexcasting.api.casting.castables.ConstMediaAction import at.petrak.hexcasting.api.casting.asActionResult -import at.petrak.hexcasting.api.casting.eval.CastingContext +import at.petrak.hexcasting.api.casting.eval.CastingEnvironment import at.petrak.hexcasting.api.casting.getBool import at.petrak.hexcasting.api.casting.iota.Iota object OpBoolNot : ConstMediaAction { override val argc = 1 - override fun execute(args: List, ctx: CastingContext): List { + override fun execute(args: List, ctx: CastingEnvironment): List { val b = args.getBool(0, argc) return (!b).asActionResult } diff --git a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/math/logic/OpBoolOr.kt b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/math/logic/OpBoolOr.kt index 983a441a..d367639a 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/math/logic/OpBoolOr.kt +++ b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/math/logic/OpBoolOr.kt @@ -2,14 +2,14 @@ package at.petrak.hexcasting.common.casting.operators.math.logic import at.petrak.hexcasting.api.casting.castables.ConstMediaAction import at.petrak.hexcasting.api.casting.asActionResult -import at.petrak.hexcasting.api.casting.eval.CastingContext +import at.petrak.hexcasting.api.casting.eval.CastingEnvironment import at.petrak.hexcasting.api.casting.getBool import at.petrak.hexcasting.api.casting.iota.Iota object OpBoolOr : ConstMediaAction { override val argc = 2 - override fun execute(args: List, ctx: CastingContext): List { + override fun execute(args: List, ctx: CastingEnvironment): List { val lhs = args.getBool(0, argc) val rhs = args.getBool(1, argc) return (lhs || rhs).asActionResult diff --git a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/math/logic/OpBoolXor.kt b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/math/logic/OpBoolXor.kt index ab88b82c..e563d484 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/math/logic/OpBoolXor.kt +++ b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/math/logic/OpBoolXor.kt @@ -2,14 +2,14 @@ package at.petrak.hexcasting.common.casting.operators.math.logic import at.petrak.hexcasting.api.casting.castables.ConstMediaAction import at.petrak.hexcasting.api.casting.asActionResult -import at.petrak.hexcasting.api.casting.eval.CastingContext +import at.petrak.hexcasting.api.casting.eval.CastingEnvironment import at.petrak.hexcasting.api.casting.getBool import at.petrak.hexcasting.api.casting.iota.Iota object OpBoolXor : ConstMediaAction { override val argc = 2 - override fun execute(args: List, ctx: CastingContext): List { + override fun execute(args: List, ctx: CastingEnvironment): List { val lhs = args.getBool(0, argc) val rhs = args.getBool(1, argc) return (lhs xor rhs).asActionResult diff --git a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/math/logic/OpCoerceToBool.kt b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/math/logic/OpCoerceToBool.kt index 2d49f62b..a7cf6de5 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/math/logic/OpCoerceToBool.kt +++ b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/math/logic/OpCoerceToBool.kt @@ -2,13 +2,13 @@ package at.petrak.hexcasting.common.casting.operators.math.logic import at.petrak.hexcasting.api.casting.castables.ConstMediaAction import at.petrak.hexcasting.api.casting.asActionResult -import at.petrak.hexcasting.api.casting.eval.CastingContext +import at.petrak.hexcasting.api.casting.eval.CastingEnvironment import at.petrak.hexcasting.api.casting.iota.Iota object OpCoerceToBool : ConstMediaAction { override val argc = 1 - override fun execute(args: List, ctx: CastingContext): List { + override fun execute(args: List, ctx: CastingEnvironment): List { return (args[0].isTruthy).asActionResult } } diff --git a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/math/logic/OpCompare.kt b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/math/logic/OpCompare.kt index 0f7a824a..abd86bd6 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/math/logic/OpCompare.kt +++ b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/math/logic/OpCompare.kt @@ -2,7 +2,7 @@ package at.petrak.hexcasting.common.casting.operators.math.logic import at.petrak.hexcasting.api.casting.castables.ConstMediaAction import at.petrak.hexcasting.api.casting.asActionResult -import at.petrak.hexcasting.api.casting.eval.CastingContext +import at.petrak.hexcasting.api.casting.eval.CastingEnvironment import at.petrak.hexcasting.api.casting.getDouble import at.petrak.hexcasting.api.casting.iota.DoubleIota import at.petrak.hexcasting.api.casting.iota.Iota @@ -11,7 +11,7 @@ import java.util.function.BiPredicate class OpCompare(val acceptsEqual: Boolean, val cmp: BiPredicate) : ConstMediaAction { override val argc = 2 - override fun execute(args: List, ctx: CastingContext): List { + override fun execute(args: List, ctx: CastingEnvironment): List { val lhs = args.getDouble(0, argc) val rhs = args.getDouble(1, argc) if (DoubleIota.tolerates(lhs, rhs)) diff --git a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/math/logic/OpEquality.kt b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/math/logic/OpEquality.kt index c7022281..eb63431e 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/math/logic/OpEquality.kt +++ b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/math/logic/OpEquality.kt @@ -2,13 +2,13 @@ package at.petrak.hexcasting.common.casting.operators.math.logic import at.petrak.hexcasting.api.casting.castables.ConstMediaAction import at.petrak.hexcasting.api.casting.asActionResult -import at.petrak.hexcasting.api.casting.eval.CastingContext +import at.petrak.hexcasting.api.casting.eval.CastingEnvironment import at.petrak.hexcasting.api.casting.iota.Iota class OpEquality(val invert: Boolean) : ConstMediaAction { override val argc = 2 - override fun execute(args: List, ctx: CastingContext): List { + override fun execute(args: List, ctx: CastingEnvironment): List { val lhs = args[0] val rhs = args[1] diff --git a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/math/trig/OpArcCos.kt b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/math/trig/OpArcCos.kt index e6c53b0b..af9a6388 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/math/trig/OpArcCos.kt +++ b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/math/trig/OpArcCos.kt @@ -2,7 +2,7 @@ package at.petrak.hexcasting.common.casting.operators.math.trig import at.petrak.hexcasting.api.casting.castables.ConstMediaAction import at.petrak.hexcasting.api.casting.asActionResult -import at.petrak.hexcasting.api.casting.eval.CastingContext +import at.petrak.hexcasting.api.casting.eval.CastingEnvironment import at.petrak.hexcasting.api.casting.getDoubleBetween import at.petrak.hexcasting.api.casting.iota.Iota import kotlin.math.acos @@ -11,7 +11,7 @@ object OpArcCos : ConstMediaAction { override val argc: Int get() = 1 - override fun execute(args: List, ctx: CastingContext): List { + override fun execute(args: List, ctx: CastingEnvironment): List { val value = args.getDoubleBetween(0, -1.0, 1.0, argc) return acos(value).asActionResult } diff --git a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/math/trig/OpArcSin.kt b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/math/trig/OpArcSin.kt index 6623c4b6..f5e0c86d 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/math/trig/OpArcSin.kt +++ b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/math/trig/OpArcSin.kt @@ -2,7 +2,7 @@ package at.petrak.hexcasting.common.casting.operators.math.trig import at.petrak.hexcasting.api.casting.castables.ConstMediaAction import at.petrak.hexcasting.api.casting.asActionResult -import at.petrak.hexcasting.api.casting.eval.CastingContext +import at.petrak.hexcasting.api.casting.eval.CastingEnvironment import at.petrak.hexcasting.api.casting.getDoubleBetween import at.petrak.hexcasting.api.casting.iota.Iota import kotlin.math.asin @@ -11,7 +11,7 @@ object OpArcSin : ConstMediaAction { override val argc: Int get() = 1 - override fun execute(args: List, ctx: CastingContext): List { + override fun execute(args: List, ctx: CastingEnvironment): List { val value = args.getDoubleBetween(0, -1.0, 1.0, OpArcCos.argc) return asin(value).asActionResult } diff --git a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/math/trig/OpArcTan.kt b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/math/trig/OpArcTan.kt index 96d71dfe..280798b2 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/math/trig/OpArcTan.kt +++ b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/math/trig/OpArcTan.kt @@ -2,7 +2,7 @@ package at.petrak.hexcasting.common.casting.operators.math.trig import at.petrak.hexcasting.api.casting.castables.ConstMediaAction import at.petrak.hexcasting.api.casting.asActionResult -import at.petrak.hexcasting.api.casting.eval.CastingContext +import at.petrak.hexcasting.api.casting.eval.CastingEnvironment import at.petrak.hexcasting.api.casting.getDouble import at.petrak.hexcasting.api.casting.iota.Iota import kotlin.math.atan @@ -11,7 +11,7 @@ object OpArcTan : ConstMediaAction { override val argc: Int get() = 1 - override fun execute(args: List, ctx: CastingContext): List { + override fun execute(args: List, ctx: CastingEnvironment): List { val value = args.getDouble(0, argc) return atan(value).asActionResult } diff --git a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/math/trig/OpArcTan2.kt b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/math/trig/OpArcTan2.kt index c020bab2..a027928f 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/math/trig/OpArcTan2.kt +++ b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/math/trig/OpArcTan2.kt @@ -2,7 +2,7 @@ package at.petrak.hexcasting.common.casting.operators.math.trig import at.petrak.hexcasting.api.casting.castables.ConstMediaAction import at.petrak.hexcasting.api.casting.asActionResult -import at.petrak.hexcasting.api.casting.eval.CastingContext +import at.petrak.hexcasting.api.casting.eval.CastingEnvironment import at.petrak.hexcasting.api.casting.getDouble import at.petrak.hexcasting.api.casting.iota.Iota import kotlin.math.atan2 @@ -11,7 +11,7 @@ object OpArcTan2 : ConstMediaAction { override val argc: Int get() = 2 - override fun execute(args: List, ctx: CastingContext): List { + override fun execute(args: List, ctx: CastingEnvironment): List { val y = args.getDouble(0, argc) val x = args.getDouble(1, argc) return atan2(y, x).asActionResult diff --git a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/math/trig/OpCos.kt b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/math/trig/OpCos.kt index 93b7a525..14c21ecd 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/math/trig/OpCos.kt +++ b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/math/trig/OpCos.kt @@ -2,7 +2,7 @@ package at.petrak.hexcasting.common.casting.operators.math.trig import at.petrak.hexcasting.api.casting.castables.ConstMediaAction import at.petrak.hexcasting.api.casting.asActionResult -import at.petrak.hexcasting.api.casting.eval.CastingContext +import at.petrak.hexcasting.api.casting.eval.CastingEnvironment import at.petrak.hexcasting.api.casting.getDouble import at.petrak.hexcasting.api.casting.iota.Iota import kotlin.math.cos @@ -11,7 +11,7 @@ object OpCos : ConstMediaAction { override val argc: Int get() = 1 - override fun execute(args: List, ctx: CastingContext): List { + override fun execute(args: List, ctx: CastingEnvironment): List { val angle = args.getDouble(0, argc) return cos(angle).asActionResult } diff --git a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/math/trig/OpSin.kt b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/math/trig/OpSin.kt index 7dd60772..67d995ad 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/math/trig/OpSin.kt +++ b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/math/trig/OpSin.kt @@ -2,7 +2,7 @@ package at.petrak.hexcasting.common.casting.operators.math.trig import at.petrak.hexcasting.api.casting.castables.ConstMediaAction import at.petrak.hexcasting.api.casting.asActionResult -import at.petrak.hexcasting.api.casting.eval.CastingContext +import at.petrak.hexcasting.api.casting.eval.CastingEnvironment import at.petrak.hexcasting.api.casting.getDouble import at.petrak.hexcasting.api.casting.iota.Iota import kotlin.math.sin @@ -11,7 +11,7 @@ object OpSin : ConstMediaAction { override val argc: Int get() = 1 - override fun execute(args: List, ctx: CastingContext): List { + override fun execute(args: List, ctx: CastingEnvironment): List { val angle = args.getDouble(0, argc) return sin(angle).asActionResult } diff --git a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/math/trig/OpTan.kt b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/math/trig/OpTan.kt index 37e701c0..d02230ef 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/math/trig/OpTan.kt +++ b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/math/trig/OpTan.kt @@ -2,7 +2,7 @@ package at.petrak.hexcasting.common.casting.operators.math.trig import at.petrak.hexcasting.api.casting.castables.ConstMediaAction import at.petrak.hexcasting.api.casting.asActionResult -import at.petrak.hexcasting.api.casting.eval.CastingContext +import at.petrak.hexcasting.api.casting.eval.CastingEnvironment import at.petrak.hexcasting.api.casting.getDouble import at.petrak.hexcasting.api.casting.iota.DoubleIota import at.petrak.hexcasting.api.casting.iota.Iota @@ -14,7 +14,7 @@ object OpTan : ConstMediaAction { override val argc: Int get() = 1 - override fun execute(args: List, ctx: CastingContext): List { + override fun execute(args: List, ctx: CastingEnvironment): List { val angle = args.getDouble(0, argc) if (cos(angle) == 0.0) throw MishapDivideByZero.tan(args[0] as DoubleIota) diff --git a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/rw/OpRead.kt b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/rw/OpRead.kt index d44199e6..17a2ffcd 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/rw/OpRead.kt +++ b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/rw/OpRead.kt @@ -1,7 +1,7 @@ package at.petrak.hexcasting.common.casting.operators.rw import at.petrak.hexcasting.api.casting.castables.ConstMediaAction -import at.petrak.hexcasting.api.casting.eval.CastingContext +import at.petrak.hexcasting.api.casting.eval.CastingEnvironment import at.petrak.hexcasting.api.casting.iota.Iota import at.petrak.hexcasting.api.casting.mishaps.MishapBadOffhandItem import at.petrak.hexcasting.xplat.IXplatAbstractions @@ -9,7 +9,7 @@ import at.petrak.hexcasting.xplat.IXplatAbstractions object OpRead : ConstMediaAction { override val argc = 0 - override fun execute(args: List, ctx: CastingContext): List { + override fun execute(args: List, ctx: CastingEnvironment): List { val (handStack, hand) = ctx.getHeldItemToOperateOn { val dataHolder = IXplatAbstractions.INSTANCE.findDataHolder(it) dataHolder != null && (dataHolder.readIota(ctx.world) != null || dataHolder.emptyIota() != null) diff --git a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/rw/OpReadable.kt b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/rw/OpReadable.kt index 7df38a70..c8bda18d 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/rw/OpReadable.kt +++ b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/rw/OpReadable.kt @@ -2,14 +2,14 @@ package at.petrak.hexcasting.common.casting.operators.rw import at.petrak.hexcasting.api.casting.castables.ConstMediaAction import at.petrak.hexcasting.api.casting.asActionResult -import at.petrak.hexcasting.api.casting.eval.CastingContext +import at.petrak.hexcasting.api.casting.eval.CastingEnvironment import at.petrak.hexcasting.api.casting.iota.Iota import at.petrak.hexcasting.xplat.IXplatAbstractions object OpReadable : ConstMediaAction { override val argc = 0 - override fun execute(args: List, ctx: CastingContext): List { + override fun execute(args: List, ctx: CastingEnvironment): List { val (handStack) = ctx.getHeldItemToOperateOn { IXplatAbstractions.INSTANCE.findDataHolder(it) != null } diff --git a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/rw/OpTheCoolerRead.kt b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/rw/OpTheCoolerRead.kt index 1d1970af..ab93d211 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/rw/OpTheCoolerRead.kt +++ b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/rw/OpTheCoolerRead.kt @@ -1,7 +1,7 @@ package at.petrak.hexcasting.common.casting.operators.rw import at.petrak.hexcasting.api.casting.castables.ConstMediaAction -import at.petrak.hexcasting.api.casting.eval.CastingContext +import at.petrak.hexcasting.api.casting.eval.CastingEnvironment import at.petrak.hexcasting.api.casting.getEntity import at.petrak.hexcasting.api.casting.iota.Iota import at.petrak.hexcasting.api.casting.mishaps.MishapBadEntity @@ -12,7 +12,7 @@ object OpTheCoolerRead : ConstMediaAction { override fun execute( args: List, - ctx: CastingContext + ctx: CastingEnvironment ): List { val target = args.getEntity(0, argc) diff --git a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/rw/OpTheCoolerReadable.kt b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/rw/OpTheCoolerReadable.kt index d07be27b..afb5277e 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/rw/OpTheCoolerReadable.kt +++ b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/rw/OpTheCoolerReadable.kt @@ -2,7 +2,7 @@ package at.petrak.hexcasting.common.casting.operators.rw import at.petrak.hexcasting.api.casting.castables.ConstMediaAction import at.petrak.hexcasting.api.casting.asActionResult -import at.petrak.hexcasting.api.casting.eval.CastingContext +import at.petrak.hexcasting.api.casting.eval.CastingEnvironment import at.petrak.hexcasting.api.casting.getEntity import at.petrak.hexcasting.api.casting.iota.Iota import at.petrak.hexcasting.xplat.IXplatAbstractions @@ -12,7 +12,7 @@ object OpTheCoolerReadable : ConstMediaAction { override fun execute( args: List, - ctx: CastingContext + ctx: CastingEnvironment ): List { val target = args.getEntity(0, argc) ctx.assertEntityInRange(target) diff --git a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/rw/OpTheCoolerWritable.kt b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/rw/OpTheCoolerWritable.kt index b500c9ae..626565be 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/rw/OpTheCoolerWritable.kt +++ b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/rw/OpTheCoolerWritable.kt @@ -2,7 +2,7 @@ package at.petrak.hexcasting.common.casting.operators.rw import at.petrak.hexcasting.api.casting.castables.ConstMediaAction import at.petrak.hexcasting.api.casting.asActionResult -import at.petrak.hexcasting.api.casting.eval.CastingContext +import at.petrak.hexcasting.api.casting.eval.CastingEnvironment import at.petrak.hexcasting.api.casting.getEntity import at.petrak.hexcasting.api.casting.iota.Iota import at.petrak.hexcasting.api.casting.iota.NullIota @@ -13,7 +13,7 @@ object OpTheCoolerWritable : ConstMediaAction { override fun execute( args: List, - ctx: CastingContext + ctx: CastingEnvironment ): List { val target = args.getEntity(0, argc) ctx.assertEntityInRange(target) diff --git a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/rw/OpTheCoolerWrite.kt b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/rw/OpTheCoolerWrite.kt index 39c33569..c337700c 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/rw/OpTheCoolerWrite.kt +++ b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/rw/OpTheCoolerWrite.kt @@ -4,7 +4,7 @@ import at.petrak.hexcasting.api.addldata.ADIotaHolder import at.petrak.hexcasting.api.casting.ParticleSpray import at.petrak.hexcasting.api.casting.RenderedSpell import at.petrak.hexcasting.api.casting.castables.SpellAction -import at.petrak.hexcasting.api.casting.eval.CastingContext +import at.petrak.hexcasting.api.casting.eval.CastingEnvironment import at.petrak.hexcasting.api.casting.getEntity import at.petrak.hexcasting.api.casting.iota.Iota import at.petrak.hexcasting.api.casting.mishaps.MishapBadEntity @@ -17,7 +17,7 @@ object OpTheCoolerWrite : SpellAction { override val argc = 2 override fun execute( args: List, - ctx: CastingContext + ctx: CastingEnvironment ): Triple> { val target = args.getEntity(0, argc) val datum = args[1] @@ -50,7 +50,7 @@ object OpTheCoolerWrite : SpellAction { } private data class Spell(val datum: Iota, val datumHolder: ADIotaHolder) : RenderedSpell { - override fun cast(ctx: CastingContext) { + override fun cast(ctx: CastingEnvironment) { datumHolder.writeIota(datum, false) } } diff --git a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/rw/OpWritable.kt b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/rw/OpWritable.kt index 725ee83e..b1c1a028 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/rw/OpWritable.kt +++ b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/rw/OpWritable.kt @@ -2,7 +2,7 @@ package at.petrak.hexcasting.common.casting.operators.rw import at.petrak.hexcasting.api.casting.castables.ConstMediaAction import at.petrak.hexcasting.api.casting.asActionResult -import at.petrak.hexcasting.api.casting.eval.CastingContext +import at.petrak.hexcasting.api.casting.eval.CastingEnvironment import at.petrak.hexcasting.api.casting.iota.Iota import at.petrak.hexcasting.api.casting.mishaps.MishapOthersName import at.petrak.hexcasting.xplat.IXplatAbstractions @@ -10,7 +10,7 @@ import at.petrak.hexcasting.xplat.IXplatAbstractions object OpWritable : ConstMediaAction { override val argc = 1 - override fun execute(args: List, ctx: CastingContext): List { + override fun execute(args: List, ctx: CastingEnvironment): List { val datum = args[0] val (handStack) = ctx.getHeldItemToOperateOn { diff --git a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/rw/OpWrite.kt b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/rw/OpWrite.kt index d89ecd77..c04ec3ed 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/rw/OpWrite.kt +++ b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/rw/OpWrite.kt @@ -4,7 +4,7 @@ import at.petrak.hexcasting.api.addldata.ADIotaHolder import at.petrak.hexcasting.api.casting.ParticleSpray import at.petrak.hexcasting.api.casting.RenderedSpell import at.petrak.hexcasting.api.casting.castables.SpellAction -import at.petrak.hexcasting.api.casting.eval.CastingContext +import at.petrak.hexcasting.api.casting.eval.CastingEnvironment import at.petrak.hexcasting.api.casting.iota.Iota import at.petrak.hexcasting.api.casting.mishaps.MishapBadOffhandItem import at.petrak.hexcasting.api.casting.mishaps.MishapOthersName @@ -15,7 +15,7 @@ object OpWrite : SpellAction { override val argc = 1 override fun execute( args: List, - ctx: CastingContext + ctx: CastingEnvironment ): Triple> { val datum = args[0] @@ -43,7 +43,7 @@ object OpWrite : SpellAction { } private data class Spell(val datum: Iota, val datumHolder: ADIotaHolder) : RenderedSpell { - override fun cast(ctx: CastingContext) { + override fun cast(ctx: CastingEnvironment) { datumHolder.writeIota(datum, false) } } diff --git a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/selectors/OpGetCaster.kt b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/selectors/OpGetCaster.kt index 66bf999e..7afe930c 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/selectors/OpGetCaster.kt +++ b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/selectors/OpGetCaster.kt @@ -2,13 +2,13 @@ package at.petrak.hexcasting.common.casting.operators.selectors import at.petrak.hexcasting.api.casting.castables.ConstMediaAction import at.petrak.hexcasting.api.casting.asActionResult -import at.petrak.hexcasting.api.casting.eval.CastingContext +import at.petrak.hexcasting.api.casting.eval.CastingEnvironment import at.petrak.hexcasting.api.casting.iota.Iota object OpGetCaster : ConstMediaAction { override val argc = 0 - override fun execute(args: List, ctx: CastingContext): List { + override fun execute(args: List, ctx: CastingEnvironment): List { ctx.assertEntityInRange(ctx.caster) return ctx.caster.asActionResult } diff --git a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/selectors/OpGetEntitiesBy.kt b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/selectors/OpGetEntitiesBy.kt index a9ed4449..c00f704b 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/selectors/OpGetEntitiesBy.kt +++ b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/selectors/OpGetEntitiesBy.kt @@ -2,7 +2,7 @@ package at.petrak.hexcasting.common.casting.operators.selectors import at.petrak.hexcasting.api.casting.castables.ConstMediaAction import at.petrak.hexcasting.api.casting.asActionResult -import at.petrak.hexcasting.api.casting.eval.CastingContext +import at.petrak.hexcasting.api.casting.eval.CastingEnvironment import at.petrak.hexcasting.api.casting.getPositiveDouble import at.petrak.hexcasting.api.casting.getVec3 import at.petrak.hexcasting.api.casting.iota.EntityIota @@ -20,7 +20,7 @@ import java.util.function.Predicate class OpGetEntitiesBy(val checker: Predicate, val negate: Boolean) : ConstMediaAction { override val argc = 2 - override fun execute(args: List, ctx: CastingContext): List { + override fun execute(args: List, ctx: CastingEnvironment): List { val pos = args.getVec3(0, argc) val radius = args.getPositiveDouble(1, argc) ctx.assertVecInRange(pos) @@ -35,7 +35,7 @@ class OpGetEntitiesBy(val checker: Predicate, val negate: Boolean) : Con } companion object { - fun isReasonablySelectable(ctx: CastingContext, e: Entity) = + fun isReasonablySelectable(ctx: CastingEnvironment, e: Entity) = ctx.isEntityInRange(e) && e.isAlive && !e.isSpectator @JvmStatic diff --git a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/selectors/OpGetEntityAt.kt b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/selectors/OpGetEntityAt.kt index c7da7d1b..62172590 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/selectors/OpGetEntityAt.kt +++ b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/selectors/OpGetEntityAt.kt @@ -2,7 +2,7 @@ package at.petrak.hexcasting.common.casting.operators.selectors import at.petrak.hexcasting.api.casting.castables.ConstMediaAction import at.petrak.hexcasting.api.casting.asActionResult -import at.petrak.hexcasting.api.casting.eval.CastingContext +import at.petrak.hexcasting.api.casting.eval.CastingEnvironment import at.petrak.hexcasting.api.casting.getVec3 import at.petrak.hexcasting.api.casting.iota.Iota import net.minecraft.world.entity.Entity @@ -12,7 +12,7 @@ import java.util.function.Predicate class OpGetEntityAt(val checker: Predicate) : ConstMediaAction { override val argc = 1 - override fun execute(args: List, ctx: CastingContext): List { + override fun execute(args: List, ctx: CastingEnvironment): List { val pos = args.getVec3(0, argc) ctx.assertVecInRange(pos) val aabb = AABB(pos.add(Vec3(-0.5, -0.5, -0.5)), pos.add(Vec3(0.5, 0.5, 0.5))) diff --git a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/spells/OpAddMotion.kt b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/spells/OpAddMotion.kt index 815cb733..2af09626 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/spells/OpAddMotion.kt +++ b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/spells/OpAddMotion.kt @@ -3,7 +3,7 @@ package at.petrak.hexcasting.common.casting.operators.spells import at.petrak.hexcasting.api.misc.MediaConstants import at.petrak.hexcasting.api.casting.* import at.petrak.hexcasting.api.casting.castables.SpellAction -import at.petrak.hexcasting.api.casting.eval.CastingContext +import at.petrak.hexcasting.api.casting.eval.CastingEnvironment import at.petrak.hexcasting.api.casting.iota.Iota import net.minecraft.world.entity.Entity import net.minecraft.world.phys.Vec3 @@ -14,7 +14,7 @@ object OpAddMotion : SpellAction { override fun execute( args: List, - ctx: CastingContext + ctx: CastingEnvironment ): Triple> { val target = args.getEntity(0, argc) val motion = args.getVec3(1, argc) @@ -38,7 +38,7 @@ object OpAddMotion : SpellAction { } private data class Spell(val target: Entity, val motion: Vec3) : RenderedSpell { - override fun cast(ctx: CastingContext) { + override fun cast(ctx: CastingEnvironment) { target.push(motion.x, motion.y, motion.z) target.hurtMarked = true // Whyyyyy } diff --git a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/spells/OpBeep.kt b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/spells/OpBeep.kt index 6febc378..007d013c 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/spells/OpBeep.kt +++ b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/spells/OpBeep.kt @@ -3,7 +3,7 @@ package at.petrak.hexcasting.common.casting.operators.spells import at.petrak.hexcasting.api.misc.MediaConstants import at.petrak.hexcasting.api.casting.* import at.petrak.hexcasting.api.casting.castables.SpellAction -import at.petrak.hexcasting.api.casting.eval.CastingContext +import at.petrak.hexcasting.api.casting.eval.CastingEnvironment import at.petrak.hexcasting.api.casting.iota.Iota import at.petrak.hexcasting.common.network.MsgBeepAck import at.petrak.hexcasting.xplat.IXplatAbstractions @@ -16,7 +16,7 @@ object OpBeep : SpellAction { override fun execute( args: List, - ctx: CastingContext + ctx: CastingEnvironment ): Triple> { val target = args.getVec3(0, argc) val instrument = args.getPositiveIntUnder(1, NoteBlockInstrument.values().size, argc) @@ -30,10 +30,10 @@ object OpBeep : SpellAction { ) } - override fun hasCastingSound(ctx: CastingContext) = false + override fun hasCastingSound(ctx: CastingEnvironment) = false private data class Spell(val target: Vec3, val note: Int, val instrument: NoteBlockInstrument) : RenderedSpell { - override fun cast(ctx: CastingContext) { + override fun cast(ctx: CastingEnvironment) { IXplatAbstractions.INSTANCE.sendPacketNear(target, 128.0, ctx.world, MsgBeepAck(target, note, instrument)) ctx.world.gameEvent(null, GameEvent.NOTE_BLOCK_PLAY, target) } diff --git a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/spells/OpBlink.kt b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/spells/OpBlink.kt index 0b15eac4..a3ee8e36 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/spells/OpBlink.kt +++ b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/spells/OpBlink.kt @@ -5,7 +5,7 @@ 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.castables.SpellAction -import at.petrak.hexcasting.api.casting.eval.CastingContext +import at.petrak.hexcasting.api.casting.eval.CastingEnvironment import at.petrak.hexcasting.api.casting.iota.Iota import at.petrak.hexcasting.api.casting.mishaps.MishapImmuneEntity import at.petrak.hexcasting.api.casting.mishaps.MishapLocationTooFarAway @@ -17,7 +17,7 @@ object OpBlink : SpellAction { override val argc = 2 override fun execute( args: List, - ctx: CastingContext + ctx: CastingEnvironment ): Triple> { val target = args.getEntity(0, argc) val delta = args.getDouble(1, argc) @@ -51,7 +51,7 @@ object OpBlink : SpellAction { } private data class Spell(val target: Entity, val delta: Double) : RenderedSpell { - override fun cast(ctx: CastingContext) { + override fun cast(ctx: CastingEnvironment) { if (!HexConfig.server().canTeleportInThisDimension(ctx.world.dimension())) return diff --git a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/spells/OpBreakBlock.kt b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/spells/OpBreakBlock.kt index dc779eb8..3b3906e8 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/spells/OpBreakBlock.kt +++ b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/spells/OpBreakBlock.kt @@ -5,7 +5,7 @@ import at.petrak.hexcasting.api.mod.HexConfig import at.petrak.hexcasting.api.casting.ParticleSpray import at.petrak.hexcasting.api.casting.RenderedSpell import at.petrak.hexcasting.api.casting.castables.SpellAction -import at.petrak.hexcasting.api.casting.eval.CastingContext +import at.petrak.hexcasting.api.casting.eval.CastingEnvironment import at.petrak.hexcasting.api.casting.getBlockPos import at.petrak.hexcasting.api.casting.iota.Iota import at.petrak.hexcasting.xplat.IXplatAbstractions @@ -18,7 +18,7 @@ object OpBreakBlock : SpellAction { override fun execute( args: List, - ctx: CastingContext + ctx: CastingEnvironment ): Triple> { val pos = args.getBlockPos(0, argc) ctx.assertVecInRange(pos) @@ -31,7 +31,7 @@ object OpBreakBlock : SpellAction { } private data class Spell(val pos: BlockPos) : RenderedSpell { - override fun cast(ctx: CastingContext) { + override fun cast(ctx: CastingEnvironment) { if (!ctx.canEditBlockAt(pos)) return diff --git a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/spells/OpColorize.kt b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/spells/OpColorize.kt index 9fe56d63..79dafa09 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/spells/OpColorize.kt +++ b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/spells/OpColorize.kt @@ -6,7 +6,7 @@ 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.castables.SpellAction -import at.petrak.hexcasting.api.casting.eval.CastingContext +import at.petrak.hexcasting.api.casting.eval.CastingEnvironment import at.petrak.hexcasting.api.casting.mishaps.MishapBadOffhandItem import at.petrak.hexcasting.xplat.IXplatAbstractions import net.minecraft.world.item.ItemStack @@ -16,7 +16,7 @@ object OpColorize : SpellAction { override fun execute( args: List, - ctx: CastingContext + ctx: CastingEnvironment ): Triple> { val (handStack, hand) = ctx.getHeldItemToOperateOn(IXplatAbstractions.INSTANCE::isColorizer) if (!IXplatAbstractions.INSTANCE.isColorizer(handStack)) { @@ -34,7 +34,7 @@ object OpColorize : SpellAction { } private data class Spell(val stack: ItemStack) : RenderedSpell { - override fun cast(ctx: CastingContext) { + override fun cast(ctx: CastingEnvironment) { val copy = stack.copy() if (ctx.withdrawItem(copy, 1, true)) { IXplatAbstractions.INSTANCE.setColorizer( diff --git a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/spells/OpConjureBlock.kt b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/spells/OpConjureBlock.kt index da3b9b43..cd67c2bd 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/spells/OpConjureBlock.kt +++ b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/spells/OpConjureBlock.kt @@ -4,7 +4,7 @@ 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.castables.SpellAction -import at.petrak.hexcasting.api.casting.eval.CastingContext +import at.petrak.hexcasting.api.casting.eval.CastingEnvironment import at.petrak.hexcasting.api.casting.getBlockPos import at.petrak.hexcasting.api.casting.iota.Iota import at.petrak.hexcasting.api.casting.mishaps.MishapBadBlock @@ -21,7 +21,7 @@ class OpConjureBlock(val light: Boolean) : SpellAction { override val argc = 1 override fun execute( args: List, - ctx: CastingContext + ctx: CastingEnvironment ): Triple>? { val pos = args.getBlockPos(0, argc) ctx.assertVecInRange(pos) @@ -43,7 +43,7 @@ class OpConjureBlock(val light: Boolean) : SpellAction { } private data class Spell(val pos: BlockPos, val light: Boolean) : RenderedSpell { - override fun cast(ctx: CastingContext) { + override fun cast(ctx: CastingEnvironment) { if (!ctx.canEditBlockAt(pos)) return 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 2b40763b..4f7070d9 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 @@ -3,7 +3,7 @@ package at.petrak.hexcasting.common.casting.operators.spells import at.petrak.hexcasting.api.casting.ParticleSpray import at.petrak.hexcasting.api.casting.RenderedSpell import at.petrak.hexcasting.api.casting.castables.SpellAction -import at.petrak.hexcasting.api.casting.eval.CastingContext +import at.petrak.hexcasting.api.casting.eval.CastingEnvironment import at.petrak.hexcasting.api.casting.getBlockPos import at.petrak.hexcasting.api.casting.iota.Iota import at.petrak.hexcasting.xplat.IXplatAbstractions @@ -20,7 +20,7 @@ class OpCreateFluid(val cost: Int, val bucket: Item, val cauldron: BlockState, v override val argc = 1 override fun execute( args: List, - ctx: CastingContext + ctx: CastingEnvironment ): Triple> { val target = args.getBlockPos(0, argc) ctx.assertVecInRange(target) @@ -33,7 +33,7 @@ class OpCreateFluid(val cost: Int, val bucket: Item, val cauldron: BlockState, v } private data class Spell(val pos: BlockPos, val bucket: Item, val cauldron: BlockState, val fluid: Fluid) : RenderedSpell { - override fun cast(ctx: CastingContext) { + override fun cast(ctx: CastingEnvironment) { if (!ctx.canEditBlockAt(pos) || !IXplatAbstractions.INSTANCE.isPlacingAllowed( ctx.world, pos, diff --git a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/spells/OpDestroyFluid.kt b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/spells/OpDestroyFluid.kt index 6bcf9828..889c6174 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/spells/OpDestroyFluid.kt +++ b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/spells/OpDestroyFluid.kt @@ -4,7 +4,7 @@ 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.castables.SpellAction -import at.petrak.hexcasting.api.casting.eval.CastingContext +import at.petrak.hexcasting.api.casting.eval.CastingEnvironment import at.petrak.hexcasting.api.casting.getBlockPos import at.petrak.hexcasting.api.casting.iota.Iota import at.petrak.hexcasting.xplat.IXplatAbstractions @@ -23,7 +23,7 @@ object OpDestroyFluid : SpellAction { override val argc = 1 override fun execute( args: List, - ctx: CastingContext + ctx: CastingEnvironment ): Triple> { val target = args.getBlockPos(0, argc) ctx.assertVecInRange(target) @@ -39,7 +39,7 @@ object OpDestroyFluid : SpellAction { private data class Spell(val basePos: BlockPos) : RenderedSpell { - override fun cast(ctx: CastingContext) { + override fun cast(ctx: CastingEnvironment) { // Try draining from fluid handlers first, and if so, don't do the normal behavior if (ctx.canEditBlockAt(basePos)) { diff --git a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/spells/OpEdifySapling.kt b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/spells/OpEdifySapling.kt index 4794d306..e2379c78 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/spells/OpEdifySapling.kt +++ b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/spells/OpEdifySapling.kt @@ -4,7 +4,7 @@ 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.castables.SpellAction -import at.petrak.hexcasting.api.casting.eval.CastingContext +import at.petrak.hexcasting.api.casting.eval.CastingEnvironment import at.petrak.hexcasting.api.casting.getBlockPos import at.petrak.hexcasting.api.casting.iota.Iota import at.petrak.hexcasting.api.casting.mishaps.MishapBadBlock @@ -19,7 +19,7 @@ object OpEdifySapling : SpellAction { override fun execute( args: List, - ctx: CastingContext + ctx: CastingEnvironment ): Triple> { val pos = args.getBlockPos(0, argc) val bs = ctx.world.getBlockState(pos) @@ -34,7 +34,7 @@ object OpEdifySapling : SpellAction { } private data class Spell(val pos: BlockPos) : RenderedSpell { - override fun cast(ctx: CastingContext) { + override fun cast(ctx: CastingEnvironment) { val blockstate = ctx.world.getBlockState(pos) if (!ctx.canEditBlockAt(pos) || !IXplatAbstractions.INSTANCE.isBreakingAllowed(ctx.world, pos, blockstate, ctx.caster) diff --git a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/spells/OpErase.kt b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/spells/OpErase.kt index dd5f435d..2b5a293d 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/spells/OpErase.kt +++ b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/spells/OpErase.kt @@ -4,7 +4,7 @@ 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.castables.SpellAction -import at.petrak.hexcasting.api.casting.eval.CastingContext +import at.petrak.hexcasting.api.casting.eval.CastingEnvironment import at.petrak.hexcasting.api.casting.iota.Iota import at.petrak.hexcasting.api.casting.mishaps.MishapBadOffhandItem import at.petrak.hexcasting.xplat.IXplatAbstractions @@ -15,7 +15,7 @@ object OpErase : SpellAction { override fun execute( args: List, - ctx: CastingContext + ctx: CastingEnvironment ): Triple> { val (handStack, hand) = ctx.getHeldItemToOperateOn { val hexHolder = IXplatAbstractions.INSTANCE.findHexHolder(it) @@ -40,7 +40,7 @@ object OpErase : SpellAction { } private data class Spell(val stack: ItemStack) : RenderedSpell { - override fun cast(ctx: CastingContext) { + override fun cast(ctx: CastingEnvironment) { val hexHolder = IXplatAbstractions.INSTANCE.findHexHolder(stack) val datumHolder = IXplatAbstractions.INSTANCE.findDataHolder(stack) diff --git a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/spells/OpExplode.kt b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/spells/OpExplode.kt index 110c0ad5..fdd33bfe 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/spells/OpExplode.kt +++ b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/spells/OpExplode.kt @@ -3,7 +3,7 @@ package at.petrak.hexcasting.common.casting.operators.spells import at.petrak.hexcasting.api.misc.MediaConstants import at.petrak.hexcasting.api.casting.* import at.petrak.hexcasting.api.casting.castables.SpellAction -import at.petrak.hexcasting.api.casting.eval.CastingContext +import at.petrak.hexcasting.api.casting.eval.CastingEnvironment import at.petrak.hexcasting.api.casting.iota.Iota import net.minecraft.core.BlockPos import net.minecraft.util.Mth @@ -16,7 +16,7 @@ class OpExplode(val fire: Boolean) : SpellAction { override fun execute( args: List, - ctx: CastingContext + ctx: CastingEnvironment ): Triple> { val pos = args.getVec3(0, argc) val strength = args.getPositiveDoubleUnderInclusive(1, 10.0, argc) @@ -31,7 +31,7 @@ class OpExplode(val fire: Boolean) : SpellAction { } private data class Spell(val pos: Vec3, val strength: Double, val fire: Boolean) : RenderedSpell { - override fun cast(ctx: CastingContext) { + override fun cast(ctx: CastingEnvironment) { // TODO: you can use this to explode things *outside* of the worldborder? if (!ctx.canEditBlockAt(BlockPos(pos))) return diff --git a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/spells/OpExtinguish.kt b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/spells/OpExtinguish.kt index 4730839a..f393142b 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/spells/OpExtinguish.kt +++ b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/spells/OpExtinguish.kt @@ -4,7 +4,7 @@ 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.castables.SpellAction -import at.petrak.hexcasting.api.casting.eval.CastingContext +import at.petrak.hexcasting.api.casting.eval.CastingEnvironment import at.petrak.hexcasting.api.casting.getBlockPos import at.petrak.hexcasting.api.casting.iota.Iota import at.petrak.hexcasting.ktxt.UseOnContext @@ -25,7 +25,7 @@ object OpExtinguish : SpellAction { override val argc = 1 override fun execute( args: List, - ctx: CastingContext + ctx: CastingEnvironment ): Triple> { val target = args.getBlockPos(0, argc) ctx.assertVecInRange(target) @@ -40,7 +40,7 @@ object OpExtinguish : SpellAction { const val MAX_DESTROY_COUNT = 1024 private data class Spell(val target: BlockPos) : RenderedSpell { - override fun cast(ctx: CastingContext) { + override fun cast(ctx: CastingEnvironment) { // how many levels of "borrowed" code are we on now val todo = ArrayDeque() val seen = HashSet() diff --git a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/spells/OpIgnite.kt b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/spells/OpIgnite.kt index 676a4957..42bd8dc4 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/spells/OpIgnite.kt +++ b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/spells/OpIgnite.kt @@ -4,7 +4,7 @@ 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.castables.SpellAction -import at.petrak.hexcasting.api.casting.eval.CastingContext +import at.petrak.hexcasting.api.casting.eval.CastingEnvironment import at.petrak.hexcasting.api.casting.getBlockPos import at.petrak.hexcasting.api.casting.iota.Iota import at.petrak.hexcasting.ktxt.UseOnContext @@ -22,7 +22,7 @@ object OpIgnite : SpellAction { override val argc = 1 override fun execute( args: List, - ctx: CastingContext + ctx: CastingEnvironment ): Triple> { val target = args.getBlockPos(0, argc) ctx.assertVecInRange(target) @@ -35,7 +35,7 @@ object OpIgnite : SpellAction { } private data class Spell(val pos: BlockPos) : RenderedSpell { - override fun cast(ctx: CastingContext) { + override fun cast(ctx: CastingEnvironment) { if (!ctx.canEditBlockAt(pos)) return @@ -45,7 +45,7 @@ object OpIgnite : SpellAction { } } - fun tryToClick(ctx: CastingContext, pos: BlockPos, item: Item): Boolean { + fun tryToClick(ctx: CastingEnvironment, pos: BlockPos, item: Item): Boolean { return IXplatAbstractions.INSTANCE.isPlacingAllowed(ctx.world, pos, ItemStack(item), ctx.caster) && item.useOn( UseOnContext( 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 d98eca51..03b1adfc 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 @@ -3,7 +3,7 @@ package at.petrak.hexcasting.common.casting.operators.spells import at.petrak.hexcasting.api.casting.ParticleSpray import at.petrak.hexcasting.api.casting.RenderedSpell import at.petrak.hexcasting.api.casting.castables.SpellAction -import at.petrak.hexcasting.api.casting.eval.CastingContext +import at.petrak.hexcasting.api.casting.eval.CastingEnvironment import at.petrak.hexcasting.api.casting.getItemEntity import at.petrak.hexcasting.api.casting.iota.Iota import at.petrak.hexcasting.api.casting.mishaps.MishapBadItem @@ -23,7 +23,7 @@ object OpMakeBattery : SpellAction { override fun execute( args: List, - ctx: CastingContext + ctx: CastingEnvironment ): Triple> { val entity = args.getItemEntity(0, argc) @@ -63,7 +63,7 @@ object OpMakeBattery : SpellAction { } private data class Spell(val itemEntity: ItemEntity, val hand: InteractionHand) : RenderedSpell { - override fun cast(ctx: CastingContext) { + override fun cast(ctx: CastingEnvironment) { if (itemEntity.isAlive) { val entityStack = itemEntity.item.copy() val mediamount = extractMedia(entityStack, drainForBatteries = true) diff --git a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/spells/OpMakePackagedSpell.kt b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/spells/OpMakePackagedSpell.kt index 0357da09..a875f504 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/spells/OpMakePackagedSpell.kt +++ b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/spells/OpMakePackagedSpell.kt @@ -2,7 +2,7 @@ package at.petrak.hexcasting.common.casting.operators.spells import at.petrak.hexcasting.api.casting.* import at.petrak.hexcasting.api.casting.castables.SpellAction -import at.petrak.hexcasting.api.casting.eval.CastingContext +import at.petrak.hexcasting.api.casting.eval.CastingEnvironment import at.petrak.hexcasting.api.casting.iota.Iota import at.petrak.hexcasting.api.casting.mishaps.MishapBadItem import at.petrak.hexcasting.api.casting.mishaps.MishapBadOffhandItem @@ -18,7 +18,7 @@ class OpMakePackagedSpell(val itemType: T, val cost: Int) : override val argc = 2 override fun execute( args: List, - ctx: CastingContext + ctx: CastingEnvironment ): Triple> { val entity = args.getItemEntity(0, argc) val patterns = args.getList(1, argc).toList() @@ -55,7 +55,7 @@ class OpMakePackagedSpell(val itemType: T, val cost: Int) : } private inner class Spell(val itemEntity: ItemEntity, val patterns: List, val stack: ItemStack) : RenderedSpell { - override fun cast(ctx: CastingContext) { + override fun cast(ctx: CastingEnvironment) { val hexHolder = IXplatAbstractions.INSTANCE.findHexHolder(stack) if (hexHolder != null && !hexHolder.hasHex() diff --git a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/spells/OpPlaceBlock.kt b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/spells/OpPlaceBlock.kt index b2878588..e04e3a4f 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/spells/OpPlaceBlock.kt +++ b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/spells/OpPlaceBlock.kt @@ -4,7 +4,7 @@ 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.castables.SpellAction -import at.petrak.hexcasting.api.casting.eval.CastingContext +import at.petrak.hexcasting.api.casting.eval.CastingEnvironment import at.petrak.hexcasting.api.casting.getBlockPos import at.petrak.hexcasting.api.casting.iota.Iota import at.petrak.hexcasting.api.casting.mishaps.MishapBadBlock @@ -26,7 +26,7 @@ object OpPlaceBlock : SpellAction { override fun execute( args: List, - ctx: CastingContext + ctx: CastingEnvironment ): Triple>? { val pos = args.getBlockPos(0, argc) ctx.assertVecInRange(pos) @@ -49,7 +49,7 @@ object OpPlaceBlock : SpellAction { } private data class Spell(val pos: BlockPos) : RenderedSpell { - override fun cast(ctx: CastingContext) { + override fun cast(ctx: CastingEnvironment) { if (!ctx.canEditBlockAt(pos)) return 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 e6787d90..a4895a95 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 @@ -2,7 +2,7 @@ package at.petrak.hexcasting.common.casting.operators.spells import at.petrak.hexcasting.api.casting.* import at.petrak.hexcasting.api.casting.castables.SpellAction -import at.petrak.hexcasting.api.casting.eval.CastingContext +import at.petrak.hexcasting.api.casting.eval.CastingEnvironment import at.petrak.hexcasting.api.casting.iota.Iota import net.minecraft.world.effect.MobEffect import net.minecraft.world.effect.MobEffectInstance @@ -19,7 +19,7 @@ class OpPotionEffect( override fun execute( args: List, - ctx: CastingContext + ctx: CastingEnvironment ): Triple> { val target = args.getLivingEntityButNotArmorStand(0, argc) val duration = args.getPositiveDouble(1, argc) @@ -43,7 +43,7 @@ class OpPotionEffect( private class Spell(val effect: MobEffect, val target: LivingEntity, val duration: Double, val potency: Double) : RenderedSpell { - override fun cast(ctx: CastingContext) { + override fun cast(ctx: CastingEnvironment) { if (duration > 1.0 / 20.0) { val effectInst = MobEffectInstance(effect, (duration * 20).toInt(), potency.toInt() - 1) target.addEffect(effectInst) diff --git a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/spells/OpPrint.kt b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/spells/OpPrint.kt index b95723b0..243b0d9f 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/spells/OpPrint.kt +++ b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/spells/OpPrint.kt @@ -3,7 +3,7 @@ package at.petrak.hexcasting.common.casting.operators.spells import at.petrak.hexcasting.api.casting.castables.Action import at.petrak.hexcasting.api.casting.OperationResult import at.petrak.hexcasting.api.casting.RenderedSpell -import at.petrak.hexcasting.api.casting.eval.CastingContext +import at.petrak.hexcasting.api.casting.eval.CastingEnvironment import at.petrak.hexcasting.api.casting.eval.vm.SpellContinuation import at.petrak.hexcasting.api.casting.eval.sideeffects.OperatorSideEffect import at.petrak.hexcasting.api.casting.iota.Iota @@ -15,7 +15,7 @@ object OpPrint : Action { continuation: SpellContinuation, stack: MutableList, ravenmind: Iota?, - ctx: CastingContext + ctx: CastingEnvironment ): OperationResult { if (stack.isEmpty()) { throw MishapNotEnoughArgs(1, 0) @@ -29,7 +29,7 @@ object OpPrint : Action { } private data class Spell(val datum: Iota) : RenderedSpell { - override fun cast(ctx: CastingContext) { + override fun cast(ctx: CastingEnvironment) { ctx.caster.sendSystemMessage(datum.display()) } } diff --git a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/spells/OpRecharge.kt b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/spells/OpRecharge.kt index 3aa87e2a..374da43d 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/spells/OpRecharge.kt +++ b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/spells/OpRecharge.kt @@ -4,7 +4,7 @@ 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.castables.SpellAction -import at.petrak.hexcasting.api.casting.eval.CastingContext +import at.petrak.hexcasting.api.casting.eval.CastingEnvironment import at.petrak.hexcasting.api.casting.getItemEntity import at.petrak.hexcasting.api.casting.iota.Iota import at.petrak.hexcasting.api.casting.mishaps.MishapBadItem @@ -19,7 +19,7 @@ object OpRecharge : SpellAction { override val argc = 1 override fun execute( args: List, - ctx: CastingContext + ctx: CastingEnvironment ): Triple>? { val entity = args.getItemEntity(0, argc) @@ -57,7 +57,7 @@ object OpRecharge : SpellAction { } private data class Spell(val itemEntity: ItemEntity, val stack: ItemStack) : RenderedSpell { - override fun cast(ctx: CastingContext) { + override fun cast(ctx: CastingEnvironment) { val media = IXplatAbstractions.INSTANCE.findMediaHolder(stack) if (media != null && itemEntity.isAlive) { diff --git a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/spells/OpTheOnlyReasonAnyoneDownloadedPsi.kt b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/spells/OpTheOnlyReasonAnyoneDownloadedPsi.kt index 693fe1f5..a7019786 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/spells/OpTheOnlyReasonAnyoneDownloadedPsi.kt +++ b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/spells/OpTheOnlyReasonAnyoneDownloadedPsi.kt @@ -4,7 +4,7 @@ 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.castables.SpellAction -import at.petrak.hexcasting.api.casting.eval.CastingContext +import at.petrak.hexcasting.api.casting.eval.CastingEnvironment import at.petrak.hexcasting.api.casting.getBlockPos import at.petrak.hexcasting.api.casting.iota.Iota import net.minecraft.core.BlockPos @@ -21,7 +21,7 @@ object OpTheOnlyReasonAnyoneDownloadedPsi : SpellAction { override val argc = 1 override fun execute( args: List, - ctx: CastingContext + ctx: CastingEnvironment ): Triple> { val target = args.getBlockPos(0, argc) @@ -33,7 +33,7 @@ object OpTheOnlyReasonAnyoneDownloadedPsi : SpellAction { } private data class Spell(val pos: BlockPos) : RenderedSpell { - override fun cast(ctx: CastingContext) { + override fun cast(ctx: CastingEnvironment) { // https://github.com/VazkiiMods/Psi/blob/master/src/main/java/vazkii/psi/common/spell/trick/PieceTrickOvergrow.java if (!ctx.world.mayInteract(ctx.caster, pos)) return 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 87a1f70f..9c3be9f7 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 @@ -2,7 +2,7 @@ package at.petrak.hexcasting.common.casting.operators.spells.great import at.petrak.hexcasting.api.casting.* import at.petrak.hexcasting.api.casting.castables.SpellAction -import at.petrak.hexcasting.api.casting.eval.CastingContext +import at.petrak.hexcasting.api.casting.eval.CastingEnvironment import at.petrak.hexcasting.api.casting.iota.Iota import at.petrak.hexcasting.api.casting.mishaps.MishapAlreadyBrainswept import at.petrak.hexcasting.api.casting.mishaps.MishapBadBrainsweep @@ -24,11 +24,11 @@ object OpBrainsweep : SpellAction { override val argc = 2 // this way you can hear the villager dying more : ) - override fun hasCastingSound(ctx: CastingContext) = false + override fun hasCastingSound(ctx: CastingEnvironment) = false override fun execute( args: List, - ctx: CastingContext + ctx: CastingEnvironment ): Triple>? { val sacrifice = args.getMob(0, argc) val pos = args.getBlockPos(1, argc) @@ -61,7 +61,7 @@ object OpBrainsweep : SpellAction { val sacrifice: Mob, val recipe: BrainsweepRecipe ) : RenderedSpell { - override fun cast(ctx: CastingContext) { + override fun cast(ctx: CastingEnvironment) { ctx.world.setBlockAndUpdate(pos, BrainsweepRecipe.copyProperties(state, recipe.result)) IXplatAbstractions.INSTANCE.brainsweep(sacrifice) 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 a3d260b1..cde53033 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 @@ -2,7 +2,7 @@ package at.petrak.hexcasting.common.casting.operators.spells.great import at.petrak.hexcasting.api.casting.* import at.petrak.hexcasting.api.casting.castables.SpellAction -import at.petrak.hexcasting.api.casting.eval.CastingContext +import at.petrak.hexcasting.api.casting.eval.CastingEnvironment import at.petrak.hexcasting.api.casting.iota.Iota import at.petrak.hexcasting.api.misc.MediaConstants import at.petrak.hexcasting.api.player.FlightAbility @@ -17,7 +17,7 @@ object OpFlight : SpellAction { override val argc = 3 override fun execute( args: List, - ctx: CastingContext + ctx: CastingEnvironment ): Triple> { val target = args.getPlayer(0, argc) val timeRaw = args.getPositiveDouble(1, argc) @@ -34,7 +34,7 @@ object OpFlight : SpellAction { } data class Spell(val target: ServerPlayer, val time: Int, val radius: Double, val origin: Vec3) : RenderedSpell { - override fun cast(ctx: CastingContext) { + override fun cast(ctx: CastingEnvironment) { if (target.abilities.mayfly) { // Don't accidentally clobber someone else's flight return 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 ee4cb8ed..42cdc841 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 @@ -3,7 +3,7 @@ package at.petrak.hexcasting.common.casting.operators.spells.great import at.petrak.hexcasting.api.casting.ParticleSpray import at.petrak.hexcasting.api.casting.RenderedSpell import at.petrak.hexcasting.api.casting.castables.SpellAction -import at.petrak.hexcasting.api.casting.eval.CastingContext +import at.petrak.hexcasting.api.casting.eval.CastingEnvironment import at.petrak.hexcasting.api.casting.getVec3 import at.petrak.hexcasting.api.casting.iota.Iota import at.petrak.hexcasting.api.misc.MediaConstants @@ -17,7 +17,7 @@ object OpLightning : SpellAction { override fun execute( args: List, - ctx: CastingContext + ctx: CastingEnvironment ): Triple> { val target = args.getVec3(0, argc) ctx.assertVecInRange(target) @@ -29,7 +29,7 @@ object OpLightning : SpellAction { } private data class Spell(val target: Vec3) : RenderedSpell { - override fun cast(ctx: CastingContext) { + override fun cast(ctx: CastingEnvironment) { if (!ctx.world.mayInteract(ctx.caster, BlockPos(target))) return 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 348ced29..dcaad7e3 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 @@ -2,7 +2,7 @@ package at.petrak.hexcasting.common.casting.operators.spells.great import at.petrak.hexcasting.api.casting.* import at.petrak.hexcasting.api.casting.castables.SpellAction -import at.petrak.hexcasting.api.casting.eval.CastingContext +import at.petrak.hexcasting.api.casting.eval.CastingEnvironment import at.petrak.hexcasting.api.casting.iota.Iota import at.petrak.hexcasting.api.casting.mishaps.MishapImmuneEntity import at.petrak.hexcasting.api.casting.mishaps.MishapLocationTooFarAway @@ -26,7 +26,7 @@ object OpTeleport : SpellAction { override val argc = 2 override fun execute( args: List, - ctx: CastingContext + ctx: CastingEnvironment ): Triple> { val teleportee = args.getEntity(0, argc) @@ -56,7 +56,7 @@ object OpTeleport : SpellAction { } private data class Spell(val teleportee: Entity, val delta: Vec3) : RenderedSpell { - override fun cast(ctx: CastingContext) { + override fun cast(ctx: CastingEnvironment) { val distance = delta.length() // TODO make this not a magic number (config?) 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 2e6979ff..49e8e942 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 @@ -3,7 +3,7 @@ package at.petrak.hexcasting.common.casting.operators.spells.great import at.petrak.hexcasting.api.casting.ParticleSpray import at.petrak.hexcasting.api.casting.RenderedSpell import at.petrak.hexcasting.api.casting.castables.SpellAction -import at.petrak.hexcasting.api.casting.eval.CastingContext +import at.petrak.hexcasting.api.casting.eval.CastingEnvironment import at.petrak.hexcasting.api.casting.iota.Iota import at.petrak.hexcasting.api.misc.MediaConstants @@ -12,7 +12,7 @@ class OpWeather(val rain: Boolean) : SpellAction { override fun execute( args: List, - ctx: CastingContext + ctx: CastingEnvironment ): Triple>? { if (ctx.world.isRaining == rain) return null @@ -25,7 +25,7 @@ class OpWeather(val rain: Boolean) : SpellAction { } private data class Spell(val rain: Boolean) : RenderedSpell { - override fun cast(ctx: CastingContext) { + override fun cast(ctx: CastingEnvironment) { val w = ctx.world if (w.isRaining != rain) { w.levelData.isRaining = rain // i hex the rains down in minecraftia 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 2cb26eee..5244ec72 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 @@ -3,7 +3,7 @@ package at.petrak.hexcasting.common.casting.operators.spells.sentinel import at.petrak.hexcasting.api.casting.ParticleSpray import at.petrak.hexcasting.api.casting.RenderedSpell import at.petrak.hexcasting.api.casting.castables.SpellAction -import at.petrak.hexcasting.api.casting.eval.CastingContext +import at.petrak.hexcasting.api.casting.eval.CastingEnvironment import at.petrak.hexcasting.api.casting.getVec3 import at.petrak.hexcasting.api.casting.iota.Iota import at.petrak.hexcasting.api.misc.MediaConstants @@ -16,7 +16,7 @@ class OpCreateSentinel(val extendsRange: Boolean) : SpellAction { override fun execute( args: List, - ctx: CastingContext + ctx: CastingEnvironment ): Triple> { val target = args.getVec3(0, argc) ctx.assertVecInRange(target) @@ -29,7 +29,7 @@ class OpCreateSentinel(val extendsRange: Boolean) : SpellAction { } private data class Spell(val target: Vec3, val extendsRange: Boolean) : RenderedSpell { - override fun cast(ctx: CastingContext) { + override fun cast(ctx: CastingEnvironment) { IXplatAbstractions.INSTANCE.setSentinel( ctx.caster, Sentinel( diff --git a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/spells/sentinel/OpDestroySentinel.kt b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/spells/sentinel/OpDestroySentinel.kt index 7d55496c..2d4bdb99 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/spells/sentinel/OpDestroySentinel.kt +++ b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/spells/sentinel/OpDestroySentinel.kt @@ -7,7 +7,7 @@ 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.castables.SpellAction -import at.petrak.hexcasting.api.casting.eval.CastingContext +import at.petrak.hexcasting.api.casting.eval.CastingEnvironment import at.petrak.hexcasting.api.casting.mishaps.MishapLocationInWrongDimension import at.petrak.hexcasting.xplat.IXplatAbstractions @@ -15,7 +15,7 @@ object OpDestroySentinel : SpellAction { override val argc = 0 override fun execute( args: List, - ctx: CastingContext + ctx: CastingEnvironment ): Triple> { val particles = mutableListOf() val sentinel = IXplatAbstractions.INSTANCE.getSentinel(ctx.caster) @@ -32,7 +32,7 @@ object OpDestroySentinel : SpellAction { } private object Spell : RenderedSpell { - override fun cast(ctx: CastingContext) { + override fun cast(ctx: CastingEnvironment) { IXplatAbstractions.INSTANCE.setSentinel(ctx.caster, Sentinel.none()) } } diff --git a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/spells/sentinel/OpGetSentinelPos.kt b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/spells/sentinel/OpGetSentinelPos.kt index 7179d318..71dc5827 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/spells/sentinel/OpGetSentinelPos.kt +++ b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/spells/sentinel/OpGetSentinelPos.kt @@ -3,7 +3,7 @@ package at.petrak.hexcasting.common.casting.operators.spells.sentinel import at.petrak.hexcasting.api.misc.MediaConstants import at.petrak.hexcasting.api.casting.castables.ConstMediaAction import at.petrak.hexcasting.api.casting.asActionResult -import at.petrak.hexcasting.api.casting.eval.CastingContext +import at.petrak.hexcasting.api.casting.eval.CastingEnvironment import at.petrak.hexcasting.api.casting.iota.Iota import at.petrak.hexcasting.api.casting.iota.NullIota import at.petrak.hexcasting.api.casting.mishaps.MishapLocationInWrongDimension @@ -12,7 +12,7 @@ import at.petrak.hexcasting.xplat.IXplatAbstractions object OpGetSentinelPos : ConstMediaAction { override val argc = 0 override val mediaCost = MediaConstants.DUST_UNIT / 10 - override fun execute(args: List, ctx: CastingContext): List { + override fun execute(args: List, ctx: CastingEnvironment): List { val sentinel = IXplatAbstractions.INSTANCE.getSentinel(ctx.caster) if (sentinel.dimension != ctx.world.dimension()) throw MishapLocationInWrongDimension(sentinel.dimension.location()) diff --git a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/spells/sentinel/OpGetSentinelWayfind.kt b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/spells/sentinel/OpGetSentinelWayfind.kt index 89169ef5..2070fb06 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/spells/sentinel/OpGetSentinelWayfind.kt +++ b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/spells/sentinel/OpGetSentinelWayfind.kt @@ -3,7 +3,7 @@ package at.petrak.hexcasting.common.casting.operators.spells.sentinel import at.petrak.hexcasting.api.misc.MediaConstants import at.petrak.hexcasting.api.casting.castables.ConstMediaAction import at.petrak.hexcasting.api.casting.asActionResult -import at.petrak.hexcasting.api.casting.eval.CastingContext +import at.petrak.hexcasting.api.casting.eval.CastingEnvironment import at.petrak.hexcasting.api.casting.getVec3 import at.petrak.hexcasting.api.casting.iota.Iota import at.petrak.hexcasting.api.casting.iota.NullIota @@ -15,7 +15,7 @@ import at.petrak.hexcasting.xplat.IXplatAbstractions object OpGetSentinelWayfind : ConstMediaAction { override val argc = 1 override val mediaCost = MediaConstants.DUST_UNIT / 10 - override fun execute(args: List, ctx: CastingContext): List { + override fun execute(args: List, ctx: CastingEnvironment): List { val from = args.getVec3(0, argc) val sentinel = IXplatAbstractions.INSTANCE.getSentinel(ctx.caster) diff --git a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/stack/OpAlwinfyHasAscendedToABeingOfPureMath.kt b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/stack/OpAlwinfyHasAscendedToABeingOfPureMath.kt index af1582fc..f85da335 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/stack/OpAlwinfyHasAscendedToABeingOfPureMath.kt +++ b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/stack/OpAlwinfyHasAscendedToABeingOfPureMath.kt @@ -2,7 +2,7 @@ package at.petrak.hexcasting.common.casting.operators.stack import at.petrak.hexcasting.api.casting.castables.Action import at.petrak.hexcasting.api.casting.OperationResult -import at.petrak.hexcasting.api.casting.eval.CastingContext +import at.petrak.hexcasting.api.casting.eval.CastingEnvironment import at.petrak.hexcasting.api.casting.eval.vm.SpellContinuation import at.petrak.hexcasting.api.casting.getPositiveInt import at.petrak.hexcasting.api.casting.iota.Iota @@ -15,7 +15,7 @@ object OpAlwinfyHasAscendedToABeingOfPureMath : Action { continuation: SpellContinuation, stack: MutableList, ravenmind: Iota?, - ctx: CastingContext + ctx: CastingEnvironment ): OperationResult { if (stack.isEmpty()) throw MishapNotEnoughArgs(1, 0) diff --git a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/stack/OpBitMask.kt b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/stack/OpBitMask.kt index a724b694..e313f3a8 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/stack/OpBitMask.kt +++ b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/stack/OpBitMask.kt @@ -2,7 +2,7 @@ package at.petrak.hexcasting.common.casting.operators.stack import at.petrak.hexcasting.api.casting.castables.Action import at.petrak.hexcasting.api.casting.OperationResult -import at.petrak.hexcasting.api.casting.eval.CastingContext +import at.petrak.hexcasting.api.casting.eval.CastingEnvironment import at.petrak.hexcasting.api.casting.eval.vm.SpellContinuation import at.petrak.hexcasting.api.casting.getPositiveInt import at.petrak.hexcasting.api.casting.iota.Iota @@ -15,7 +15,7 @@ object OpBitMask : Action { continuation: SpellContinuation, stack: MutableList, ravenmind: Iota?, - ctx: CastingContext + ctx: CastingEnvironment ): OperationResult { if (stack.size < 1) throw MishapNotEnoughArgs(1, 0) diff --git a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/stack/OpDuplicateN.kt b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/stack/OpDuplicateN.kt index 751b0678..b97dc898 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/stack/OpDuplicateN.kt +++ b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/stack/OpDuplicateN.kt @@ -1,7 +1,7 @@ package at.petrak.hexcasting.common.casting.operators.stack import at.petrak.hexcasting.api.casting.castables.ConstMediaAction -import at.petrak.hexcasting.api.casting.eval.CastingContext +import at.petrak.hexcasting.api.casting.eval.CastingEnvironment import at.petrak.hexcasting.api.casting.getPositiveInt import at.petrak.hexcasting.api.casting.iota.Iota import at.petrak.hexcasting.api.casting.mishaps.MishapShameOnYou @@ -10,7 +10,7 @@ object OpDuplicateN : ConstMediaAction { override val argc: Int get() = 2 - override fun execute(args: List, ctx: CastingContext): List { + override fun execute(args: List, ctx: CastingEnvironment): List { val count = args.getPositiveInt(1, argc) if (count > 1000) { diff --git a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/stack/OpFisherman.kt b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/stack/OpFisherman.kt index ab3384f6..20925a17 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/stack/OpFisherman.kt +++ b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/stack/OpFisherman.kt @@ -2,7 +2,7 @@ package at.petrak.hexcasting.common.casting.operators.stack import at.petrak.hexcasting.api.casting.castables.Action import at.petrak.hexcasting.api.casting.OperationResult -import at.petrak.hexcasting.api.casting.eval.CastingContext +import at.petrak.hexcasting.api.casting.eval.CastingEnvironment import at.petrak.hexcasting.api.casting.eval.vm.SpellContinuation import at.petrak.hexcasting.api.casting.iota.DoubleIota import at.petrak.hexcasting.api.casting.iota.Iota @@ -16,7 +16,7 @@ object OpFisherman : Action { continuation: SpellContinuation, stack: MutableList, ravenmind: Iota?, - ctx: CastingContext + ctx: CastingEnvironment ): OperationResult { if (stack.size < 2) throw MishapNotEnoughArgs(2, stack.size) diff --git a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/stack/OpFishermanButItCopies.kt b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/stack/OpFishermanButItCopies.kt index d3ed3464..a8faf144 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/stack/OpFishermanButItCopies.kt +++ b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/stack/OpFishermanButItCopies.kt @@ -2,7 +2,7 @@ package at.petrak.hexcasting.common.casting.operators.stack import at.petrak.hexcasting.api.casting.castables.Action import at.petrak.hexcasting.api.casting.OperationResult -import at.petrak.hexcasting.api.casting.eval.CastingContext +import at.petrak.hexcasting.api.casting.eval.CastingEnvironment import at.petrak.hexcasting.api.casting.eval.vm.SpellContinuation import at.petrak.hexcasting.api.casting.getPositiveIntUnderInclusive import at.petrak.hexcasting.api.casting.iota.Iota @@ -13,7 +13,7 @@ object OpFishermanButItCopies : Action { continuation: SpellContinuation, stack: MutableList, ravenmind: Iota?, - ctx: CastingContext + ctx: CastingEnvironment ): OperationResult { if (stack.size < 2) throw MishapNotEnoughArgs(2, stack.size) diff --git a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/stack/OpMask.kt b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/stack/OpMask.kt index d4452e27..6cb07d52 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/stack/OpMask.kt +++ b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/stack/OpMask.kt @@ -1,7 +1,7 @@ package at.petrak.hexcasting.common.casting.operators.stack import at.petrak.hexcasting.api.casting.castables.ConstMediaAction -import at.petrak.hexcasting.api.casting.eval.CastingContext +import at.petrak.hexcasting.api.casting.eval.CastingEnvironment import at.petrak.hexcasting.api.casting.iota.Iota import it.unimi.dsi.fastutil.booleans.BooleanList import net.minecraft.resources.ResourceLocation @@ -10,7 +10,7 @@ class OpMask(val mask: BooleanList, val key: ResourceLocation) : ConstMediaActio override val argc: Int get() = mask.size - override fun execute(args: List, ctx: CastingContext): List { + override fun execute(args: List, ctx: CastingEnvironment): List { val out = ArrayList(this.mask.size) for ((i, include) in this.mask.withIndex()) { if (include) diff --git a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/stack/OpStackSize.kt b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/stack/OpStackSize.kt index b67f5d1c..ab4de722 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/stack/OpStackSize.kt +++ b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/stack/OpStackSize.kt @@ -2,7 +2,7 @@ package at.petrak.hexcasting.common.casting.operators.stack import at.petrak.hexcasting.api.casting.castables.Action import at.petrak.hexcasting.api.casting.OperationResult -import at.petrak.hexcasting.api.casting.eval.CastingContext +import at.petrak.hexcasting.api.casting.eval.CastingEnvironment import at.petrak.hexcasting.api.casting.eval.vm.SpellContinuation import at.petrak.hexcasting.api.casting.iota.DoubleIota import at.petrak.hexcasting.api.casting.iota.Iota @@ -12,7 +12,7 @@ object OpStackSize : Action { continuation: SpellContinuation, stack: MutableList, ravenmind: Iota?, - ctx: CastingContext + ctx: CastingEnvironment ): OperationResult { stack.add(DoubleIota(stack.size.toDouble())) return OperationResult(continuation, stack, ravenmind, listOf()) diff --git a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/stack/OpTwiddling.kt b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/stack/OpTwiddling.kt index fcf880a9..beb4500f 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/stack/OpTwiddling.kt +++ b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/stack/OpTwiddling.kt @@ -1,13 +1,13 @@ package at.petrak.hexcasting.common.casting.operators.stack import at.petrak.hexcasting.api.casting.castables.ConstMediaAction -import at.petrak.hexcasting.api.casting.eval.CastingContext +import at.petrak.hexcasting.api.casting.eval.CastingEnvironment import at.petrak.hexcasting.api.casting.iota.Iota class OpTwiddling(val argumentCount: Int, val lookup: IntArray) : ConstMediaAction { override val argc: Int get() = this.argumentCount - override fun execute(args: List, ctx: CastingContext): List = + override fun execute(args: List, ctx: CastingEnvironment): List = this.lookup.map(args::get) } \ No newline at end of file diff --git a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/stack/SpecialHandlerMask.kt b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/stack/SpecialHandlerMask.kt index a93f8370..efc84a98 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/stack/SpecialHandlerMask.kt +++ b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/stack/SpecialHandlerMask.kt @@ -5,12 +5,14 @@ import at.petrak.hexcasting.api.HexAPI.modLoc import at.petrak.hexcasting.api.casting.castables.Action import at.petrak.hexcasting.api.casting.castables.ConstMediaAction import at.petrak.hexcasting.api.casting.castables.SpecialHandler -import at.petrak.hexcasting.api.casting.eval.CastingContext +import at.petrak.hexcasting.api.casting.eval.CastingEnvironment import at.petrak.hexcasting.api.casting.iota.Iota import at.petrak.hexcasting.api.casting.math.HexAngle import at.petrak.hexcasting.api.casting.math.HexPattern import at.petrak.hexcasting.api.utils.asTranslatedComponent import at.petrak.hexcasting.api.utils.lightPurple +import at.petrak.hexcasting.common.lib.hex.HexSpecialHandlers +import at.petrak.hexcasting.xplat.IXplatAbstractions import it.unimi.dsi.fastutil.booleans.BooleanArrayList import it.unimi.dsi.fastutil.booleans.BooleanList import net.minecraft.network.chat.Component @@ -22,8 +24,10 @@ class SpecialHandlerMask(val mask: BooleanList) : SpecialHandler { } override fun getName(): Component { - return HexAPI.instance().getActionI18nKey(NAME) - .asTranslatedComponent(mask.map { if (it) '-' else 'v' }.joinToString("")) + val key = IXplatAbstractions.INSTANCE.specialHandlerRegistry.getResourceKey(HexSpecialHandlers.NUMBER).get() + val fingerprint = mask.map { if (it) '-' else 'v' }.joinToString("") + return HexAPI.instance().getSpecialHandlerI18nKey(key) + .asTranslatedComponent(fingerprint) .lightPurple } @@ -31,7 +35,7 @@ class SpecialHandlerMask(val mask: BooleanList) : SpecialHandler { override val argc: Int get() = this.mask.size - override fun execute(args: List, ctx: CastingContext): List { + override fun execute(args: List, ctx: CastingEnvironment): List { val out = ArrayList(this.mask.size) for ((i, include) in this.mask.withIndex()) { if (include) diff --git a/Common/src/main/java/at/petrak/hexcasting/common/items/magic/ItemPackagedHex.java b/Common/src/main/java/at/petrak/hexcasting/common/items/magic/ItemPackagedHex.java index cb83ddc2..50d463c0 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/items/magic/ItemPackagedHex.java +++ b/Common/src/main/java/at/petrak/hexcasting/common/items/magic/ItemPackagedHex.java @@ -1,7 +1,7 @@ package at.petrak.hexcasting.common.items.magic; import at.petrak.hexcasting.api.item.HexHolderItem; -import at.petrak.hexcasting.api.casting.eval.CastingContext; +import at.petrak.hexcasting.api.casting.eval.CastingEnvironment; import at.petrak.hexcasting.api.casting.eval.CastingHarness; import at.petrak.hexcasting.api.casting.iota.Iota; import at.petrak.hexcasting.api.utils.NBTHelper; @@ -106,7 +106,7 @@ public abstract class ItemPackagedHex extends ItemMediaHolder implements HexHold return InteractionResultHolder.fail(stack); } var sPlayer = (ServerPlayer) player; - var ctx = new CastingContext(sPlayer, usedHand, CastingContext.CastSource.PACKAGED_HEX); + var ctx = new CastingEnvironment(sPlayer, usedHand, CastingEnvironment.CastSource.PACKAGED_HEX); var harness = new CastingHarness(ctx); var info = harness.executeIotas(instrs, sPlayer.getLevel()); diff --git a/Common/src/main/java/at/petrak/hexcasting/interop/patchouli/PatternProcessor.java b/Common/src/main/java/at/petrak/hexcasting/interop/patchouli/PatternProcessor.java index 1d61a943..90b73df1 100644 --- a/Common/src/main/java/at/petrak/hexcasting/interop/patchouli/PatternProcessor.java +++ b/Common/src/main/java/at/petrak/hexcasting/interop/patchouli/PatternProcessor.java @@ -16,7 +16,7 @@ public class PatternProcessor implements IComponentProcessor { IVariable key = vars.get("op_id"); String opName = key.asString(); - String prefix = "hexcasting.spell."; + String prefix = "hexcasting.action."; boolean hasOverride = I18n.exists(prefix + "book." + opName); translationKey = prefix + (hasOverride ? "book." : "") + opName; } diff --git a/Common/src/main/java/at/petrak/hexcasting/interop/pehkui/OpGetScale.kt b/Common/src/main/java/at/petrak/hexcasting/interop/pehkui/OpGetScale.kt index 4260283f..731d3a70 100644 --- a/Common/src/main/java/at/petrak/hexcasting/interop/pehkui/OpGetScale.kt +++ b/Common/src/main/java/at/petrak/hexcasting/interop/pehkui/OpGetScale.kt @@ -2,7 +2,7 @@ package at.petrak.hexcasting.interop.pehkui import at.petrak.hexcasting.api.casting.castables.ConstMediaAction import at.petrak.hexcasting.api.casting.asActionResult -import at.petrak.hexcasting.api.casting.eval.CastingContext +import at.petrak.hexcasting.api.casting.eval.CastingEnvironment import at.petrak.hexcasting.api.casting.getEntity import at.petrak.hexcasting.api.casting.iota.Iota import at.petrak.hexcasting.xplat.IXplatAbstractions @@ -10,7 +10,7 @@ import at.petrak.hexcasting.xplat.IXplatAbstractions object OpGetScale : ConstMediaAction { override val argc = 1 - override fun execute(args: List, ctx: CastingContext): List { + override fun execute(args: List, ctx: CastingEnvironment): List { val target = args.getEntity(0, argc) return IXplatAbstractions.INSTANCE.pehkuiApi.getScale(target).toDouble().asActionResult } diff --git a/Common/src/main/java/at/petrak/hexcasting/interop/pehkui/OpSetScale.kt b/Common/src/main/java/at/petrak/hexcasting/interop/pehkui/OpSetScale.kt index c840d449..6fe175cc 100644 --- a/Common/src/main/java/at/petrak/hexcasting/interop/pehkui/OpSetScale.kt +++ b/Common/src/main/java/at/petrak/hexcasting/interop/pehkui/OpSetScale.kt @@ -2,7 +2,7 @@ package at.petrak.hexcasting.interop.pehkui import at.petrak.hexcasting.api.casting.* import at.petrak.hexcasting.api.casting.castables.SpellAction -import at.petrak.hexcasting.api.casting.eval.CastingContext +import at.petrak.hexcasting.api.casting.eval.CastingEnvironment import at.petrak.hexcasting.api.casting.iota.Iota import at.petrak.hexcasting.xplat.IXplatAbstractions import net.minecraft.world.entity.Entity @@ -12,7 +12,7 @@ object OpSetScale : SpellAction { override fun execute( args: List, - ctx: CastingContext + ctx: CastingEnvironment ): Triple> { val target = args.getEntity(0, argc) val scale = args.getDoubleBetween(1, 1.0 / 32.0, 8.0, argc) @@ -25,7 +25,7 @@ object OpSetScale : SpellAction { } private data class Spell(val target: Entity, val scale: Double) : RenderedSpell { - override fun cast(ctx: CastingContext) { + override fun cast(ctx: CastingEnvironment) { IXplatAbstractions.INSTANCE.pehkuiApi.setScale(target, scale.toFloat()) } } diff --git a/Common/src/main/resources/assets/hexcasting/lang/en_us.json b/Common/src/main/resources/assets/hexcasting/lang/en_us.json index 558f0c97..f8adaea0 100644 --- a/Common/src/main/resources/assets/hexcasting/lang/en_us.json +++ b/Common/src/main/resources/assets/hexcasting/lang/en_us.json @@ -285,225 +285,226 @@ "_comment": "hexcasting.spell.book keys override the name of a pattern in the patchouli book if present", - "hexcasting.spell.book.hexcasting:get_entity_height": "Stadiometer's Prfn.", - "hexcasting.spell.book.hexcasting:get_entity/animal": "Entity Prfn.: Animal", - "hexcasting.spell.book.hexcasting:get_entity/monster": "Entity Prfn.: Monster", - "hexcasting.spell.book.hexcasting:get_entity/item": "Entity Prfn.: Item", - "hexcasting.spell.book.hexcasting:get_entity/player": "Entity Prfn.: Player", - "hexcasting.spell.book.hexcasting:get_entity/living": "Entity Prfn.: Living", - "hexcasting.spell.book.hexcasting:zone_entity": "Zone Dstl.: Any", - "hexcasting.spell.book.hexcasting:zone_entity/animal": "Zone Dstl.: Animal", - "hexcasting.spell.book.hexcasting:zone_entity/monster": "Zone Dstl.: Monster", - "hexcasting.spell.book.hexcasting:zone_entity/item": "Zone Dstl.: Item", - "hexcasting.spell.book.hexcasting:zone_entity/player": "Zone Dstl.: Player", - "hexcasting.spell.book.hexcasting:zone_entity/living": "Zone Dstl.: Living", - "hexcasting.spell.book.hexcasting:zone_entity/not_animal": "Zone Dstl.: Non-Animal", - "hexcasting.spell.book.hexcasting:zone_entity/not_monster": "Zone Dstl.: Non-Monster", - "hexcasting.spell.book.hexcasting:zone_entity/not_item": "Zone Dstl.: Non-Item", - "hexcasting.spell.book.hexcasting:zone_entity/not_player": "Zone Dstl.: Non-Player", - "hexcasting.spell.book.hexcasting:zone_entity/not_living": "Zone Dstl.: Non-Living", - "hexcasting.spell.book.hexcasting:mul_dot": "Multiplicative Dstl.", - "hexcasting.spell.book.hexcasting:div_cross": "Division Dstl.", - "hexcasting.spell.book.hexcasting:arcsin": "Inverse Sine Prfn.", - "hexcasting.spell.book.hexcasting:arccos": "Inverse Cosine Prfn.", - "hexcasting.spell.book.hexcasting:arctan": "Inverse Tangent Prfn.", - "hexcasting.spell.book.hexcasting:const/vec/x": "Vector Rfln. +X/-X", - "hexcasting.spell.book.hexcasting:const/vec/y": "Vector Rfln. +Y/-Y", - "hexcasting.spell.book.hexcasting:const/vec/z": "Vector Rfln. +Z/-Z", - "hexcasting.spell.book.hexcasting:read/entity": "Chronicler's Prfn.", - "hexcasting.spell.book.hexcasting:number": "Numerical Reflection", - "hexcasting.spell.book.hexcasting:mask": "Bookkeeper's Gambit", + "hexcasting.action.book.hexcasting:get_entity_height": "Stadiometer's Prfn.", + "hexcasting.action.book.hexcasting:get_entity/animal": "Entity Prfn.: Animal", + "hexcasting.action.book.hexcasting:get_entity/monster": "Entity Prfn.: Monster", + "hexcasting.action.book.hexcasting:get_entity/item": "Entity Prfn.: Item", + "hexcasting.action.book.hexcasting:get_entity/player": "Entity Prfn.: Player", + "hexcasting.action.book.hexcasting:get_entity/living": "Entity Prfn.: Living", + "hexcasting.action.book.hexcasting:zone_entity": "Zone Dstl.: Any", + "hexcasting.action.book.hexcasting:zone_entity/animal": "Zone Dstl.: Animal", + "hexcasting.action.book.hexcasting:zone_entity/monster": "Zone Dstl.: Monster", + "hexcasting.action.book.hexcasting:zone_entity/item": "Zone Dstl.: Item", + "hexcasting.action.book.hexcasting:zone_entity/player": "Zone Dstl.: Player", + "hexcasting.action.book.hexcasting:zone_entity/living": "Zone Dstl.: Living", + "hexcasting.action.book.hexcasting:zone_entity/not_animal": "Zone Dstl.: Non-Animal", + "hexcasting.action.book.hexcasting:zone_entity/not_monster": "Zone Dstl.: Non-Monster", + "hexcasting.action.book.hexcasting:zone_entity/not_item": "Zone Dstl.: Non-Item", + "hexcasting.action.book.hexcasting:zone_entity/not_player": "Zone Dstl.: Non-Player", + "hexcasting.action.book.hexcasting:zone_entity/not_living": "Zone Dstl.: Non-Living", + "hexcasting.action.book.hexcasting:mul_dot": "Multiplicative Dstl.", + "hexcasting.action.book.hexcasting:div_cross": "Division Dstl.", + "hexcasting.action.book.hexcasting:arcsin": "Inverse Sine Prfn.", + "hexcasting.action.book.hexcasting:arccos": "Inverse Cosine Prfn.", + "hexcasting.action.book.hexcasting:arctan": "Inverse Tangent Prfn.", + "hexcasting.action.book.hexcasting:const/vec/x": "Vector Rfln. +X/-X", + "hexcasting.action.book.hexcasting:const/vec/y": "Vector Rfln. +Y/-Y", + "hexcasting.action.book.hexcasting:const/vec/z": "Vector Rfln. +Z/-Z", + "hexcasting.action.book.hexcasting:read/entity": "Chronicler's Prfn.", + "hexcasting.action.book.hexcasting:number": "Numerical Reflection", + "hexcasting.action.book.hexcasting:mask": "Bookkeeper's Gambit", - "hexcasting.spell.hexcasting:const/null": "Nullary Reflection", - "hexcasting.spell.hexcasting:const/vec/px": "Vector Reflection +X", - "hexcasting.spell.hexcasting:const/vec/py": "Vector Reflection +Y", - "hexcasting.spell.hexcasting:const/vec/pz": "Vector Reflection +Z", - "hexcasting.spell.hexcasting:const/vec/nx": "Vector Reflection -X", - "hexcasting.spell.hexcasting:const/vec/ny": "Vector Reflection -Y", - "hexcasting.spell.hexcasting:const/vec/nz": "Vector Reflection -Z", - "hexcasting.spell.hexcasting:const/vec/0": "Vector Reflection Zero", - "hexcasting.spell.hexcasting:const/true": "True Reflection", - "hexcasting.spell.hexcasting:const/false": "False Reflection", - "hexcasting.spell.hexcasting:const/double/pi": "Arc's Reflection", - "hexcasting.spell.hexcasting:const/double/tau": "Circle's Reflection", - "hexcasting.spell.hexcasting:const/double/e": "Euler's Reflection", + "hexcasting.action.hexcasting:const/null": "Nullary Reflection", + "hexcasting.action.hexcasting:const/vec/px": "Vector Reflection +X", + "hexcasting.action.hexcasting:const/vec/py": "Vector Reflection +Y", + "hexcasting.action.hexcasting:const/vec/pz": "Vector Reflection +Z", + "hexcasting.action.hexcasting:const/vec/nx": "Vector Reflection -X", + "hexcasting.action.hexcasting:const/vec/ny": "Vector Reflection -Y", + "hexcasting.action.hexcasting:const/vec/nz": "Vector Reflection -Z", + "hexcasting.action.hexcasting:const/vec/0": "Vector Reflection Zero", + "hexcasting.action.hexcasting:const/true": "True Reflection", + "hexcasting.action.hexcasting:const/false": "False Reflection", + "hexcasting.action.hexcasting:const/double/pi": "Arc's Reflection", + "hexcasting.action.hexcasting:const/double/tau": "Circle's Reflection", + "hexcasting.action.hexcasting:const/double/e": "Euler's Reflection", - "hexcasting.spell.hexcasting:get_caster": "Mind's Reflection", - "hexcasting.spell.hexcasting:entity_pos/eye": "Compass' Purification", - "hexcasting.spell.hexcasting:entity_pos/foot": "Compass' Purification II", - "hexcasting.spell.hexcasting:get_entity_look": "Alidade's Purification", - "hexcasting.spell.hexcasting:get_entity_height": "Stadiometer's Purification", - "hexcasting.spell.hexcasting:get_entity_velocity": "Pace Purification", - "hexcasting.spell.hexcasting:raycast": "Archer's Distillation", - "hexcasting.spell.hexcasting:raycast/axis": "Architect's Distillation", - "hexcasting.spell.hexcasting:raycast/entity": "Scout's Distillation", - "hexcasting.spell.hexcasting:circle/impetus_pos": "Waystone Reflection", - "hexcasting.spell.hexcasting:circle/impetus_dir": "Lodestone Reflection", - "hexcasting.spell.hexcasting:circle/bounds/min": "Lesser Fold Reflection", - "hexcasting.spell.hexcasting:circle/bounds/max": "Greater Fold Reflection", + "hexcasting.action.hexcasting:get_caster": "Mind's Reflection", + "hexcasting.action.hexcasting:entity_pos/eye": "Compass' Purification", + "hexcasting.action.hexcasting:entity_pos/foot": "Compass' Purification II", + "hexcasting.action.hexcasting:get_entity_look": "Alidade's Purification", + "hexcasting.action.hexcasting:get_entity_height": "Stadiometer's Purification", + "hexcasting.action.hexcasting:get_entity_velocity": "Pace Purification", + "hexcasting.action.hexcasting:raycast": "Archer's Distillation", + "hexcasting.action.hexcasting:raycast/axis": "Architect's Distillation", + "hexcasting.action.hexcasting:raycast/entity": "Scout's Distillation", + "hexcasting.action.hexcasting:circle/impetus_pos": "Waystone Reflection", + "hexcasting.action.hexcasting:circle/impetus_dir": "Lodestone Reflection", + "hexcasting.action.hexcasting:circle/bounds/min": "Lesser Fold Reflection", + "hexcasting.action.hexcasting:circle/bounds/max": "Greater Fold Reflection", - "hexcasting.spell.hexcasting:append": "Integration Distillation", - "hexcasting.spell.hexcasting:concat": "Combination Distillation", - "hexcasting.spell.hexcasting:index": "Selection Distillation", - "hexcasting.spell.hexcasting:list_size": "Abacus Purification", - "hexcasting.spell.hexcasting:singleton": "Single's Purification", - "hexcasting.spell.hexcasting:empty_list": "Vacant Reflection", - "hexcasting.spell.hexcasting:reverse_list": "Retrograde Purification", - "hexcasting.spell.hexcasting:last_n_list": "Flock's Gambit", - "hexcasting.spell.hexcasting:splat": "Flock's Disintegration", - "hexcasting.spell.hexcasting:index_of": "Locator's Distillation", - "hexcasting.spell.hexcasting:list_remove": "Excisor's Distillation", - "hexcasting.spell.hexcasting:slice": "Selection Exaltation", - "hexcasting.spell.hexcasting:modify_in_place": "Surgeon's Exaltation", - "hexcasting.spell.hexcasting:construct": "Speaker's Distillation", - "hexcasting.spell.hexcasting:deconstruct": "Speaker's Decomposition", + "hexcasting.action.hexcasting:append": "Integration Distillation", + "hexcasting.action.hexcasting:concat": "Combination Distillation", + "hexcasting.action.hexcasting:index": "Selection Distillation", + "hexcasting.action.hexcasting:list_size": "Abacus Purification", + "hexcasting.action.hexcasting:singleton": "Single's Purification", + "hexcasting.action.hexcasting:empty_list": "Vacant Reflection", + "hexcasting.action.hexcasting:reverse_list": "Retrograde Purification", + "hexcasting.action.hexcasting:last_n_list": "Flock's Gambit", + "hexcasting.action.hexcasting:splat": "Flock's Disintegration", + "hexcasting.action.hexcasting:index_of": "Locator's Distillation", + "hexcasting.action.hexcasting:list_remove": "Excisor's Distillation", + "hexcasting.action.hexcasting:slice": "Selection Exaltation", + "hexcasting.action.hexcasting:modify_in_place": "Surgeon's Exaltation", + "hexcasting.action.hexcasting:construct": "Speaker's Distillation", + "hexcasting.action.hexcasting:deconstruct": "Speaker's Decomposition", - "hexcasting.spell.hexcasting:get_entity": "Entity Purification", - "hexcasting.spell.hexcasting:get_entity/animal": "Entity Purification: Animal", - "hexcasting.spell.hexcasting:get_entity/monster": "Entity Purification: Monster", - "hexcasting.spell.hexcasting:get_entity/item": "Entity Purification: Item", - "hexcasting.spell.hexcasting:get_entity/player": "Entity Purification: Player", - "hexcasting.spell.hexcasting:get_entity/living": "Entity Purification: Living", - "hexcasting.spell.hexcasting:zone_entity": "Zone Distillation: Any", - "hexcasting.spell.hexcasting:zone_entity/animal": "Zone Distillation: Animal", - "hexcasting.spell.hexcasting:zone_entity/monster": "Zone Distillation: Monster", - "hexcasting.spell.hexcasting:zone_entity/item": "Zone Distillation: Item", - "hexcasting.spell.hexcasting:zone_entity/player": "Zone Distillation: Player", - "hexcasting.spell.hexcasting:zone_entity/living": "Zone Distillation: Living", - "hexcasting.spell.hexcasting:zone_entity/not_animal": "Zone Distillation: Non-Animal", - "hexcasting.spell.hexcasting:zone_entity/not_monster": "Zone Distillation: Non-Monster", - "hexcasting.spell.hexcasting:zone_entity/not_item": "Zone Distillation: Non-Item", - "hexcasting.spell.hexcasting:zone_entity/not_player": "Zone Distillation: Non-Player", - "hexcasting.spell.hexcasting:zone_entity/not_living": "Zone Distillation: Non-Living", + "hexcasting.action.hexcasting:get_entity": "Entity Purification", + "hexcasting.action.hexcasting:get_entity/animal": "Entity Purification: Animal", + "hexcasting.action.hexcasting:get_entity/monster": "Entity Purification: Monster", + "hexcasting.action.hexcasting:get_entity/item": "Entity Purification: Item", + "hexcasting.action.hexcasting:get_entity/player": "Entity Purification: Player", + "hexcasting.action.hexcasting:get_entity/living": "Entity Purification: Living", + "hexcasting.action.hexcasting:zone_entity": "Zone Distillation: Any", + "hexcasting.action.hexcasting:zone_entity/animal": "Zone Distillation: Animal", + "hexcasting.action.hexcasting:zone_entity/monster": "Zone Distillation: Monster", + "hexcasting.action.hexcasting:zone_entity/item": "Zone Distillation: Item", + "hexcasting.action.hexcasting:zone_entity/player": "Zone Distillation: Player", + "hexcasting.action.hexcasting:zone_entity/living": "Zone Distillation: Living", + "hexcasting.action.hexcasting:zone_entity/not_animal": "Zone Distillation: Non-Animal", + "hexcasting.action.hexcasting:zone_entity/not_monster": "Zone Distillation: Non-Monster", + "hexcasting.action.hexcasting:zone_entity/not_item": "Zone Distillation: Non-Item", + "hexcasting.action.hexcasting:zone_entity/not_player": "Zone Distillation: Non-Player", + "hexcasting.action.hexcasting:zone_entity/not_living": "Zone Distillation: Non-Living", - "hexcasting.spell.hexcasting:swap": "Jester's Gambit", - "hexcasting.spell.hexcasting:rotate": "Rotation Gambit", - "hexcasting.spell.hexcasting:rotate_reverse": "Rotation Gambit II", - "hexcasting.spell.hexcasting:duplicate": "Gemini Decomposition", - "hexcasting.spell.hexcasting:over": "Prospector's Gambit", - "hexcasting.spell.hexcasting:tuck": "Undertaker's Gambit", - "hexcasting.spell.hexcasting:2dup": "Dioscuri Gambit", - "hexcasting.spell.hexcasting:duplicate_n": "Gemini Gambit", - "hexcasting.spell.hexcasting:stack_len": "Flock's Reflection", - "hexcasting.spell.hexcasting:fisherman": "Fisherman's Gambit", - "hexcasting.spell.hexcasting:fisherman/copy": "Fisherman's Gambit II", - "hexcasting.spell.hexcasting:swizzle": "Swindler's Gambit", + "hexcasting.action.hexcasting:swap": "Jester's Gambit", + "hexcasting.action.hexcasting:rotate": "Rotation Gambit", + "hexcasting.action.hexcasting:rotate_reverse": "Rotation Gambit II", + "hexcasting.action.hexcasting:duplicate": "Gemini Decomposition", + "hexcasting.action.hexcasting:over": "Prospector's Gambit", + "hexcasting.action.hexcasting:tuck": "Undertaker's Gambit", + "hexcasting.action.hexcasting:2dup": "Dioscuri Gambit", + "hexcasting.action.hexcasting:duplicate_n": "Gemini Gambit", + "hexcasting.action.hexcasting:stack_len": "Flock's Reflection", + "hexcasting.action.hexcasting:fisherman": "Fisherman's Gambit", + "hexcasting.action.hexcasting:fisherman/copy": "Fisherman's Gambit II", + "hexcasting.action.hexcasting:swizzle": "Swindler's Gambit", - "hexcasting.spell.hexcasting:and_bit": "Intersection Distillation", - "hexcasting.spell.hexcasting:or_bit": "Unifying Distillation", - "hexcasting.spell.hexcasting:xor_bit": "Exclusionary Distillation", - "hexcasting.spell.hexcasting:not_bit": "Inversion Purification", - "hexcasting.spell.hexcasting:to_set": "Uniqueness Purification", - "hexcasting.spell.hexcasting:and": "Conjunction Distillation", - "hexcasting.spell.hexcasting:or": "Disjunction Distillation", - "hexcasting.spell.hexcasting:xor": "Exclusion Distillation", + "hexcasting.action.hexcasting:and_bit": "Intersection Distillation", + "hexcasting.action.hexcasting:or_bit": "Unifying Distillation", + "hexcasting.action.hexcasting:xor_bit": "Exclusionary Distillation", + "hexcasting.action.hexcasting:not_bit": "Inversion Purification", + "hexcasting.action.hexcasting:to_set": "Uniqueness Purification", + "hexcasting.action.hexcasting:and": "Conjunction Distillation", + "hexcasting.action.hexcasting:or": "Disjunction Distillation", + "hexcasting.action.hexcasting:xor": "Exclusion Distillation", - "hexcasting.spell.hexcasting:greater": "Maximus Distillation", - "hexcasting.spell.hexcasting:less": "Minimus Distillation", - "hexcasting.spell.hexcasting:greater_eq": "Maximus Distillation II", - "hexcasting.spell.hexcasting:less_eq": "Minimus Distillation II", - "hexcasting.spell.hexcasting:equals": "Equality Distillation", - "hexcasting.spell.hexcasting:not_equals": "Inequality Distillation", - "hexcasting.spell.hexcasting:not": "Negation Purification", - "hexcasting.spell.hexcasting:bool_coerce": "Augur's Purification", - "hexcasting.spell.hexcasting:if": "Augur's Exaltation", + "hexcasting.action.hexcasting:greater": "Maximus Distillation", + "hexcasting.action.hexcasting:less": "Minimus Distillation", + "hexcasting.action.hexcasting:greater_eq": "Maximus Distillation II", + "hexcasting.action.hexcasting:less_eq": "Minimus Distillation II", + "hexcasting.action.hexcasting:equals": "Equality Distillation", + "hexcasting.action.hexcasting:not_equals": "Inequality Distillation", + "hexcasting.action.hexcasting:not": "Negation Purification", + "hexcasting.action.hexcasting:bool_coerce": "Augur's Purification", + "hexcasting.action.hexcasting:if": "Augur's Exaltation", - "hexcasting.spell.hexcasting:add": "Additive Distillation", - "hexcasting.spell.hexcasting:sub": "Subtractive Distillation", - "hexcasting.spell.hexcasting:mul_dot": "Multiplicative Dstl.", - "hexcasting.spell.hexcasting:div_cross": "Division Dstl.", - "hexcasting.spell.hexcasting:abs_len": "Length Purification", - "hexcasting.spell.hexcasting:pow_proj": "Power Distillation", - "hexcasting.spell.hexcasting:floor": "Floor Purification", - "hexcasting.spell.hexcasting:ceil": "Ceiling Purification", - "hexcasting.spell.hexcasting:modulo": "Modulus Distillation", - "hexcasting.spell.hexcasting:construct_vec": "Vector Exaltation", - "hexcasting.spell.hexcasting:deconstruct_vec": "Vector Disintegration", - "hexcasting.spell.hexcasting:sin": "Sine Purification", - "hexcasting.spell.hexcasting:cos": "Cosine Purification", - "hexcasting.spell.hexcasting:tan": "Tangent Purification", - "hexcasting.spell.hexcasting:arcsin": "Inverse Sine Purification", - "hexcasting.spell.hexcasting:arccos": "Inverse Cosine Purification", - "hexcasting.spell.hexcasting:arctan": "Inverse Tangent Purification", - "hexcasting.spell.hexcasting:random": "Entropy Reflection", - "hexcasting.spell.hexcasting:logarithm": "Logarithmic Distillation", - "hexcasting.spell.hexcasting:coerce_axial": "Axial Purification", + "hexcasting.action.hexcasting:add": "Additive Distillation", + "hexcasting.action.hexcasting:sub": "Subtractive Distillation", + "hexcasting.action.hexcasting:mul_dot": "Multiplicative Dstl.", + "hexcasting.action.hexcasting:div_cross": "Division Dstl.", + "hexcasting.action.hexcasting:abs_len": "Length Purification", + "hexcasting.action.hexcasting:pow_proj": "Power Distillation", + "hexcasting.action.hexcasting:floor": "Floor Purification", + "hexcasting.action.hexcasting:ceil": "Ceiling Purification", + "hexcasting.action.hexcasting:modulo": "Modulus Distillation", + "hexcasting.action.hexcasting:construct_vec": "Vector Exaltation", + "hexcasting.action.hexcasting:deconstruct_vec": "Vector Disintegration", + "hexcasting.action.hexcasting:sin": "Sine Purification", + "hexcasting.action.hexcasting:cos": "Cosine Purification", + "hexcasting.action.hexcasting:tan": "Tangent Purification", + "hexcasting.action.hexcasting:arcsin": "Inverse Sine Purification", + "hexcasting.action.hexcasting:arccos": "Inverse Cosine Purification", + "hexcasting.action.hexcasting:arctan": "Inverse Tangent Purification", + "hexcasting.action.hexcasting:random": "Entropy Reflection", + "hexcasting.action.hexcasting:logarithm": "Logarithmic Distillation", + "hexcasting.action.hexcasting:coerce_axial": "Axial Purification", - "hexcasting.spell.hexcasting:read": "Scribe's Reflection", - "hexcasting.spell.hexcasting:read/entity": "Chronicler's Purification", - "hexcasting.spell.hexcasting:write": "Scribe's Gambit", - "hexcasting.spell.hexcasting:write/entity": "Chronicler's Gambit", - "hexcasting.spell.hexcasting:readable": "Auditor's Reflection", - "hexcasting.spell.hexcasting:writable": "Assessor's Reflection", - "hexcasting.spell.hexcasting:readable/entity": "Auditor's Purification", - "hexcasting.spell.hexcasting:writable/entity": "Assessor's Purification", - "hexcasting.spell.hexcasting:akashic/read": "Akasha's Distillation", - "hexcasting.spell.hexcasting:akashic/write": "Akasha's Gambit", - "hexcasting.spell.hexcasting:read/local": "Muninn's Reflection", - "hexcasting.spell.hexcasting:write/local": "Huginn's Gambit", + "hexcasting.action.hexcasting:read": "Scribe's Reflection", + "hexcasting.action.hexcasting:read/entity": "Chronicler's Purification", + "hexcasting.action.hexcasting:write": "Scribe's Gambit", + "hexcasting.action.hexcasting:write/entity": "Chronicler's Gambit", + "hexcasting.action.hexcasting:readable": "Auditor's Reflection", + "hexcasting.action.hexcasting:writable": "Assessor's Reflection", + "hexcasting.action.hexcasting:readable/entity": "Auditor's Purification", + "hexcasting.action.hexcasting:writable/entity": "Assessor's Purification", + "hexcasting.action.hexcasting:akashic/read": "Akasha's Distillation", + "hexcasting.action.hexcasting:akashic/write": "Akasha's Gambit", + "hexcasting.action.hexcasting:read/local": "Muninn's Reflection", + "hexcasting.action.hexcasting:write/local": "Huginn's Gambit", - "hexcasting.spell.hexcasting:print": "Reveal", - "hexcasting.spell.hexcasting:beep": "Make Note", - "hexcasting.spell.hexcasting:explode": "Explosion", - "hexcasting.spell.hexcasting:explode/fire": "Fireball", - "hexcasting.spell.hexcasting:add_motion": "Impulse", - "hexcasting.spell.hexcasting:blink": "Blink", - "hexcasting.spell.hexcasting:break_block": "Break Block", - "hexcasting.spell.hexcasting:place_block": "Place Block", - "hexcasting.spell.hexcasting:craft/cypher": "Craft Cypher", - "hexcasting.spell.hexcasting:craft/trinket": "Craft Trinket", - "hexcasting.spell.hexcasting:craft/artifact": "Craft Artifact", - "hexcasting.spell.hexcasting:craft/battery": "Craft Phial", - "hexcasting.spell.hexcasting:recharge": "Recharge Item", - "hexcasting.spell.hexcasting:erase": "Erase Item", - "hexcasting.spell.hexcasting:create_water": "Create Water", - "hexcasting.spell.hexcasting:destroy_water": "Destroy Liquid", - "hexcasting.spell.hexcasting:ignite": "Ignite Block", - "hexcasting.spell.hexcasting:extinguish": "Extinguish Area", - "hexcasting.spell.hexcasting:conjure_block": "Conjure Block", - "hexcasting.spell.hexcasting:conjure_light": "Conjure Light", - "hexcasting.spell.hexcasting:bonemeal": "Overgrow", - "hexcasting.spell.hexcasting:edify": "Edify Sapling", - "hexcasting.spell.hexcasting:colorize": "Internalize Pigment", - "hexcasting.spell.hexcasting:sentinel/create": "Summon Sentinel", - "hexcasting.spell.hexcasting:sentinel/destroy": "Banish Sentinel", - "hexcasting.spell.hexcasting:sentinel/get_pos": "Locate Sentinel", - "hexcasting.spell.hexcasting:sentinel/wayfind": "Wayfind Sentinel", - "hexcasting.spell.hexcasting:potion/weakness": "White Sun's Nadir", - "hexcasting.spell.hexcasting:potion/levitation": "Blue Sun's Nadir", - "hexcasting.spell.hexcasting:potion/wither": "Black Sun's Nadir", - "hexcasting.spell.hexcasting:potion/poison": "Red Sun's Nadir", - "hexcasting.spell.hexcasting:potion/slowness": "Green Sun's Nadir", + "hexcasting.action.hexcasting:print": "Reveal", + "hexcasting.action.hexcasting:beep": "Make Note", + "hexcasting.action.hexcasting:explode": "Explosion", + "hexcasting.action.hexcasting:explode/fire": "Fireball", + "hexcasting.action.hexcasting:add_motion": "Impulse", + "hexcasting.action.hexcasting:blink": "Blink", + "hexcasting.action.hexcasting:break_block": "Break Block", + "hexcasting.action.hexcasting:place_block": "Place Block", + "hexcasting.action.hexcasting:craft/cypher": "Craft Cypher", + "hexcasting.action.hexcasting:craft/trinket": "Craft Trinket", + "hexcasting.action.hexcasting:craft/artifact": "Craft Artifact", + "hexcasting.action.hexcasting:craft/battery": "Craft Phial", + "hexcasting.action.hexcasting:recharge": "Recharge Item", + "hexcasting.action.hexcasting:erase": "Erase Item", + "hexcasting.action.hexcasting:create_water": "Create Water", + "hexcasting.action.hexcasting:destroy_water": "Destroy Liquid", + "hexcasting.action.hexcasting:ignite": "Ignite Block", + "hexcasting.action.hexcasting:extinguish": "Extinguish Area", + "hexcasting.action.hexcasting:conjure_block": "Conjure Block", + "hexcasting.action.hexcasting:conjure_light": "Conjure Light", + "hexcasting.action.hexcasting:bonemeal": "Overgrow", + "hexcasting.action.hexcasting:edify": "Edify Sapling", + "hexcasting.action.hexcasting:colorize": "Internalize Pigment", + "hexcasting.action.hexcasting:sentinel/create": "Summon Sentinel", + "hexcasting.action.hexcasting:sentinel/destroy": "Banish Sentinel", + "hexcasting.action.hexcasting:sentinel/get_pos": "Locate Sentinel", + "hexcasting.action.hexcasting:sentinel/wayfind": "Wayfind Sentinel", + "hexcasting.action.hexcasting:potion/weakness": "White Sun's Nadir", + "hexcasting.action.hexcasting:potion/levitation": "Blue Sun's Nadir", + "hexcasting.action.hexcasting:potion/wither": "Black Sun's Nadir", + "hexcasting.action.hexcasting:potion/poison": "Red Sun's Nadir", + "hexcasting.action.hexcasting:potion/slowness": "Green Sun's Nadir", - "hexcasting.spell.hexcasting:potion/regeneration": "White Sun's Zenith", - "hexcasting.spell.hexcasting:potion/night_vision": "Blue Sun's Zenith", - "hexcasting.spell.hexcasting:potion/absorption": "Black Sun's Zenith", - "hexcasting.spell.hexcasting:potion/haste": "Red Sun's Zenith", - "hexcasting.spell.hexcasting:potion/strength": "Green Sun's Zenith", - "hexcasting.spell.hexcasting:flight": "Flight", - "hexcasting.spell.hexcasting:lightning": "Summon Lightning", - "hexcasting.spell.hexcasting:summon_rain": "Summon Rain", - "hexcasting.spell.hexcasting:dispel_rain": "Dispel Rain", - "hexcasting.spell.hexcasting:create_lava": "Create Lava", - "hexcasting.spell.hexcasting:teleport": "Greater Teleport", - "hexcasting.spell.hexcasting:brainsweep": "Flay Mind", - "hexcasting.spell.hexcasting:sentinel/create/great": "Summon Greater Sentinel", + "hexcasting.action.hexcasting:potion/regeneration": "White Sun's Zenith", + "hexcasting.action.hexcasting:potion/night_vision": "Blue Sun's Zenith", + "hexcasting.action.hexcasting:potion/absorption": "Black Sun's Zenith", + "hexcasting.action.hexcasting:potion/haste": "Red Sun's Zenith", + "hexcasting.action.hexcasting:potion/strength": "Green Sun's Zenith", + "hexcasting.action.hexcasting:flight": "Flight", + "hexcasting.action.hexcasting:lightning": "Summon Lightning", + "hexcasting.action.hexcasting:summon_rain": "Summon Rain", + "hexcasting.action.hexcasting:dispel_rain": "Dispel Rain", + "hexcasting.action.hexcasting:create_lava": "Create Lava", + "hexcasting.action.hexcasting:teleport": "Greater Teleport", + "hexcasting.action.hexcasting:brainsweep": "Flay Mind", + "hexcasting.action.hexcasting:sentinel/create/great": "Summon Greater Sentinel", - "hexcasting.spell.hexcasting:open_paren": "Introspection", - "hexcasting.spell.hexcasting:close_paren": "Retrospection", - "hexcasting.spell.hexcasting:escape": "Consideration", - "hexcasting.spell.hexcasting:eval": "Hermes' Gambit", - "hexcasting.spell.hexcasting:for_each": "Thoth's Gambit", - "hexcasting.spell.hexcasting:halt": "Charon's Gambit", - "hexcasting.spell.hexcasting:number": "Numerical Reflection: %s", - "hexcasting.spell.hexcasting:mask": "Bookkeeper's Gambit: %s", - "hexcasting.spell.null": "Unknown Pattern", + "hexcasting.action.hexcasting:eval": "Hermes' Gambit", + "hexcasting.action.hexcasting:for_each": "Thoth's Gambit", + "hexcasting.action.hexcasting:halt": "Charon's Gambit", - "hexcasting.spell.hexcasting:interop/gravity/get": "Gravitational Purification", - "hexcasting.spell.hexcasting:interop/gravity/set": "Alter Gravity", - "hexcasting.spell.hexcasting:interop/pehkui/get": "Gulliver's Purification", - "hexcasting.spell.hexcasting:interop/pehkui/set": "Alter Scale", + "hexcasting.special.hexcasting:number": "Numerical Reflection: %s", + "hexcasting.special.hexcasting:mask": "Bookkeeper's Gambit: %s", + "hexcasting.rawhook.hexcasting:open_paren": "Introspection", + "hexcasting.rawhook.hexcasting:close_paren": "Retrospection", + "hexcasting.rawhook.hexcasting:escape": "Consideration", + "hexcasting.action.hexcasting:interop/gravity/get": "Gravitational Purification", + "hexcasting.action.hexcasting:interop/gravity/set": "Alter Gravity", + "hexcasting.action.hexcasting:interop/pehkui/get": "Gulliver's Purification", + "hexcasting.action.hexcasting:interop/pehkui/set": "Alter Scale", + + "hexcasting.mishap": "%s: %s", "hexcasting.mishap.invalid_pattern": "That pattern isn't associated with any action", "hexcasting.mishap.unescaped": "Expected to evaluate a pattern, but evaluated %s instead", "hexcasting.mishap.invalid_value": "expected %s at index %s of the stack, but got %s", @@ -534,7 +535,7 @@ "hexcasting.mishap.invalid_value.evaluatable": "something evaluatable", "hexcasting.mishap.not_enough_args": "expected %s or more arguments but the stack was only %s tall", "hexcasting.mishap.no_args": "expected %s or more arguments but the stack was empty", - "hexcasting.mishap.too_many_close_parens": "Used Retrospection without first using Introspection", + "hexcasting.mishap.too_many_close_parens": "Did not first use Introspection", "hexcasting.mishap.location_too_far": "%s is out of range", "hexcasting.mishap.location_out_of_world": "%s is not within the world", "hexcasting.mishap.location_too_close_to_out": "%s is too close to the boundary of the world", diff --git a/Common/src/main/resources/data/hexcasting/patchouli_books/thehexbook/en_us/entries/patterns/great_spells/brainsweep.json b/Common/src/main/resources/data/hexcasting/patchouli_books/thehexbook/en_us/entries/patterns/great_spells/brainsweep.json index 1b6993ac..2b87698a 100644 --- a/Common/src/main/resources/data/hexcasting/patchouli_books/thehexbook/en_us/entries/patterns/great_spells/brainsweep.json +++ b/Common/src/main/resources/data/hexcasting/patchouli_books/thehexbook/en_us/entries/patterns/great_spells/brainsweep.json @@ -1,5 +1,5 @@ { - "name": "hexcasting.spell.hexcasting:brainsweep", + "name": "hexcasting.action.hexcasting:brainsweep", "category": "hexcasting:patterns/great_spells", "icon": "minecraft:skeleton_skull", "sortnum": 7, diff --git a/Common/src/main/resources/data/hexcasting/patchouli_books/thehexbook/en_us/entries/patterns/great_spells/create_lava.json b/Common/src/main/resources/data/hexcasting/patchouli_books/thehexbook/en_us/entries/patterns/great_spells/create_lava.json index 58bdc09c..80491b4c 100644 --- a/Common/src/main/resources/data/hexcasting/patchouli_books/thehexbook/en_us/entries/patterns/great_spells/create_lava.json +++ b/Common/src/main/resources/data/hexcasting/patchouli_books/thehexbook/en_us/entries/patterns/great_spells/create_lava.json @@ -1,5 +1,5 @@ { - "name": "hexcasting.spell.hexcasting:create_lava", + "name": "hexcasting.action.hexcasting:create_lava", "category": "hexcasting:patterns/great_spells", "icon": "minecraft:lava_bucket", "sortnum": 0, diff --git a/Common/src/main/resources/data/hexcasting/patchouli_books/thehexbook/en_us/entries/patterns/great_spells/flight.json b/Common/src/main/resources/data/hexcasting/patchouli_books/thehexbook/en_us/entries/patterns/great_spells/flight.json index ebcf0be4..537a7caa 100644 --- a/Common/src/main/resources/data/hexcasting/patchouli_books/thehexbook/en_us/entries/patterns/great_spells/flight.json +++ b/Common/src/main/resources/data/hexcasting/patchouli_books/thehexbook/en_us/entries/patterns/great_spells/flight.json @@ -1,5 +1,5 @@ { - "name": "hexcasting.spell.hexcasting:flight", + "name": "hexcasting.action.hexcasting:flight", "category": "hexcasting:patterns/great_spells", "icon": "minecraft:feather", "sortnum": 2, diff --git a/Common/src/main/resources/data/hexcasting/patchouli_books/thehexbook/en_us/entries/patterns/great_spells/greater_sentinel.json b/Common/src/main/resources/data/hexcasting/patchouli_books/thehexbook/en_us/entries/patterns/great_spells/greater_sentinel.json index f855cd80..0e26650f 100644 --- a/Common/src/main/resources/data/hexcasting/patchouli_books/thehexbook/en_us/entries/patterns/great_spells/greater_sentinel.json +++ b/Common/src/main/resources/data/hexcasting/patchouli_books/thehexbook/en_us/entries/patterns/great_spells/greater_sentinel.json @@ -1,5 +1,5 @@ { - "name": "hexcasting.spell.hexcasting:sentinel/create/great", + "name": "hexcasting.action.hexcasting:sentinel/create/great", "category": "hexcasting:patterns/great_spells", "icon": "minecraft:beacon", "sortnum": 5, diff --git a/Common/src/main/resources/data/hexcasting/patchouli_books/thehexbook/en_us/entries/patterns/great_spells/make_battery.json b/Common/src/main/resources/data/hexcasting/patchouli_books/thehexbook/en_us/entries/patterns/great_spells/make_battery.json index 1d0af228..2ffd387b 100644 --- a/Common/src/main/resources/data/hexcasting/patchouli_books/thehexbook/en_us/entries/patterns/great_spells/make_battery.json +++ b/Common/src/main/resources/data/hexcasting/patchouli_books/thehexbook/en_us/entries/patterns/great_spells/make_battery.json @@ -1,5 +1,5 @@ { - "name": "hexcasting.spell.hexcasting:craft/battery", + "name": "hexcasting.action.hexcasting:craft/battery", "category": "hexcasting:patterns/great_spells", "icon": "hexcasting:battery{media:10000,max_media:10000}", "sortnum": 6, diff --git a/Common/src/main/resources/data/hexcasting/patchouli_books/thehexbook/en_us/entries/patterns/great_spells/teleport.json b/Common/src/main/resources/data/hexcasting/patchouli_books/thehexbook/en_us/entries/patterns/great_spells/teleport.json index bfef692f..b5ea419c 100644 --- a/Common/src/main/resources/data/hexcasting/patchouli_books/thehexbook/en_us/entries/patterns/great_spells/teleport.json +++ b/Common/src/main/resources/data/hexcasting/patchouli_books/thehexbook/en_us/entries/patterns/great_spells/teleport.json @@ -1,5 +1,5 @@ { - "name": "hexcasting.spell.hexcasting:teleport", + "name": "hexcasting.action.hexcasting:teleport", "category": "hexcasting:patterns/great_spells", "icon": "minecraft:ender_pearl", "sortnum": 3, diff --git a/Common/src/main/resources/data/hexcasting/patchouli_books/thehexbook/en_us/entries/patterns/spells/colorize.json b/Common/src/main/resources/data/hexcasting/patchouli_books/thehexbook/en_us/entries/patterns/spells/colorize.json index 7b396086..dc73936b 100644 --- a/Common/src/main/resources/data/hexcasting/patchouli_books/thehexbook/en_us/entries/patterns/spells/colorize.json +++ b/Common/src/main/resources/data/hexcasting/patchouli_books/thehexbook/en_us/entries/patterns/spells/colorize.json @@ -1,5 +1,5 @@ { - "name": "hexcasting.spell.hexcasting:colorize", + "name": "hexcasting.action.hexcasting:colorize", "category": "hexcasting:patterns/spells", "icon": "hexcasting:pride_colorizer_gay", "sortnum": 5, diff --git a/Fabric/src/main/java/at/petrak/hexcasting/fabric/cc/CCHarness.java b/Fabric/src/main/java/at/petrak/hexcasting/fabric/cc/CCHarness.java index b812fb8a..90603d06 100644 --- a/Fabric/src/main/java/at/petrak/hexcasting/fabric/cc/CCHarness.java +++ b/Fabric/src/main/java/at/petrak/hexcasting/fabric/cc/CCHarness.java @@ -1,6 +1,6 @@ package at.petrak.hexcasting.fabric.cc; -import at.petrak.hexcasting.api.casting.eval.CastingContext; +import at.petrak.hexcasting.api.casting.eval.CastingEnvironment; import at.petrak.hexcasting.api.casting.eval.CastingHarness; import dev.onyxstudios.cca.api.v3.component.Component; import net.minecraft.nbt.CompoundTag; @@ -19,7 +19,7 @@ public class CCHarness implements Component { } public CastingHarness getHarness(InteractionHand hand) { - var ctx = new CastingContext(this.owner, hand, CastingContext.CastSource.STAFF); + var ctx = new CastingEnvironment(this.owner, hand, CastingEnvironment.CastSource.STAFF); if (this.lazyLoadedTag.isEmpty()) { return new CastingHarness(ctx); } else { diff --git a/Fabric/src/main/java/at/petrak/hexcasting/fabric/interop/gravity/OpChangeGravity.kt b/Fabric/src/main/java/at/petrak/hexcasting/fabric/interop/gravity/OpChangeGravity.kt index 2cbbbd57..1f90d789 100644 --- a/Fabric/src/main/java/at/petrak/hexcasting/fabric/interop/gravity/OpChangeGravity.kt +++ b/Fabric/src/main/java/at/petrak/hexcasting/fabric/interop/gravity/OpChangeGravity.kt @@ -2,7 +2,7 @@ package at.petrak.hexcasting.fabric.interop.gravity import at.petrak.hexcasting.api.casting.* import at.petrak.hexcasting.api.casting.castables.SpellAction -import at.petrak.hexcasting.api.casting.eval.CastingContext +import at.petrak.hexcasting.api.casting.eval.CastingEnvironment import at.petrak.hexcasting.api.casting.iota.Iota import com.fusionflux.gravity_api.api.GravityChangerAPI import net.minecraft.core.Direction @@ -12,7 +12,7 @@ import net.minecraft.world.phys.Vec3 object OpChangeGravity : SpellAction { override val argc = 2 - override fun execute(args: List, ctx: CastingContext): + override fun execute(args: List, ctx: CastingEnvironment): Triple> { val target = args.getEntity(0, argc) // TODO is it worth making a special "axial vector" getter @@ -27,7 +27,7 @@ object OpChangeGravity : SpellAction { } private data class Spell(val target: Entity, val dir: Direction) : RenderedSpell { - override fun cast(ctx: CastingContext) { + override fun cast(ctx: CastingEnvironment) { GravityChangerAPI.setDefaultGravityDirection(target, dir) } } diff --git a/Fabric/src/main/java/at/petrak/hexcasting/fabric/interop/gravity/OpGetGravity.kt b/Fabric/src/main/java/at/petrak/hexcasting/fabric/interop/gravity/OpGetGravity.kt index 65483598..4452cd8b 100644 --- a/Fabric/src/main/java/at/petrak/hexcasting/fabric/interop/gravity/OpGetGravity.kt +++ b/Fabric/src/main/java/at/petrak/hexcasting/fabric/interop/gravity/OpGetGravity.kt @@ -2,7 +2,7 @@ package at.petrak.hexcasting.fabric.interop.gravity import at.petrak.hexcasting.api.casting.castables.ConstMediaAction import at.petrak.hexcasting.api.casting.asActionResult -import at.petrak.hexcasting.api.casting.eval.CastingContext +import at.petrak.hexcasting.api.casting.eval.CastingEnvironment import at.petrak.hexcasting.api.casting.getEntity import at.petrak.hexcasting.api.casting.iota.Iota import com.fusionflux.gravity_api.api.GravityChangerAPI @@ -11,7 +11,7 @@ import net.minecraft.world.phys.Vec3 object OpGetGravity : ConstMediaAction { override val argc = 1 - override fun execute(args: List, ctx: CastingContext): List { + override fun execute(args: List, ctx: CastingEnvironment): List { val target = args.getEntity(0) val grav = GravityChangerAPI.getGravityDirection(target) return Vec3.atLowerCornerOf(grav.normal).asActionResult diff --git a/Forge/src/main/java/at/petrak/hexcasting/forge/xplat/ForgeXplatImpl.java b/Forge/src/main/java/at/petrak/hexcasting/forge/xplat/ForgeXplatImpl.java index 31f2b763..66c0a111 100644 --- a/Forge/src/main/java/at/petrak/hexcasting/forge/xplat/ForgeXplatImpl.java +++ b/Forge/src/main/java/at/petrak/hexcasting/forge/xplat/ForgeXplatImpl.java @@ -7,7 +7,7 @@ import at.petrak.hexcasting.api.addldata.ADIotaHolder; import at.petrak.hexcasting.api.addldata.ADMediaHolder; import at.petrak.hexcasting.api.casting.ActionRegistryEntry; import at.petrak.hexcasting.api.casting.castables.SpecialHandler; -import at.petrak.hexcasting.api.casting.eval.CastingContext; +import at.petrak.hexcasting.api.casting.eval.CastingEnvironment; import at.petrak.hexcasting.api.casting.eval.CastingHarness; import at.petrak.hexcasting.api.casting.eval.ResolvedPattern; import at.petrak.hexcasting.api.casting.eval.sideeffects.EvalSound; @@ -239,7 +239,7 @@ public class ForgeXplatImpl implements IXplatAbstractions { @Override public CastingHarness getHarness(ServerPlayer player, InteractionHand hand) { // This is always from a staff because we don't need to load the harness when casting from item - var ctx = new CastingContext(player, hand, CastingContext.CastSource.STAFF); + var ctx = new CastingEnvironment(player, hand, CastingEnvironment.CastSource.STAFF); return CastingHarness.fromNBT(player.getPersistentData().getCompound(TAG_HARNESS), ctx); } From 2c5309da4014c4e34bbbbdd65ed9881cb9961da4 Mon Sep 17 00:00:00 2001 From: "petrak@" Date: Sat, 21 Jan 2023 20:43:28 -0600 Subject: [PATCH 45/95] close #380 --- .../common/casting/PatternRegistryManifest.java | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/Common/src/main/java/at/petrak/hexcasting/common/casting/PatternRegistryManifest.java b/Common/src/main/java/at/petrak/hexcasting/common/casting/PatternRegistryManifest.java index bcea001a..96ba5713 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/casting/PatternRegistryManifest.java +++ b/Common/src/main/java/at/petrak/hexcasting/common/casting/PatternRegistryManifest.java @@ -11,6 +11,7 @@ import at.petrak.hexcasting.api.utils.HexUtils; import at.petrak.hexcasting.server.ScrungledPatternsSave; import at.petrak.hexcasting.xplat.IXplatAbstractions; import com.mojang.datafixers.util.Pair; +import com.mojang.datafixers.util.Unit; import net.minecraft.resources.ResourceKey; import net.minecraft.server.level.ServerLevel; import org.apache.commons.lang3.NotImplementedException; @@ -19,7 +20,6 @@ import org.jetbrains.annotations.Nullable; import java.util.ArrayList; import java.util.Collection; import java.util.concurrent.ConcurrentHashMap; -import java.util.concurrent.ConcurrentLinkedDeque; import java.util.concurrent.ConcurrentMap; // Now an internal-only class used to do final processing on the registered stuff @@ -35,14 +35,17 @@ public class PatternRegistryManifest { * A set of all the per-world patterns. This doesn't store what they are, just that * they exist. */ - private static final ConcurrentLinkedDeque> PER_WORLD_ACTIONS = - new ConcurrentLinkedDeque<>(); + private static final ConcurrentMap, Unit> PER_WORLD_ACTIONS = + new ConcurrentHashMap<>(); /** * Process the registry! *

* Pass null for the OW to signal we're on the client */ + // TODO i just realized that logically, this should not be run every time the client/server connects + // just run it on startup, the info gathered here i think is static per world ... except for the per-worldies + // that need to be recalced... public static void processRegistry(@Nullable ServerLevel overworld) { ScrungledPatternsSave perWorldPatterns = null; if (overworld != null) { @@ -55,7 +58,11 @@ public class PatternRegistryManifest { for (var key : registry.registryKeySet()) { var entry = registry.get(key); if (HexUtils.isOfTag(registry, key, HexTags.Actions.PER_WORLD_PATTERN)) { - PER_WORLD_ACTIONS.add(key); + // We might be double-inserting here, once when the client does it and once when the server does + // However, we do need both to happen (what if it's a dedicated client connecting to a dedicated + // server?) + // hence, a set + PER_WORLD_ACTIONS.put(key, Unit.INSTANCE); // Then we need to create this only on the server, gulp if (perWorldPatterns != null) { @@ -157,7 +164,7 @@ public class PatternRegistryManifest { * Get the IDs of all the patterns marked as per-world */ public static Collection> getAllPerWorldActions() { - return PER_WORLD_ACTIONS; + return PER_WORLD_ACTIONS.keySet(); } /** From 08a733fd7d311f5903e292328a9f87669ee0eb34 Mon Sep 17 00:00:00 2001 From: "petrak@" Date: Sat, 21 Jan 2023 20:50:57 -0600 Subject: [PATCH 46/95] close #382 --- .../casting/operators/math/OpCoerceToAxial.kt | 18 ++++++++++++------ .../assets/hexcasting/lang/en_us.json | 2 +- .../en_us/entries/patterns/math.json | 4 ++-- 3 files changed, 15 insertions(+), 9 deletions(-) diff --git a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/math/OpCoerceToAxial.kt b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/math/OpCoerceToAxial.kt index 7c87129b..5026a7ed 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/math/OpCoerceToAxial.kt +++ b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/math/OpCoerceToAxial.kt @@ -1,21 +1,27 @@ package at.petrak.hexcasting.common.casting.operators.math -import at.petrak.hexcasting.api.casting.castables.ConstMediaAction import at.petrak.hexcasting.api.casting.asActionResult +import at.petrak.hexcasting.api.casting.castables.ConstMediaAction import at.petrak.hexcasting.api.casting.eval.CastingEnvironment -import at.petrak.hexcasting.api.casting.getVec3 +import at.petrak.hexcasting.api.casting.getNumOrVec import at.petrak.hexcasting.api.casting.iota.Iota import net.minecraft.core.Direction import net.minecraft.world.phys.Vec3 +import kotlin.math.sign object OpCoerceToAxial : ConstMediaAction { override val argc: Int get() = 1 override fun execute(args: List, ctx: CastingEnvironment): List { - val vec = args.getVec3(0, argc) - if (vec == Vec3.ZERO) - return vec.asActionResult - return Vec3.atLowerCornerOf(Direction.getNearest(vec.x, vec.y, vec.z).normal).asActionResult + val value = args.getNumOrVec(0, argc) + return value.map({ num -> + num.sign.asActionResult + }, { vec -> + if (vec == Vec3.ZERO) + vec.asActionResult + else + Vec3.atLowerCornerOf(Direction.getNearest(vec.x, vec.y, vec.z).normal).asActionResult + }) } } diff --git a/Common/src/main/resources/assets/hexcasting/lang/en_us.json b/Common/src/main/resources/assets/hexcasting/lang/en_us.json index f8adaea0..8f1f061f 100644 --- a/Common/src/main/resources/assets/hexcasting/lang/en_us.json +++ b/Common/src/main/resources/assets/hexcasting/lang/en_us.json @@ -904,7 +904,7 @@ "hexcasting.page.math.construct_vec": "Combine three numbers at the top of the stack into a vector's X, Y, and Z components (top to bottom).", "hexcasting.page.math.deconstruct_vec": "Split a vector into its X, Y, and Z components (top to bottom).", "hexcasting.page.math.modulo": "Takes the modulus of two numbers. This is the amount $(italics)remaining/$ after division - for example, 5 %% 2 is 1, and 5 %% 3 is 2.", - "hexcasting.page.math.coerce_axial": "Coerces a vector to its nearest axial direction, a unit vector. The zero vector is unaffected.", + "hexcasting.page.math.coerce_axial": "For a vector, coerce it to its nearest axial direction, a unit vector. For a number, return the sign of the number; 1 if positive, -1 if negative. In both cases, zero is unaffected.", "hexcasting.page.math.random": "Creates a random number between 0 and 1.", "hexcasting.entry.advanced_math": "Advanced Mathematics", diff --git a/Common/src/main/resources/data/hexcasting/patchouli_books/thehexbook/en_us/entries/patterns/math.json b/Common/src/main/resources/data/hexcasting/patchouli_books/thehexbook/en_us/entries/patterns/math.json index d3f8594d..10a2526a 100644 --- a/Common/src/main/resources/data/hexcasting/patchouli_books/thehexbook/en_us/entries/patterns/math.json +++ b/Common/src/main/resources/data/hexcasting/patchouli_books/thehexbook/en_us/entries/patterns/math.json @@ -129,8 +129,8 @@ "type": "hexcasting:pattern", "op_id": "hexcasting:coerce_axial", "anchor": "hexcasting:coerce_axial", - "input": "vec", - "output": "vec", + "input": "vec or num", + "output": "vec or num", "text": "hexcasting.page.math.coerce_axial" }, { From dfc7bf59de130d091de208b70d3a04bbcc25ea7e Mon Sep 17 00:00:00 2001 From: "petrak@" Date: Sat, 21 Jan 2023 20:58:09 -0600 Subject: [PATCH 47/95] close #375 --- .../api/casting/eval/CastingEnvironment.kt | 12 ++++++----- .../common/casting/operators/rw/OpWritable.kt | 21 ++++++------------- 2 files changed, 13 insertions(+), 20 deletions(-) diff --git a/Common/src/main/java/at/petrak/hexcasting/api/casting/eval/CastingEnvironment.kt b/Common/src/main/java/at/petrak/hexcasting/api/casting/eval/CastingEnvironment.kt index 0a71f482..4fcc0c72 100644 --- a/Common/src/main/java/at/petrak/hexcasting/api/casting/eval/CastingEnvironment.kt +++ b/Common/src/main/java/at/petrak/hexcasting/api/casting/eval/CastingEnvironment.kt @@ -1,12 +1,12 @@ package at.petrak.hexcasting.api.casting.eval import at.petrak.hexcasting.api.HexAPI.modLoc -import at.petrak.hexcasting.api.misc.DiscoveryHandlers -import at.petrak.hexcasting.api.mod.HexConfig import at.petrak.hexcasting.api.casting.castables.Action import at.petrak.hexcasting.api.casting.mishaps.MishapEntityTooFarAway import at.petrak.hexcasting.api.casting.mishaps.MishapEvalTooDeep import at.petrak.hexcasting.api.casting.mishaps.MishapLocationTooFarAway +import at.petrak.hexcasting.api.misc.DiscoveryHandlers +import at.petrak.hexcasting.api.mod.HexConfig import at.petrak.hexcasting.api.utils.otherHand import at.petrak.hexcasting.common.items.magic.ItemCreativeUnlocker import at.petrak.hexcasting.xplat.IXplatAbstractions @@ -39,7 +39,7 @@ data class CastingEnvironment( ) constructor(caster: ServerPlayer, castingHand: InteractionHand, spellCircleContext: SpellCircleContext) : - this(caster, castingHand, CastSource.SPELL_CIRCLE, spellCircleContext) + this(caster, castingHand, CastSource.SPELL_CIRCLE, spellCircleContext) private var depth: Int = 0 @@ -49,6 +49,8 @@ data class CastingEnvironment( private val entitiesGivenMotion = mutableSetOf() + // TODO: what the hell does this function even do. why are we using it. why do we continually put a predicate + // into here and then do the *same* predicate *again* inline fun getHeldItemToOperateOn(acceptItemIf: (ItemStack) -> Boolean): Pair { val handItem = caster.getItemInHand(otherHand) if (!acceptItemIf(handItem)) { @@ -136,8 +138,8 @@ data class CastingEnvironment( fun canEditBlockAt(pos: BlockPos): Boolean { return this.isVecInRange(Vec3.atCenterOf(pos)) - && this.caster.gameMode.gameModeForPlayer != GameType.ADVENTURE - && this.world.mayInteract(this.caster, pos) + && this.caster.gameMode.gameModeForPlayer != GameType.ADVENTURE + && this.world.mayInteract(this.caster, pos) } /** diff --git a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/rw/OpWritable.kt b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/rw/OpWritable.kt index b1c1a028..ebc4e121 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/rw/OpWritable.kt +++ b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/rw/OpWritable.kt @@ -1,33 +1,24 @@ package at.petrak.hexcasting.common.casting.operators.rw -import at.petrak.hexcasting.api.casting.castables.ConstMediaAction import at.petrak.hexcasting.api.casting.asActionResult +import at.petrak.hexcasting.api.casting.castables.ConstMediaAction import at.petrak.hexcasting.api.casting.eval.CastingEnvironment import at.petrak.hexcasting.api.casting.iota.Iota -import at.petrak.hexcasting.api.casting.mishaps.MishapOthersName +import at.petrak.hexcasting.api.casting.iota.NullIota import at.petrak.hexcasting.xplat.IXplatAbstractions object OpWritable : ConstMediaAction { - override val argc = 1 + override val argc = 0 override fun execute(args: List, ctx: CastingEnvironment): List { - val datum = args[0] - val (handStack) = ctx.getHeldItemToOperateOn { val datumHolder = IXplatAbstractions.INSTANCE.findDataHolder(it) - datumHolder != null && datumHolder.writeIota(datum, true) + datumHolder != null } val datumHolder = IXplatAbstractions.INSTANCE.findDataHolder(handStack) ?: return false.asActionResult - - if (!datumHolder.writeIota(datum, true)) - return false.asActionResult - - val trueName = MishapOthersName.getTrueNameFromDatum(datum, ctx.caster) - if (trueName != null) - return false.asActionResult - - return true.asActionResult + val success = datumHolder.writeIota(NullIota(), true) + return success.asActionResult } } From 39ef925229eb3ba5b7333b66e469395fa56cdb33 Mon Sep 17 00:00:00 2001 From: "petrak@" Date: Sun, 22 Jan 2023 12:47:26 -0600 Subject: [PATCH 48/95] close #374 --- .../8f7cd5c924d3264b7777ef1696459761f9a70902 | 22 +- .../hexcasting/models/item/acacia_staff.json | 6 - .../hexcasting/models/item/birch_staff.json | 6 - .../hexcasting/models/item/bosnia_staff.json | 6 - .../hexcasting/models/item/crimson_staff.json | 6 - .../models/item/dark_oak_staff.json | 6 - .../hexcasting/models/item/edified_staff.json | 6 - .../hexcasting/models/item/jungle_staff.json | 6 - .../models/item/mangrove_staff.json | 20 + .../hexcasting/models/item/oak_staff.json | 6 - .../hexcasting/models/item/spruce_staff.json | 6 - .../hexcasting/models/item/warped_staff.json | 6 - .../client/RegisterClientStuff.java | 12 +- .../hexcasting/common/lib/HexItems.java | 1 + .../datagen/recipe/HexplatRecipes.java | 795 +++++++++--------- .../datagen/tag/HexItemTagProvider.java | 2 +- .../assets/hexcasting/lang/en_us.json | 1 + .../item/staves/{bosnia.png => mangrove.png} | Bin .../thehexbook/en_us/entries/items/staff.json | 1 + .../03e4de26f1265135874f8cdcaebc09d9c08eb42b | 4 +- .../67cce32b1c3cbbcb1f646605f4914e3f196986c2 | 2 +- .../75bcd4dba6ca7d365462b0ec45e291d1056349c4 | 2 +- .../844611d4af49e23072b8a888c8e73c6c5d8c0768 | 2 +- .../9fb1092f32d4fcbf9e061ffd718d4ec689c6c95e | 4 +- .../mangrove_staff.json | 34 + .../hexcasting/recipes/mangrove_staff.json | 22 + .../data/hexcasting/tags/items/staves.json | 3 +- .../03e4de26f1265135874f8cdcaebc09d9c08eb42b | 4 +- .../9fb1092f32d4fcbf9e061ffd718d4ec689c6c95e | 4 +- .../recipes/hexcasting/mangrove_staff.json | 34 + .../hexcasting/recipes/mangrove_staff.json | 22 + .../data/hexcasting/tags/items/staves.json | 3 +- .../forge/datagen/xplat/HexItemModels.java | 6 +- .../forge/interop/jei/HexJEIPlugin.java | 26 +- 34 files changed, 584 insertions(+), 502 deletions(-) delete mode 100644 Common/src/generated/resources/assets/hexcasting/models/item/bosnia_staff.json create mode 100644 Common/src/generated/resources/assets/hexcasting/models/item/mangrove_staff.json rename Common/src/main/resources/assets/hexcasting/textures/item/staves/{bosnia.png => mangrove.png} (100%) create mode 100644 Fabric/src/generated/resources/data/hexcasting/advancements/recipes/hexcasting.creative_tab/mangrove_staff.json create mode 100644 Fabric/src/generated/resources/data/hexcasting/recipes/mangrove_staff.json create mode 100644 Forge/src/generated/resources/data/hexcasting/advancements/recipes/hexcasting/mangrove_staff.json create mode 100644 Forge/src/generated/resources/data/hexcasting/recipes/mangrove_staff.json diff --git a/Common/src/generated/resources/.cache/8f7cd5c924d3264b7777ef1696459761f9a70902 b/Common/src/generated/resources/.cache/8f7cd5c924d3264b7777ef1696459761f9a70902 index c6144611..113ecb7a 100644 --- a/Common/src/generated/resources/.cache/8f7cd5c924d3264b7777ef1696459761f9a70902 +++ b/Common/src/generated/resources/.cache/8f7cd5c924d3264b7777ef1696459761f9a70902 @@ -1,21 +1,20 @@ -// 1.19.2 2022-11-09T19:44:43.409223 Item Models: hexcasting +// 1.19.2 2023-01-22T12:41:02.49644171 Item Models: hexcasting f2156b3a7041cf99891b528393db64c6b9ca1a4f assets/hexcasting/models/item/abacus.json -783d8454d6b74f926be0d3e02d87c6505e9d76d0 assets/hexcasting/models/item/acacia_staff.json +933059cd7c2dbaff0e643c644c14af0c0e77aa29 assets/hexcasting/models/item/acacia_staff.json 19730853397b109cfedd0c3bbda83d5de6cd15b9 assets/hexcasting/models/item/akashic_record.json 8c735feff09d46d00ed681311f46f61a50cfdc9b assets/hexcasting/models/item/amethyst_dust.json d1b0892de9d751e7bebc763e6407d5285363c851 assets/hexcasting/models/item/artifact.json 7eb3eb776e70eb616c12ada500b9d1d6a3249a6a assets/hexcasting/models/item/artifact_filled.json 82e3be7bbdad92d2b4c728be54d9d2f2809a0ac2 assets/hexcasting/models/item/battery.json -3dcc41ab5cbf7004f9c959d89be961aff0ce6032 assets/hexcasting/models/item/birch_staff.json -f05937151873b1de302a011851edc62d0554e4db assets/hexcasting/models/item/bosnia_staff.json +d1310c25bca32980214aa1054eddb1772fb55d12 assets/hexcasting/models/item/birch_staff.json ec7c3a51882a432185fdbb6a449e66165b6a4c4c assets/hexcasting/models/item/charged_amethyst.json c64ed609ece68994ce23dd2809145040bce13579 assets/hexcasting/models/item/conjured.json c64ed609ece68994ce23dd2809145040bce13579 assets/hexcasting/models/item/conjured_block.json c8da4227db3c80e3e2e7f2fb2ae2649656429d68 assets/hexcasting/models/item/creative_unlocker.json -21c0b8d424043a1b0d2748f59d292b129193d9a5 assets/hexcasting/models/item/crimson_staff.json +b0ad71595b450f5b9a6bdc2a14fc03afef0b850a assets/hexcasting/models/item/crimson_staff.json e47acd1d6ef29a3e1941afb1b212bd40b963cb72 assets/hexcasting/models/item/cypher.json 2db55347092ad6bc9e58bc968e88a3b6c5fd77c1 assets/hexcasting/models/item/cypher_filled.json -81eed736b6bae7e427d3c6972ef15a8d967489e5 assets/hexcasting/models/item/dark_oak_staff.json +cfaf12703ca40959bc5bedac4d1c120273704fcf assets/hexcasting/models/item/dark_oak_staff.json 113c51af571a92009f5f687a82e10bc5ce97b010 assets/hexcasting/models/item/dye_colorizer_black.json b5a04716775ba2e1b137abc513025b2f1065e5d1 assets/hexcasting/models/item/dye_colorizer_blue.json 0bb3afbd937b2e07523a581f6e3f389e11078595 assets/hexcasting/models/item/dye_colorizer_brown.json @@ -37,7 +36,7 @@ c9faada6299f388afc2d2798843d2b45159950d1 assets/hexcasting/models/item/edified_d 7f22e012a844cc2c5e30b0fcbdc2e7e4afac1c40 assets/hexcasting/models/item/edified_log.json 6b2c9d4aca0c869d7e18707c22b00c14e1d30f0c assets/hexcasting/models/item/edified_pressure_plate.json 31b4d60ff15a6d6de7aecb6feeba25a366bba2fd assets/hexcasting/models/item/edified_slab.json -66d951804b32cb77bbe6e81d5053ea14c9690b1b assets/hexcasting/models/item/edified_staff.json +ff0e3934116fdae9ecad0d006402868914ab42ec assets/hexcasting/models/item/edified_staff.json 2584421c2e9e1cdf22a703018b54cf449613d7d9 assets/hexcasting/models/item/edified_stairs.json ae58c5b7c304d33cbde60caf44a4c4ee4ec1a633 assets/hexcasting/models/item/edified_trapdoor.json 084183e4351973c8165f6f459c0f0dba2463d957 assets/hexcasting/models/item/edified_wood.json @@ -45,10 +44,11 @@ ae58c5b7c304d33cbde60caf44a4c4ee4ec1a633 assets/hexcasting/models/item/edified_t 947d1539d88f9d6fd0afcdf831f4327356d19baf assets/hexcasting/models/item/focus_filled.json cb2d973af25a2ec07e6094ecc106c896a06918dc assets/hexcasting/models/item/focus_sealed.json 6ec61fea7d8c49cc0c45b64857fd926451b4845f assets/hexcasting/models/item/jeweler_hammer.json -e8ce683966f007b56cc551b3137c77f0a1fe2d9a assets/hexcasting/models/item/jungle_staff.json +c34501cbfc0bb1b6943b4a9986fbe927ff177c61 assets/hexcasting/models/item/jungle_staff.json abfc028c974a02780aed3d7a5859352503bbd920 assets/hexcasting/models/item/lens.json a34a6d777ae265c7e49c8bb23c15f04359236544 assets/hexcasting/models/item/lore_fragment.json -9c79526e19bfafb8370718ddcc9126204ed85e3a assets/hexcasting/models/item/oak_staff.json +371c16c6c882d6d0370135a8953c408fa1658bed assets/hexcasting/models/item/mangrove_staff.json +a17e45161b6723e72c710695a536e39ba0905725 assets/hexcasting/models/item/oak_staff.json 38d1dc73c49d185b86c098b13611bf3ec07b255c assets/hexcasting/models/item/old_staff.json 82fa0a2bb17e40c0b3f826e97b2e95445ec24ab8 assets/hexcasting/models/item/patchouli_book.json d69d10e6cb967b98b3294cc86174182c671de671 assets/hexcasting/models/item/phial_large_0.json @@ -97,11 +97,11 @@ e6452f95b60240e0067769d7f32a0b9fa7718a1b assets/hexcasting/models/item/slate_wri 986674763b45e0f9381f9f34a708082e5230652a assets/hexcasting/models/item/spellbook.json f962c13ab9e299885387cee35b16006651821e81 assets/hexcasting/models/item/spellbook_filled.json c29e6e7b2168eeeb13b1fc3e93ffc3e0c9bd11ce assets/hexcasting/models/item/spellbook_sealed.json -7f03c6ea7a07cfedc7d580bb9ba5fcdc54cccb86 assets/hexcasting/models/item/spruce_staff.json +2f422cc59c84f6c997475367967390186adce5f0 assets/hexcasting/models/item/spruce_staff.json d6ebc87cb0fa6f86bee3a4eade7329ebb0cf2d38 assets/hexcasting/models/item/stripped_edified_log.json ea3f18f75776022127f3a108119e3f7a5c211c0f assets/hexcasting/models/item/stripped_edified_wood.json 0a100b64e77394606018320bbc5752a546fe0af4 assets/hexcasting/models/item/sub_sandwich.json 5f4831d11d8f45b037a6f48e12d2e794ada7b961 assets/hexcasting/models/item/trinket.json 946970e74b8d3c76c15191f494bc1f3d7e36aa43 assets/hexcasting/models/item/trinket_filled.json c6523de66cbfae3a1e6361c635cc693a0a089bb3 assets/hexcasting/models/item/uuid_colorizer.json -f5b45d5997acc8abe8cc70065a5790b642234fcb assets/hexcasting/models/item/warped_staff.json +a882b3dbb46c9abee345c446fb83f4d293442c5f assets/hexcasting/models/item/warped_staff.json diff --git a/Common/src/generated/resources/assets/hexcasting/models/item/acacia_staff.json b/Common/src/generated/resources/assets/hexcasting/models/item/acacia_staff.json index b1db1c8f..e54d2ca3 100644 --- a/Common/src/generated/resources/assets/hexcasting/models/item/acacia_staff.json +++ b/Common/src/generated/resources/assets/hexcasting/models/item/acacia_staff.json @@ -12,12 +12,6 @@ "predicate": { "hexcasting:funny_level": 1.0 } - }, - { - "model": "hexcasting:item/bosnia_staff", - "predicate": { - "hexcasting:funny_level": 2.0 - } } ], "textures": { diff --git a/Common/src/generated/resources/assets/hexcasting/models/item/birch_staff.json b/Common/src/generated/resources/assets/hexcasting/models/item/birch_staff.json index f3705923..c2f6b2b2 100644 --- a/Common/src/generated/resources/assets/hexcasting/models/item/birch_staff.json +++ b/Common/src/generated/resources/assets/hexcasting/models/item/birch_staff.json @@ -12,12 +12,6 @@ "predicate": { "hexcasting:funny_level": 1.0 } - }, - { - "model": "hexcasting:item/bosnia_staff", - "predicate": { - "hexcasting:funny_level": 2.0 - } } ], "textures": { diff --git a/Common/src/generated/resources/assets/hexcasting/models/item/bosnia_staff.json b/Common/src/generated/resources/assets/hexcasting/models/item/bosnia_staff.json deleted file mode 100644 index ef91e958..00000000 --- a/Common/src/generated/resources/assets/hexcasting/models/item/bosnia_staff.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "parent": "minecraft:item/handheld_rod", - "textures": { - "layer0": "hexcasting:item/staves/bosnia" - } -} \ No newline at end of file diff --git a/Common/src/generated/resources/assets/hexcasting/models/item/crimson_staff.json b/Common/src/generated/resources/assets/hexcasting/models/item/crimson_staff.json index cc4245dc..2715a166 100644 --- a/Common/src/generated/resources/assets/hexcasting/models/item/crimson_staff.json +++ b/Common/src/generated/resources/assets/hexcasting/models/item/crimson_staff.json @@ -12,12 +12,6 @@ "predicate": { "hexcasting:funny_level": 1.0 } - }, - { - "model": "hexcasting:item/bosnia_staff", - "predicate": { - "hexcasting:funny_level": 2.0 - } } ], "textures": { diff --git a/Common/src/generated/resources/assets/hexcasting/models/item/dark_oak_staff.json b/Common/src/generated/resources/assets/hexcasting/models/item/dark_oak_staff.json index 5d11497a..939d435b 100644 --- a/Common/src/generated/resources/assets/hexcasting/models/item/dark_oak_staff.json +++ b/Common/src/generated/resources/assets/hexcasting/models/item/dark_oak_staff.json @@ -12,12 +12,6 @@ "predicate": { "hexcasting:funny_level": 1.0 } - }, - { - "model": "hexcasting:item/bosnia_staff", - "predicate": { - "hexcasting:funny_level": 2.0 - } } ], "textures": { diff --git a/Common/src/generated/resources/assets/hexcasting/models/item/edified_staff.json b/Common/src/generated/resources/assets/hexcasting/models/item/edified_staff.json index 02877aa7..a4d0e91c 100644 --- a/Common/src/generated/resources/assets/hexcasting/models/item/edified_staff.json +++ b/Common/src/generated/resources/assets/hexcasting/models/item/edified_staff.json @@ -12,12 +12,6 @@ "predicate": { "hexcasting:funny_level": 1.0 } - }, - { - "model": "hexcasting:item/bosnia_staff", - "predicate": { - "hexcasting:funny_level": 2.0 - } } ], "textures": { diff --git a/Common/src/generated/resources/assets/hexcasting/models/item/jungle_staff.json b/Common/src/generated/resources/assets/hexcasting/models/item/jungle_staff.json index 43a0711d..2a8e6757 100644 --- a/Common/src/generated/resources/assets/hexcasting/models/item/jungle_staff.json +++ b/Common/src/generated/resources/assets/hexcasting/models/item/jungle_staff.json @@ -12,12 +12,6 @@ "predicate": { "hexcasting:funny_level": 1.0 } - }, - { - "model": "hexcasting:item/bosnia_staff", - "predicate": { - "hexcasting:funny_level": 2.0 - } } ], "textures": { diff --git a/Common/src/generated/resources/assets/hexcasting/models/item/mangrove_staff.json b/Common/src/generated/resources/assets/hexcasting/models/item/mangrove_staff.json new file mode 100644 index 00000000..e69d8ac6 --- /dev/null +++ b/Common/src/generated/resources/assets/hexcasting/models/item/mangrove_staff.json @@ -0,0 +1,20 @@ +{ + "parent": "minecraft:item/handheld_rod", + "overrides": [ + { + "model": "hexcasting:item/mangrove_staff", + "predicate": { + "hexcasting:funny_level": 0.0 + } + }, + { + "model": "hexcasting:item/old_staff", + "predicate": { + "hexcasting:funny_level": 1.0 + } + } + ], + "textures": { + "layer0": "hexcasting:item/staves/mangrove" + } +} \ No newline at end of file diff --git a/Common/src/generated/resources/assets/hexcasting/models/item/oak_staff.json b/Common/src/generated/resources/assets/hexcasting/models/item/oak_staff.json index 6897ef64..09046336 100644 --- a/Common/src/generated/resources/assets/hexcasting/models/item/oak_staff.json +++ b/Common/src/generated/resources/assets/hexcasting/models/item/oak_staff.json @@ -12,12 +12,6 @@ "predicate": { "hexcasting:funny_level": 1.0 } - }, - { - "model": "hexcasting:item/bosnia_staff", - "predicate": { - "hexcasting:funny_level": 2.0 - } } ], "textures": { diff --git a/Common/src/generated/resources/assets/hexcasting/models/item/spruce_staff.json b/Common/src/generated/resources/assets/hexcasting/models/item/spruce_staff.json index 043989b5..e37d6a02 100644 --- a/Common/src/generated/resources/assets/hexcasting/models/item/spruce_staff.json +++ b/Common/src/generated/resources/assets/hexcasting/models/item/spruce_staff.json @@ -12,12 +12,6 @@ "predicate": { "hexcasting:funny_level": 1.0 } - }, - { - "model": "hexcasting:item/bosnia_staff", - "predicate": { - "hexcasting:funny_level": 2.0 - } } ], "textures": { diff --git a/Common/src/generated/resources/assets/hexcasting/models/item/warped_staff.json b/Common/src/generated/resources/assets/hexcasting/models/item/warped_staff.json index 256f63dd..14f56cf0 100644 --- a/Common/src/generated/resources/assets/hexcasting/models/item/warped_staff.json +++ b/Common/src/generated/resources/assets/hexcasting/models/item/warped_staff.json @@ -12,12 +12,6 @@ "predicate": { "hexcasting:funny_level": 1.0 } - }, - { - "model": "hexcasting:item/bosnia_staff", - "predicate": { - "hexcasting:funny_level": 2.0 - } } ], "textures": { diff --git a/Common/src/main/java/at/petrak/hexcasting/client/RegisterClientStuff.java b/Common/src/main/java/at/petrak/hexcasting/client/RegisterClientStuff.java index 09e66e6a..991d16b9 100644 --- a/Common/src/main/java/at/petrak/hexcasting/client/RegisterClientStuff.java +++ b/Common/src/main/java/at/petrak/hexcasting/client/RegisterClientStuff.java @@ -18,8 +18,8 @@ import at.petrak.hexcasting.common.items.magic.ItemMediaBattery; import at.petrak.hexcasting.common.items.magic.ItemPackagedHex; import at.petrak.hexcasting.common.lib.HexBlockEntities; import at.petrak.hexcasting.common.lib.HexBlocks; -import at.petrak.hexcasting.common.lib.hex.HexIotaTypes; import at.petrak.hexcasting.common.lib.HexItems; +import at.petrak.hexcasting.common.lib.hex.HexIotaTypes; import at.petrak.hexcasting.xplat.IClientXplatAbstractions; import com.mojang.datafixers.util.Pair; import net.minecraft.ChatFormatting; @@ -121,7 +121,7 @@ public class RegisterClientStuff { } public static void registerColorProviders(BiConsumer itemColorRegistry, - BiConsumer blockColorRegistry) { + BiConsumer blockColorRegistry) { itemColorRegistry.accept(makeIotaStorageColorizer(HexItems.FOCUS::getColor), HexItems.FOCUS); itemColorRegistry.accept(makeIotaStorageColorizer(HexItems.SPELLBOOK::getColor), HexItems.SPELLBOOK); @@ -303,7 +303,7 @@ public class RegisterClientStuff { } private static void registerDataHolderOverrides(IotaHolderItem item, Predicate hasIota, - Predicate isSealed) { + Predicate isSealed) { IClientXplatAbstractions.INSTANCE.registerItemProperty((Item) item, ItemFocus.OVERLAY_PRED, (stack, level, holder, holderID) -> { if (!hasIota.test(stack) && !NBTHelper.hasString(stack, IotaHolderItem.TAG_OVERRIDE_VISUALLY)) { @@ -326,7 +326,7 @@ public class RegisterClientStuff { // Copypasta from PoweredRailBlock.class private static int findPoweredRailSignal(Level level, BlockPos pos, BlockState state, boolean travelPositive, - int depth) { + int depth) { if (depth >= 8) { return 0; } else { @@ -447,8 +447,6 @@ public class RegisterClientStuff { var name = stack.getHoverName().getString().toLowerCase(Locale.ROOT); if (name.contains("old")) { return 1f; - } else if (name.contains("wand of the forest")) { - return 2f; } else { return 0f; } @@ -464,6 +462,6 @@ public class RegisterClientStuff { @FunctionalInterface public interface BlockEntityRendererRegisterererer { void registerBlockEntityRenderer(BlockEntityType type, - BlockEntityRendererProvider berp); + BlockEntityRendererProvider berp); } } diff --git a/Common/src/main/java/at/petrak/hexcasting/common/lib/HexItems.java b/Common/src/main/java/at/petrak/hexcasting/common/lib/HexItems.java index aabcc622..0dd1878b 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/lib/HexItems.java +++ b/Common/src/main/java/at/petrak/hexcasting/common/lib/HexItems.java @@ -40,6 +40,7 @@ public class HexItems { public static final ItemStaff STAFF_DARK_OAK = make("dark_oak_staff", new ItemStaff(unstackable())); public static final ItemStaff STAFF_CRIMSON = make("crimson_staff", new ItemStaff(unstackable())); public static final ItemStaff STAFF_WARPED = make("warped_staff", new ItemStaff(unstackable())); + public static final ItemStaff STAFF_MANGROVE = make("mangrove_staff", new ItemStaff(unstackable())); public static final ItemStaff STAFF_EDIFIED = make("edified_staff", new ItemStaff(unstackable())); public static final ItemLens SCRYING_LENS = make("lens", new ItemLens( diff --git a/Common/src/main/java/at/petrak/hexcasting/datagen/recipe/HexplatRecipes.java b/Common/src/main/java/at/petrak/hexcasting/datagen/recipe/HexplatRecipes.java index 84ce42d2..2fd999e6 100644 --- a/Common/src/main/java/at/petrak/hexcasting/datagen/recipe/HexplatRecipes.java +++ b/Common/src/main/java/at/petrak/hexcasting/datagen/recipe/HexplatRecipes.java @@ -46,463 +46,464 @@ import java.util.function.Function; // TODO: need to do a big refactor of this class cause it's giant and unwieldy, probably as part of #360 public class HexplatRecipes extends PaucalRecipeProvider { - private final DataGenerator generator; - private final IXplatIngredients ingredients; - private final Function conditions; + private final DataGenerator generator; + private final IXplatIngredients ingredients; + private final Function conditions; - public HexplatRecipes(DataGenerator generator, IXplatIngredients ingredients, - Function conditions) { - super(generator, HexAPI.MOD_ID); - this.generator = generator; - this.ingredients = ingredients; - this.conditions = conditions; - } + public HexplatRecipes(DataGenerator generator, IXplatIngredients ingredients, + Function conditions) { + super(generator, HexAPI.MOD_ID); + this.generator = generator; + this.ingredients = ingredients; + this.conditions = conditions; + } - @Override - protected void makeRecipes(Consumer recipes) { - specialRecipe(recipes, SealFocusRecipe.SERIALIZER); - specialRecipe(recipes, SealSpellbookRecipe.SERIALIZER); + @Override + protected void makeRecipes(Consumer recipes) { + specialRecipe(recipes, SealFocusRecipe.SERIALIZER); + specialRecipe(recipes, SealSpellbookRecipe.SERIALIZER); - staffRecipe(recipes, HexItems.STAFF_OAK, Items.OAK_PLANKS); - staffRecipe(recipes, HexItems.STAFF_BIRCH, Items.BIRCH_PLANKS); - staffRecipe(recipes, HexItems.STAFF_SPRUCE, Items.SPRUCE_PLANKS); - staffRecipe(recipes, HexItems.STAFF_JUNGLE, Items.JUNGLE_PLANKS); - staffRecipe(recipes, HexItems.STAFF_DARK_OAK, Items.DARK_OAK_PLANKS); - staffRecipe(recipes, HexItems.STAFF_ACACIA, Items.ACACIA_PLANKS); - staffRecipe(recipes, HexItems.STAFF_CRIMSON, Items.CRIMSON_PLANKS); - staffRecipe(recipes, HexItems.STAFF_WARPED, Items.WARPED_PLANKS); - staffRecipe(recipes, HexItems.STAFF_EDIFIED, HexBlocks.EDIFIED_PLANKS.asItem()); + staffRecipe(recipes, HexItems.STAFF_OAK, Items.OAK_PLANKS); + staffRecipe(recipes, HexItems.STAFF_BIRCH, Items.BIRCH_PLANKS); + staffRecipe(recipes, HexItems.STAFF_SPRUCE, Items.SPRUCE_PLANKS); + staffRecipe(recipes, HexItems.STAFF_JUNGLE, Items.JUNGLE_PLANKS); + staffRecipe(recipes, HexItems.STAFF_DARK_OAK, Items.DARK_OAK_PLANKS); + staffRecipe(recipes, HexItems.STAFF_ACACIA, Items.ACACIA_PLANKS); + staffRecipe(recipes, HexItems.STAFF_CRIMSON, Items.CRIMSON_PLANKS); + staffRecipe(recipes, HexItems.STAFF_WARPED, Items.WARPED_PLANKS); + staffRecipe(recipes, HexItems.STAFF_MANGROVE, Items.MANGROVE_PLANKS); + staffRecipe(recipes, HexItems.STAFF_EDIFIED, HexBlocks.EDIFIED_PLANKS.asItem()); - ringCornered(HexItems.FOCUS, 1, - ingredients.glowstoneDust(), - ingredients.leather(), - Ingredient.of(HexItems.CHARGED_AMETHYST)) - .unlockedBy("has_item", hasItem(HexTags.Items.STAVES)) - .save(recipes); + ringCornered(HexItems.FOCUS, 1, + ingredients.glowstoneDust(), + ingredients.leather(), + Ingredient.of(HexItems.CHARGED_AMETHYST)) + .unlockedBy("has_item", hasItem(HexTags.Items.STAVES)) + .save(recipes); - ShapedRecipeBuilder.shaped(HexItems.SPELLBOOK) - .define('N', ingredients.goldNugget()) - .define('B', Items.WRITABLE_BOOK) - .define('A', HexItems.CHARGED_AMETHYST) - .define('F', Items.CHORUS_FRUIT) // i wanna gate this behind the end SOMEHOW - // hey look its my gender ^^ - .pattern("NBA") - .pattern("NFA") - .pattern("NBA") - .unlockedBy("has_focus", hasItem(HexItems.FOCUS)) - .unlockedBy("has_chorus", hasItem(Items.CHORUS_FRUIT)).save(recipes); + ShapedRecipeBuilder.shaped(HexItems.SPELLBOOK) + .define('N', ingredients.goldNugget()) + .define('B', Items.WRITABLE_BOOK) + .define('A', HexItems.CHARGED_AMETHYST) + .define('F', Items.CHORUS_FRUIT) // i wanna gate this behind the end SOMEHOW + // hey look its my gender ^^ + .pattern("NBA") + .pattern("NFA") + .pattern("NBA") + .unlockedBy("has_focus", hasItem(HexItems.FOCUS)) + .unlockedBy("has_chorus", hasItem(Items.CHORUS_FRUIT)).save(recipes); - ringCornerless( - HexItems.CYPHER, 1, - ingredients.copperIngot(), - Ingredient.of(HexItems.AMETHYST_DUST)) - .unlockedBy("has_item", hasItem(HexTags.Items.STAVES)).save(recipes); + ringCornerless( + HexItems.CYPHER, 1, + ingredients.copperIngot(), + Ingredient.of(HexItems.AMETHYST_DUST)) + .unlockedBy("has_item", hasItem(HexTags.Items.STAVES)).save(recipes); - ringCornerless( - HexItems.TRINKET, 1, - ingredients.ironIngot(), - Ingredient.of(Items.AMETHYST_SHARD)) - .unlockedBy("has_item", hasItem(HexTags.Items.STAVES)).save(recipes); + ringCornerless( + HexItems.TRINKET, 1, + ingredients.ironIngot(), + Ingredient.of(Items.AMETHYST_SHARD)) + .unlockedBy("has_item", hasItem(HexTags.Items.STAVES)).save(recipes); - ShapedRecipeBuilder.shaped(HexItems.ARTIFACT) - .define('F', ingredients.goldIngot()) - .define('A', HexItems.CHARGED_AMETHYST) - // why in god's name does minecraft have two different places for item tags - .define('D', ItemTags.MUSIC_DISCS) - .pattern(" F ") - .pattern("FAF") - .pattern(" D ") - .unlockedBy("has_item", hasItem(HexTags.Items.STAVES)).save(recipes); + ShapedRecipeBuilder.shaped(HexItems.ARTIFACT) + .define('F', ingredients.goldIngot()) + .define('A', HexItems.CHARGED_AMETHYST) + // why in god's name does minecraft have two different places for item tags + .define('D', ItemTags.MUSIC_DISCS) + .pattern(" F ") + .pattern("FAF") + .pattern(" D ") + .unlockedBy("has_item", hasItem(HexTags.Items.STAVES)).save(recipes); - ringCornerless(HexItems.SCRYING_LENS, 1, Items.GLASS, HexItems.AMETHYST_DUST) - .unlockedBy("has_item", hasItem(HexTags.Items.STAVES)).save(recipes); + ringCornerless(HexItems.SCRYING_LENS, 1, Items.GLASS, HexItems.AMETHYST_DUST) + .unlockedBy("has_item", hasItem(HexTags.Items.STAVES)).save(recipes); - ShapedRecipeBuilder.shaped(HexItems.ABACUS) - .define('S', Items.STICK) - .define('A', Items.AMETHYST_SHARD) - .define('W', ItemTags.PLANKS) - .pattern("WAW") - .pattern("SAS") - .pattern("WAW") - .unlockedBy("has_item", hasItem(HexTags.Items.STAVES)).save(recipes); + ShapedRecipeBuilder.shaped(HexItems.ABACUS) + .define('S', Items.STICK) + .define('A', Items.AMETHYST_SHARD) + .define('W', ItemTags.PLANKS) + .pattern("WAW") + .pattern("SAS") + .pattern("WAW") + .unlockedBy("has_item", hasItem(HexTags.Items.STAVES)).save(recipes); - // Why am I like this - ShapedRecipeBuilder.shaped(HexItems.SUBMARINE_SANDWICH) - .define('S', Items.STICK) - .define('A', Items.AMETHYST_SHARD) - .define('C', Items.COOKED_BEEF) - .define('B', Items.BREAD) - .pattern(" SA") - .pattern(" C ") - .pattern(" B ") - .unlockedBy("has_item", hasItem(Items.AMETHYST_SHARD)).save(recipes); + // Why am I like this + ShapedRecipeBuilder.shaped(HexItems.SUBMARINE_SANDWICH) + .define('S', Items.STICK) + .define('A', Items.AMETHYST_SHARD) + .define('C', Items.COOKED_BEEF) + .define('B', Items.BREAD) + .pattern(" SA") + .pattern(" C ") + .pattern(" B ") + .unlockedBy("has_item", hasItem(Items.AMETHYST_SHARD)).save(recipes); - for (var dye : DyeColor.values()) { - var item = HexItems.DYE_COLORIZERS.get(dye); - ShapedRecipeBuilder.shaped(item) - .define('D', HexItems.AMETHYST_DUST) - .define('C', DyeItem.byColor(dye)) - .pattern(" D ") - .pattern("DCD") - .pattern(" D ") - .unlockedBy("has_item", hasItem(HexItems.AMETHYST_DUST)).save(recipes); - } + for (var dye : DyeColor.values()) { + var item = HexItems.DYE_COLORIZERS.get(dye); + ShapedRecipeBuilder.shaped(item) + .define('D', HexItems.AMETHYST_DUST) + .define('C', DyeItem.byColor(dye)) + .pattern(" D ") + .pattern("DCD") + .pattern(" D ") + .unlockedBy("has_item", hasItem(HexItems.AMETHYST_DUST)).save(recipes); + } - gayRecipe(recipes, ItemPrideColorizer.Type.AGENDER, Ingredient.of(Items.GLASS)); - gayRecipe(recipes, ItemPrideColorizer.Type.AROACE, Ingredient.of(Items.WHEAT_SEEDS)); - gayRecipe(recipes, ItemPrideColorizer.Type.AROMANTIC, Ingredient.of(Items.ARROW)); - gayRecipe(recipes, ItemPrideColorizer.Type.ASEXUAL, Ingredient.of(Items.BREAD)); - gayRecipe(recipes, ItemPrideColorizer.Type.BISEXUAL, Ingredient.of(Items.WHEAT)); - gayRecipe(recipes, ItemPrideColorizer.Type.DEMIBOY, Ingredient.of(Items.RAW_IRON)); - gayRecipe(recipes, ItemPrideColorizer.Type.DEMIGIRL, Ingredient.of(Items.RAW_COPPER)); - gayRecipe(recipes, ItemPrideColorizer.Type.GAY, Ingredient.of(Items.STONE_BRICK_WALL)); - gayRecipe(recipes, ItemPrideColorizer.Type.GENDERFLUID, Ingredient.of(Items.WATER_BUCKET)); - gayRecipe(recipes, ItemPrideColorizer.Type.GENDERQUEER, Ingredient.of(Items.GLASS_BOTTLE)); - gayRecipe(recipes, ItemPrideColorizer.Type.INTERSEX, Ingredient.of(Items.AZALEA)); - gayRecipe(recipes, ItemPrideColorizer.Type.LESBIAN, Ingredient.of(Items.HONEYCOMB)); - gayRecipe(recipes, ItemPrideColorizer.Type.NONBINARY, Ingredient.of(Items.MOSS_BLOCK)); - gayRecipe(recipes, ItemPrideColorizer.Type.PANSEXUAL, ingredients.whenModIngredient( - Ingredient.of(Items.CARROT), - "farmersdelight", - CompatIngredientValue.of("farmersdelight:skillet") - )); - gayRecipe(recipes, ItemPrideColorizer.Type.PLURAL, Ingredient.of(Items.REPEATER)); - gayRecipe(recipes, ItemPrideColorizer.Type.TRANSGENDER, Ingredient.of(Items.EGG)); + gayRecipe(recipes, ItemPrideColorizer.Type.AGENDER, Ingredient.of(Items.GLASS)); + gayRecipe(recipes, ItemPrideColorizer.Type.AROACE, Ingredient.of(Items.WHEAT_SEEDS)); + gayRecipe(recipes, ItemPrideColorizer.Type.AROMANTIC, Ingredient.of(Items.ARROW)); + gayRecipe(recipes, ItemPrideColorizer.Type.ASEXUAL, Ingredient.of(Items.BREAD)); + gayRecipe(recipes, ItemPrideColorizer.Type.BISEXUAL, Ingredient.of(Items.WHEAT)); + gayRecipe(recipes, ItemPrideColorizer.Type.DEMIBOY, Ingredient.of(Items.RAW_IRON)); + gayRecipe(recipes, ItemPrideColorizer.Type.DEMIGIRL, Ingredient.of(Items.RAW_COPPER)); + gayRecipe(recipes, ItemPrideColorizer.Type.GAY, Ingredient.of(Items.STONE_BRICK_WALL)); + gayRecipe(recipes, ItemPrideColorizer.Type.GENDERFLUID, Ingredient.of(Items.WATER_BUCKET)); + gayRecipe(recipes, ItemPrideColorizer.Type.GENDERQUEER, Ingredient.of(Items.GLASS_BOTTLE)); + gayRecipe(recipes, ItemPrideColorizer.Type.INTERSEX, Ingredient.of(Items.AZALEA)); + gayRecipe(recipes, ItemPrideColorizer.Type.LESBIAN, Ingredient.of(Items.HONEYCOMB)); + gayRecipe(recipes, ItemPrideColorizer.Type.NONBINARY, Ingredient.of(Items.MOSS_BLOCK)); + gayRecipe(recipes, ItemPrideColorizer.Type.PANSEXUAL, ingredients.whenModIngredient( + Ingredient.of(Items.CARROT), + "farmersdelight", + CompatIngredientValue.of("farmersdelight:skillet") + )); + gayRecipe(recipes, ItemPrideColorizer.Type.PLURAL, Ingredient.of(Items.REPEATER)); + gayRecipe(recipes, ItemPrideColorizer.Type.TRANSGENDER, Ingredient.of(Items.EGG)); - ShapedRecipeBuilder.shaped(HexItems.UUID_COLORIZER) - .define('B', Items.BOWL) - .define('D', HexItems.AMETHYST_DUST) - .define('C', Items.AMETHYST_SHARD) - .pattern(" C ") - .pattern(" D ") - .pattern(" B ") - .unlockedBy("has_item", hasItem(HexItems.AMETHYST_DUST)).save(recipes); + ShapedRecipeBuilder.shaped(HexItems.UUID_COLORIZER) + .define('B', Items.BOWL) + .define('D', HexItems.AMETHYST_DUST) + .define('C', Items.AMETHYST_SHARD) + .pattern(" C ") + .pattern(" D ") + .pattern(" B ") + .unlockedBy("has_item", hasItem(HexItems.AMETHYST_DUST)).save(recipes); - ShapedRecipeBuilder.shaped(HexItems.SCROLL_SMOL) - .define('P', Items.PAPER) - .define('A', Items.AMETHYST_SHARD) - .pattern(" A") - .pattern("P ") - .unlockedBy("has_item", hasItem(Items.AMETHYST_SHARD)).save(recipes); + ShapedRecipeBuilder.shaped(HexItems.SCROLL_SMOL) + .define('P', Items.PAPER) + .define('A', Items.AMETHYST_SHARD) + .pattern(" A") + .pattern("P ") + .unlockedBy("has_item", hasItem(Items.AMETHYST_SHARD)).save(recipes); - ShapedRecipeBuilder.shaped(HexItems.SCROLL_MEDIUM) - .define('P', Items.PAPER) - .define('A', Items.AMETHYST_SHARD) - .pattern(" A") - .pattern("PP ") - .pattern("PP ") - .unlockedBy("has_item", hasItem(Items.AMETHYST_SHARD)).save(recipes); + ShapedRecipeBuilder.shaped(HexItems.SCROLL_MEDIUM) + .define('P', Items.PAPER) + .define('A', Items.AMETHYST_SHARD) + .pattern(" A") + .pattern("PP ") + .pattern("PP ") + .unlockedBy("has_item", hasItem(Items.AMETHYST_SHARD)).save(recipes); - ShapedRecipeBuilder.shaped(HexItems.SCROLL_LARGE) - .define('P', Items.PAPER) - .define('A', Items.AMETHYST_SHARD) - .pattern("PPA") - .pattern("PPP") - .pattern("PPP") - .unlockedBy("has_item", hasItem(Items.AMETHYST_SHARD)).save(recipes); + ShapedRecipeBuilder.shaped(HexItems.SCROLL_LARGE) + .define('P', Items.PAPER) + .define('A', Items.AMETHYST_SHARD) + .pattern("PPA") + .pattern("PPP") + .pattern("PPP") + .unlockedBy("has_item", hasItem(Items.AMETHYST_SHARD)).save(recipes); - ShapedRecipeBuilder.shaped(HexItems.SLATE, 6) - .define('S', Items.DEEPSLATE) - .define('A', HexItems.AMETHYST_DUST) - .pattern(" A ") - .pattern("SSS") - .unlockedBy("has_item", hasItem(HexItems.AMETHYST_DUST)).save(recipes); + ShapedRecipeBuilder.shaped(HexItems.SLATE, 6) + .define('S', Items.DEEPSLATE) + .define('A', HexItems.AMETHYST_DUST) + .pattern(" A ") + .pattern("SSS") + .unlockedBy("has_item", hasItem(HexItems.AMETHYST_DUST)).save(recipes); - ShapedRecipeBuilder.shaped(HexItems.JEWELER_HAMMER) - .define('I', ingredients.ironIngot()) - .define('N', ingredients.ironNugget()) - .define('A', Items.AMETHYST_SHARD) - .define('S', ingredients.stick()) - .pattern("IAN") - .pattern(" S ") - .pattern(" S ") - .unlockedBy("has_item", hasItem(Items.AMETHYST_SHARD)).save(recipes); + ShapedRecipeBuilder.shaped(HexItems.JEWELER_HAMMER) + .define('I', ingredients.ironIngot()) + .define('N', ingredients.ironNugget()) + .define('A', Items.AMETHYST_SHARD) + .define('S', ingredients.stick()) + .pattern("IAN") + .pattern(" S ") + .pattern(" S ") + .unlockedBy("has_item", hasItem(Items.AMETHYST_SHARD)).save(recipes); - ShapedRecipeBuilder.shaped(HexBlocks.SLATE_BLOCK) - .define('S', HexItems.SLATE) - .pattern("S") - .pattern("S") - .unlockedBy("has_item", hasItem(HexItems.SLATE)) - .save(recipes, modLoc("slate_block_from_slates")); + ShapedRecipeBuilder.shaped(HexBlocks.SLATE_BLOCK) + .define('S', HexItems.SLATE) + .pattern("S") + .pattern("S") + .unlockedBy("has_item", hasItem(HexItems.SLATE)) + .save(recipes, modLoc("slate_block_from_slates")); - ringAll(HexBlocks.SLATE_BLOCK, 8, Blocks.DEEPSLATE, HexItems.AMETHYST_DUST) - .unlockedBy("has_item", hasItem(HexItems.SLATE)).save(recipes); + ringAll(HexBlocks.SLATE_BLOCK, 8, Blocks.DEEPSLATE, HexItems.AMETHYST_DUST) + .unlockedBy("has_item", hasItem(HexItems.SLATE)).save(recipes); - packing(HexItems.AMETHYST_DUST, HexBlocks.AMETHYST_DUST_BLOCK.asItem(), "amethyst_dust", - false, recipes); + packing(HexItems.AMETHYST_DUST, HexBlocks.AMETHYST_DUST_BLOCK.asItem(), "amethyst_dust", + false, recipes); - ringAll(HexBlocks.AMETHYST_TILES, 8, Blocks.AMETHYST_BLOCK, HexItems.AMETHYST_DUST) - .unlockedBy("has_item", hasItem(HexItems.AMETHYST_DUST)).save(recipes); + ringAll(HexBlocks.AMETHYST_TILES, 8, Blocks.AMETHYST_BLOCK, HexItems.AMETHYST_DUST) + .unlockedBy("has_item", hasItem(HexItems.AMETHYST_DUST)).save(recipes); - SingleItemRecipeBuilder.stonecutting(Ingredient.of(Blocks.AMETHYST_BLOCK), HexBlocks.AMETHYST_TILES) - .unlockedBy("has_item", hasItem(Blocks.AMETHYST_BLOCK)) - .save(recipes, modLoc("stonecutting/amethyst_tiles")); + SingleItemRecipeBuilder.stonecutting(Ingredient.of(Blocks.AMETHYST_BLOCK), HexBlocks.AMETHYST_TILES) + .unlockedBy("has_item", hasItem(Blocks.AMETHYST_BLOCK)) + .save(recipes, modLoc("stonecutting/amethyst_tiles")); - ringAll(HexBlocks.SCROLL_PAPER, 8, Items.PAPER, Items.AMETHYST_SHARD) - .unlockedBy("has_item", hasItem(Items.AMETHYST_SHARD)).save(recipes); + ringAll(HexBlocks.SCROLL_PAPER, 8, Items.PAPER, Items.AMETHYST_SHARD) + .unlockedBy("has_item", hasItem(Items.AMETHYST_SHARD)).save(recipes); - ShapelessRecipeBuilder.shapeless(HexBlocks.ANCIENT_SCROLL_PAPER, 8) - .requires(ingredients.dyes().get(DyeColor.BROWN)) - .requires(HexBlocks.SCROLL_PAPER, 8) - .unlockedBy("has_item", hasItem(HexBlocks.SCROLL_PAPER)).save(recipes); + ShapelessRecipeBuilder.shapeless(HexBlocks.ANCIENT_SCROLL_PAPER, 8) + .requires(ingredients.dyes().get(DyeColor.BROWN)) + .requires(HexBlocks.SCROLL_PAPER, 8) + .unlockedBy("has_item", hasItem(HexBlocks.SCROLL_PAPER)).save(recipes); - stack(HexBlocks.SCROLL_PAPER_LANTERN, 1, HexBlocks.SCROLL_PAPER, Items.TORCH) - .unlockedBy("has_item", hasItem(HexBlocks.SCROLL_PAPER)).save(recipes); + stack(HexBlocks.SCROLL_PAPER_LANTERN, 1, HexBlocks.SCROLL_PAPER, Items.TORCH) + .unlockedBy("has_item", hasItem(HexBlocks.SCROLL_PAPER)).save(recipes); - stack(HexBlocks.ANCIENT_SCROLL_PAPER_LANTERN, 1, HexBlocks.ANCIENT_SCROLL_PAPER, Items.TORCH) - .unlockedBy("has_item", hasItem(HexBlocks.ANCIENT_SCROLL_PAPER)).save(recipes); + stack(HexBlocks.ANCIENT_SCROLL_PAPER_LANTERN, 1, HexBlocks.ANCIENT_SCROLL_PAPER, Items.TORCH) + .unlockedBy("has_item", hasItem(HexBlocks.ANCIENT_SCROLL_PAPER)).save(recipes); - ShapelessRecipeBuilder.shapeless(HexBlocks.ANCIENT_SCROLL_PAPER_LANTERN, 8) - .requires(ingredients.dyes().get(DyeColor.BROWN)) - .requires(HexBlocks.SCROLL_PAPER_LANTERN, 8) - .unlockedBy("has_item", hasItem(HexBlocks.SCROLL_PAPER_LANTERN)) - .save(recipes, modLoc("ageing_scroll_paper_lantern")); + ShapelessRecipeBuilder.shapeless(HexBlocks.ANCIENT_SCROLL_PAPER_LANTERN, 8) + .requires(ingredients.dyes().get(DyeColor.BROWN)) + .requires(HexBlocks.SCROLL_PAPER_LANTERN, 8) + .unlockedBy("has_item", hasItem(HexBlocks.SCROLL_PAPER_LANTERN)) + .save(recipes, modLoc("ageing_scroll_paper_lantern")); - stack(HexBlocks.SCONCE, 4, - Ingredient.of(HexItems.CHARGED_AMETHYST), - ingredients.copperIngot()) - .unlockedBy("has_item", hasItem(HexItems.CHARGED_AMETHYST)).save(recipes); + stack(HexBlocks.SCONCE, 4, + Ingredient.of(HexItems.CHARGED_AMETHYST), + ingredients.copperIngot()) + .unlockedBy("has_item", hasItem(HexItems.CHARGED_AMETHYST)).save(recipes); - ShapelessRecipeBuilder.shapeless(HexBlocks.EDIFIED_PLANKS, 4) - .requires(HexTags.Items.EDIFIED_LOGS) - .unlockedBy("has_item", hasItem(HexTags.Items.EDIFIED_LOGS)).save(recipes); + ShapelessRecipeBuilder.shapeless(HexBlocks.EDIFIED_PLANKS, 4) + .requires(HexTags.Items.EDIFIED_LOGS) + .unlockedBy("has_item", hasItem(HexTags.Items.EDIFIED_LOGS)).save(recipes); - ShapedRecipeBuilder.shaped(HexBlocks.EDIFIED_WOOD, 3) - .define('W', HexBlocks.EDIFIED_LOG) - .pattern("WW") - .pattern("WW") - .unlockedBy("has_item", hasItem(HexBlocks.EDIFIED_LOG)).save(recipes); + ShapedRecipeBuilder.shaped(HexBlocks.EDIFIED_WOOD, 3) + .define('W', HexBlocks.EDIFIED_LOG) + .pattern("WW") + .pattern("WW") + .unlockedBy("has_item", hasItem(HexBlocks.EDIFIED_LOG)).save(recipes); - ShapedRecipeBuilder.shaped(HexBlocks.STRIPPED_EDIFIED_WOOD, 3) - .define('W', HexBlocks.STRIPPED_EDIFIED_LOG) - .pattern("WW") - .pattern("WW") - .unlockedBy("has_item", hasItem(HexBlocks.STRIPPED_EDIFIED_LOG)).save(recipes); + ShapedRecipeBuilder.shaped(HexBlocks.STRIPPED_EDIFIED_WOOD, 3) + .define('W', HexBlocks.STRIPPED_EDIFIED_LOG) + .pattern("WW") + .pattern("WW") + .unlockedBy("has_item", hasItem(HexBlocks.STRIPPED_EDIFIED_LOG)).save(recipes); - ring(HexBlocks.EDIFIED_PANEL, 8, - HexTags.Items.EDIFIED_PLANKS, null) - .unlockedBy("has_item", hasItem(HexTags.Items.EDIFIED_PLANKS)).save(recipes); + ring(HexBlocks.EDIFIED_PANEL, 8, + HexTags.Items.EDIFIED_PLANKS, null) + .unlockedBy("has_item", hasItem(HexTags.Items.EDIFIED_PLANKS)).save(recipes); - ShapedRecipeBuilder.shaped(HexBlocks.EDIFIED_TILE, 6) - .define('W', HexTags.Items.EDIFIED_PLANKS) - .pattern("WW ") - .pattern("W W") - .pattern(" WW") - .unlockedBy("has_item", hasItem(HexTags.Items.EDIFIED_PLANKS)).save(recipes); + ShapedRecipeBuilder.shaped(HexBlocks.EDIFIED_TILE, 6) + .define('W', HexTags.Items.EDIFIED_PLANKS) + .pattern("WW ") + .pattern("W W") + .pattern(" WW") + .unlockedBy("has_item", hasItem(HexTags.Items.EDIFIED_PLANKS)).save(recipes); - ShapedRecipeBuilder.shaped(HexBlocks.EDIFIED_DOOR, 3) - .define('W', HexTags.Items.EDIFIED_PLANKS) - .pattern("WW") - .pattern("WW") - .pattern("WW") - .unlockedBy("has_item", hasItem(HexTags.Items.EDIFIED_PLANKS)).save(recipes); + ShapedRecipeBuilder.shaped(HexBlocks.EDIFIED_DOOR, 3) + .define('W', HexTags.Items.EDIFIED_PLANKS) + .pattern("WW") + .pattern("WW") + .pattern("WW") + .unlockedBy("has_item", hasItem(HexTags.Items.EDIFIED_PLANKS)).save(recipes); - ShapedRecipeBuilder.shaped(HexBlocks.EDIFIED_TRAPDOOR, 2) - .define('W', HexTags.Items.EDIFIED_PLANKS) - .pattern("WWW") - .pattern("WWW") - .unlockedBy("has_item", hasItem(HexTags.Items.EDIFIED_PLANKS)).save(recipes); + ShapedRecipeBuilder.shaped(HexBlocks.EDIFIED_TRAPDOOR, 2) + .define('W', HexTags.Items.EDIFIED_PLANKS) + .pattern("WWW") + .pattern("WWW") + .unlockedBy("has_item", hasItem(HexTags.Items.EDIFIED_PLANKS)).save(recipes); - ShapedRecipeBuilder.shaped(HexBlocks.EDIFIED_STAIRS, 4) - .define('W', HexTags.Items.EDIFIED_PLANKS) - .pattern("W ") - .pattern("WW ") - .pattern("WWW") - .unlockedBy("has_item", hasItem(HexTags.Items.EDIFIED_PLANKS)).save(recipes); + ShapedRecipeBuilder.shaped(HexBlocks.EDIFIED_STAIRS, 4) + .define('W', HexTags.Items.EDIFIED_PLANKS) + .pattern("W ") + .pattern("WW ") + .pattern("WWW") + .unlockedBy("has_item", hasItem(HexTags.Items.EDIFIED_PLANKS)).save(recipes); - ShapedRecipeBuilder.shaped(HexBlocks.EDIFIED_SLAB, 6) - .define('W', HexTags.Items.EDIFIED_PLANKS) - .pattern("WWW") - .unlockedBy("has_item", hasItem(HexTags.Items.EDIFIED_PLANKS)).save(recipes); + ShapedRecipeBuilder.shaped(HexBlocks.EDIFIED_SLAB, 6) + .define('W', HexTags.Items.EDIFIED_PLANKS) + .pattern("WWW") + .unlockedBy("has_item", hasItem(HexTags.Items.EDIFIED_PLANKS)).save(recipes); - ShapedRecipeBuilder.shaped(HexBlocks.EDIFIED_PRESSURE_PLATE, 1) - .define('W', HexTags.Items.EDIFIED_PLANKS) - .pattern("WW") - .unlockedBy("has_item", hasItem(HexTags.Items.EDIFIED_PLANKS)).save(recipes); + ShapedRecipeBuilder.shaped(HexBlocks.EDIFIED_PRESSURE_PLATE, 1) + .define('W', HexTags.Items.EDIFIED_PLANKS) + .pattern("WW") + .unlockedBy("has_item", hasItem(HexTags.Items.EDIFIED_PLANKS)).save(recipes); - ShapelessRecipeBuilder.shapeless(HexBlocks.EDIFIED_BUTTON) - .requires(HexTags.Items.EDIFIED_PLANKS) - .unlockedBy("has_item", hasItem(HexTags.Items.EDIFIED_PLANKS)).save(recipes); + ShapelessRecipeBuilder.shapeless(HexBlocks.EDIFIED_BUTTON) + .requires(HexTags.Items.EDIFIED_PLANKS) + .unlockedBy("has_item", hasItem(HexTags.Items.EDIFIED_PLANKS)).save(recipes); - // TODO: probably should have some constant enlightenment trigger somewhere - var enlightenment = new OvercastTrigger.Instance( - EntityPredicate.Composite.ANY, - MinMaxBounds.Ints.ANY, // add a little bit of slop here - MinMaxBounds.Doubles.atLeast(0.8), - MinMaxBounds.Doubles.between(0.1, 2.05) - ); - ShapedRecipeBuilder.shaped(HexBlocks.EMPTY_IMPETUS) - .define('B', Items.IRON_BARS) - .define('A', HexItems.CHARGED_AMETHYST) - .define('S', HexBlocks.SLATE_BLOCK) - .define('P', Items.PURPUR_BLOCK) - .pattern("PSS") - .pattern("BAB") - .pattern("SSP") - .unlockedBy("enlightenment", enlightenment).save(recipes); + // TODO: probably should have some constant enlightenment trigger somewhere + var enlightenment = new OvercastTrigger.Instance( + EntityPredicate.Composite.ANY, + MinMaxBounds.Ints.ANY, // add a little bit of slop here + MinMaxBounds.Doubles.atLeast(0.8), + MinMaxBounds.Doubles.between(0.1, 2.05) + ); + ShapedRecipeBuilder.shaped(HexBlocks.EMPTY_IMPETUS) + .define('B', Items.IRON_BARS) + .define('A', HexItems.CHARGED_AMETHYST) + .define('S', HexBlocks.SLATE_BLOCK) + .define('P', Items.PURPUR_BLOCK) + .pattern("PSS") + .pattern("BAB") + .pattern("SSP") + .unlockedBy("enlightenment", enlightenment).save(recipes); - ShapedRecipeBuilder.shaped(HexBlocks.EMPTY_DIRECTRIX) - .define('C', Items.COMPARATOR) - .define('O', Items.OBSERVER) - .define('A', HexItems.CHARGED_AMETHYST) - .define('S', HexBlocks.SLATE_BLOCK) - .pattern("CSS") - .pattern("OAO") - .pattern("SSC") - .unlockedBy("enlightenment", enlightenment).save(recipes); + ShapedRecipeBuilder.shaped(HexBlocks.EMPTY_DIRECTRIX) + .define('C', Items.COMPARATOR) + .define('O', Items.OBSERVER) + .define('A', HexItems.CHARGED_AMETHYST) + .define('S', HexBlocks.SLATE_BLOCK) + .pattern("CSS") + .pattern("OAO") + .pattern("SSC") + .unlockedBy("enlightenment", enlightenment).save(recipes); - ShapedRecipeBuilder.shaped(HexBlocks.AKASHIC_BOOKSHELF) - .define('L', HexTags.Items.EDIFIED_LOGS) - .define('P', HexTags.Items.EDIFIED_PLANKS) - .define('C', Items.BOOK) - /*this is the*/.pattern("LPL") // and what i have for you today is - .pattern("CCC") - .pattern("LPL") - .unlockedBy("enlightenment", enlightenment).save(recipes); + ShapedRecipeBuilder.shaped(HexBlocks.AKASHIC_BOOKSHELF) + .define('L', HexTags.Items.EDIFIED_LOGS) + .define('P', HexTags.Items.EDIFIED_PLANKS) + .define('C', Items.BOOK) + /*this is the*/.pattern("LPL") // and what i have for you today is + .pattern("CCC") + .pattern("LPL") + .unlockedBy("enlightenment", enlightenment).save(recipes); - ShapedRecipeBuilder.shaped(HexBlocks.AKASHIC_LIGATURE) - .define('L', HexTags.Items.EDIFIED_LOGS) - .define('P', HexTags.Items.EDIFIED_PLANKS) - .define('C', HexItems.CHARGED_AMETHYST) - .pattern("LPL") - .pattern("CCC") - .pattern("LPL") - .unlockedBy("enlightenment", enlightenment).save(recipes); + ShapedRecipeBuilder.shaped(HexBlocks.AKASHIC_LIGATURE) + .define('L', HexTags.Items.EDIFIED_LOGS) + .define('P', HexTags.Items.EDIFIED_PLANKS) + .define('C', HexItems.CHARGED_AMETHYST) + .pattern("LPL") + .pattern("CCC") + .pattern("LPL") + .unlockedBy("enlightenment", enlightenment).save(recipes); - new BrainsweepRecipeBuilder(StateIngredientHelper.of(Blocks.AMETHYST_BLOCK), - new VillagerIngredient(null, null, 3), - Blocks.BUDDING_AMETHYST.defaultBlockState(), MediaConstants.CRYSTAL_UNIT * 10) - .unlockedBy("enlightenment", enlightenment) - .save(recipes, modLoc("brainsweep/budding_amethyst")); + new BrainsweepRecipeBuilder(StateIngredientHelper.of(Blocks.AMETHYST_BLOCK), + new VillagerIngredient(null, null, 3), + Blocks.BUDDING_AMETHYST.defaultBlockState(), MediaConstants.CRYSTAL_UNIT * 10) + .unlockedBy("enlightenment", enlightenment) + .save(recipes, modLoc("brainsweep/budding_amethyst")); - new BrainsweepRecipeBuilder(StateIngredientHelper.of(HexBlocks.EMPTY_IMPETUS), - new VillagerIngredient(VillagerProfession.TOOLSMITH, null, 2), - HexBlocks.IMPETUS_RIGHTCLICK.defaultBlockState(), MediaConstants.CRYSTAL_UNIT * 10) - .unlockedBy("enlightenment", enlightenment) - .save(recipes, modLoc("brainsweep/impetus_rightclick")); + new BrainsweepRecipeBuilder(StateIngredientHelper.of(HexBlocks.EMPTY_IMPETUS), + new VillagerIngredient(VillagerProfession.TOOLSMITH, null, 2), + HexBlocks.IMPETUS_RIGHTCLICK.defaultBlockState(), MediaConstants.CRYSTAL_UNIT * 10) + .unlockedBy("enlightenment", enlightenment) + .save(recipes, modLoc("brainsweep/impetus_rightclick")); - new BrainsweepRecipeBuilder(StateIngredientHelper.of(HexBlocks.EMPTY_IMPETUS), - new VillagerIngredient(VillagerProfession.TOOLSMITH, null, 2), - HexBlocks.IMPETUS_LOOK.defaultBlockState(), MediaConstants.CRYSTAL_UNIT * 10) - .unlockedBy("enlightenment", enlightenment) - .save(recipes, modLoc("brainsweep/impetus_look")); + new BrainsweepRecipeBuilder(StateIngredientHelper.of(HexBlocks.EMPTY_IMPETUS), + new VillagerIngredient(VillagerProfession.TOOLSMITH, null, 2), + HexBlocks.IMPETUS_LOOK.defaultBlockState(), MediaConstants.CRYSTAL_UNIT * 10) + .unlockedBy("enlightenment", enlightenment) + .save(recipes, modLoc("brainsweep/impetus_look")); - new BrainsweepRecipeBuilder(StateIngredientHelper.of(HexBlocks.EMPTY_IMPETUS), - new VillagerIngredient(VillagerProfession.CLERIC, null, 2), - HexBlocks.IMPETUS_STOREDPLAYER.defaultBlockState(), MediaConstants.CRYSTAL_UNIT * 10) - .unlockedBy("enlightenment", enlightenment) - .save(recipes, modLoc("brainsweep/impetus_storedplayer")); + new BrainsweepRecipeBuilder(StateIngredientHelper.of(HexBlocks.EMPTY_IMPETUS), + new VillagerIngredient(VillagerProfession.CLERIC, null, 2), + HexBlocks.IMPETUS_STOREDPLAYER.defaultBlockState(), MediaConstants.CRYSTAL_UNIT * 10) + .unlockedBy("enlightenment", enlightenment) + .save(recipes, modLoc("brainsweep/impetus_storedplayer")); - new BrainsweepRecipeBuilder(StateIngredientHelper.of(HexBlocks.EMPTY_DIRECTRIX), - new VillagerIngredient(VillagerProfession.MASON, null, 1), - HexBlocks.DIRECTRIX_REDSTONE.defaultBlockState(), MediaConstants.CRYSTAL_UNIT * 10) - .unlockedBy("enlightenment", enlightenment) - .save(recipes, modLoc("brainsweep/directrix_redstone")); + new BrainsweepRecipeBuilder(StateIngredientHelper.of(HexBlocks.EMPTY_DIRECTRIX), + new VillagerIngredient(VillagerProfession.MASON, null, 1), + HexBlocks.DIRECTRIX_REDSTONE.defaultBlockState(), MediaConstants.CRYSTAL_UNIT * 10) + .unlockedBy("enlightenment", enlightenment) + .save(recipes, modLoc("brainsweep/directrix_redstone")); - new BrainsweepRecipeBuilder(StateIngredientHelper.of(HexBlocks.AKASHIC_LIGATURE), - new VillagerIngredient(VillagerProfession.LIBRARIAN, null, 5), - HexBlocks.AKASHIC_RECORD.defaultBlockState(), MediaConstants.CRYSTAL_UNIT * 10) - .unlockedBy("enlightenment", enlightenment) - .save(recipes, modLoc("brainsweep/akashic_record")); + new BrainsweepRecipeBuilder(StateIngredientHelper.of(HexBlocks.AKASHIC_LIGATURE), + new VillagerIngredient(VillagerProfession.LIBRARIAN, null, 5), + HexBlocks.AKASHIC_RECORD.defaultBlockState(), MediaConstants.CRYSTAL_UNIT * 10) + .unlockedBy("enlightenment", enlightenment) + .save(recipes, modLoc("brainsweep/akashic_record")); - // Temporary tests - new BrainsweepRecipeBuilder(StateIngredientHelper.of(BlockTags.SMALL_FLOWERS), - new EntityTypeIngredient(EntityType.ALLAY), - Blocks.AMETHYST_CLUSTER.defaultBlockState(), MediaConstants.SHARD_UNIT) - .unlockedBy("enlightenment", enlightenment) - .save(recipes, modLoc("brainsweep/testing/flowey_the_flower")); - new BrainsweepRecipeBuilder(StateIngredientHelper.of(Blocks.SCAFFOLDING), - new EntityTagIngredient(EntityTypeTags.SKELETONS), - Blocks.BONE_BLOCK.defaultBlockState(), MediaConstants.SHARD_UNIT) - .unlockedBy("enlightenment", enlightenment) - .save(recipes, modLoc("brainsweep/testing/bad_to_the_bone")); + // Temporary tests + new BrainsweepRecipeBuilder(StateIngredientHelper.of(BlockTags.SMALL_FLOWERS), + new EntityTypeIngredient(EntityType.ALLAY), + Blocks.AMETHYST_CLUSTER.defaultBlockState(), MediaConstants.SHARD_UNIT) + .unlockedBy("enlightenment", enlightenment) + .save(recipes, modLoc("brainsweep/testing/flowey_the_flower")); + new BrainsweepRecipeBuilder(StateIngredientHelper.of(Blocks.SCAFFOLDING), + new EntityTagIngredient(EntityTypeTags.SKELETONS), + Blocks.BONE_BLOCK.defaultBlockState(), MediaConstants.SHARD_UNIT) + .unlockedBy("enlightenment", enlightenment) + .save(recipes, modLoc("brainsweep/testing/bad_to_the_bone")); - // Create compat - this.conditions.apply(new CreateCrushingRecipeBuilder() - .withInput(Blocks.AMETHYST_CLUSTER) - .duration(150) - .withOutput(Items.AMETHYST_SHARD, 7) - .withOutput(HexItems.AMETHYST_DUST, 5) - .withOutput(0.25f, HexItems.CHARGED_AMETHYST)) - .whenModLoaded("create") - .save(recipes, new ResourceLocation("create", "crushing/amethyst_cluster")); + // Create compat + this.conditions.apply(new CreateCrushingRecipeBuilder() + .withInput(Blocks.AMETHYST_CLUSTER) + .duration(150) + .withOutput(Items.AMETHYST_SHARD, 7) + .withOutput(HexItems.AMETHYST_DUST, 5) + .withOutput(0.25f, HexItems.CHARGED_AMETHYST)) + .whenModLoaded("create") + .save(recipes, new ResourceLocation("create", "crushing/amethyst_cluster")); - this.conditions.apply(new CreateCrushingRecipeBuilder() - .withInput(Blocks.AMETHYST_BLOCK) - .duration(150) - .withOutput(Items.AMETHYST_SHARD, 3) - .withOutput(0.5f, HexItems.AMETHYST_DUST, 4)) - .whenModLoaded("create") - .save(recipes, new ResourceLocation("create", "crushing/amethyst_block")); + this.conditions.apply(new CreateCrushingRecipeBuilder() + .withInput(Blocks.AMETHYST_BLOCK) + .duration(150) + .withOutput(Items.AMETHYST_SHARD, 3) + .withOutput(0.5f, HexItems.AMETHYST_DUST, 4)) + .whenModLoaded("create") + .save(recipes, new ResourceLocation("create", "crushing/amethyst_block")); - this.conditions.apply(new CreateCrushingRecipeBuilder() - .withInput(Items.AMETHYST_SHARD) - .duration(150) - .withOutput(HexItems.AMETHYST_DUST, 4) - .withOutput(0.5f, HexItems.AMETHYST_DUST)) - .whenModLoaded("create") - .save(recipes, modLoc("compat/create/crushing/amethyst_shard")); + this.conditions.apply(new CreateCrushingRecipeBuilder() + .withInput(Items.AMETHYST_SHARD) + .duration(150) + .withOutput(HexItems.AMETHYST_DUST, 4) + .withOutput(0.5f, HexItems.AMETHYST_DUST)) + .whenModLoaded("create") + .save(recipes, modLoc("compat/create/crushing/amethyst_shard")); - // FD compat - this.conditions.apply(new FarmersDelightCuttingRecipeBuilder() - .withInput(HexBlocks.EDIFIED_LOG) - .withTool(ingredients.axeStrip()) - .withOutput(HexBlocks.STRIPPED_EDIFIED_LOG) - .withOutput("farmersdelight:tree_bark") - .withSound(SoundEvents.AXE_STRIP)) - .whenModLoaded("farmersdelight") - .save(recipes, modLoc("compat/farmersdelight/cutting/akashic_log")); + // FD compat + this.conditions.apply(new FarmersDelightCuttingRecipeBuilder() + .withInput(HexBlocks.EDIFIED_LOG) + .withTool(ingredients.axeStrip()) + .withOutput(HexBlocks.STRIPPED_EDIFIED_LOG) + .withOutput("farmersdelight:tree_bark") + .withSound(SoundEvents.AXE_STRIP)) + .whenModLoaded("farmersdelight") + .save(recipes, modLoc("compat/farmersdelight/cutting/akashic_log")); - this.conditions.apply(new FarmersDelightCuttingRecipeBuilder() - .withInput(HexBlocks.EDIFIED_WOOD) - .withTool(ingredients.axeStrip()) - .withOutput(HexBlocks.STRIPPED_EDIFIED_WOOD) - .withOutput("farmersdelight:tree_bark") - .withSound(SoundEvents.AXE_STRIP)) - .whenModLoaded("farmersdelight") - .save(recipes, modLoc("compat/farmersdelight/cutting/akashic_wood")); + this.conditions.apply(new FarmersDelightCuttingRecipeBuilder() + .withInput(HexBlocks.EDIFIED_WOOD) + .withTool(ingredients.axeStrip()) + .withOutput(HexBlocks.STRIPPED_EDIFIED_WOOD) + .withOutput("farmersdelight:tree_bark") + .withSound(SoundEvents.AXE_STRIP)) + .whenModLoaded("farmersdelight") + .save(recipes, modLoc("compat/farmersdelight/cutting/akashic_wood")); - this.conditions.apply(new FarmersDelightCuttingRecipeBuilder() - .withInput(HexBlocks.EDIFIED_TRAPDOOR) - .withTool(ingredients.axeDig()) - .withOutput(HexBlocks.EDIFIED_PLANKS)) - .whenModLoaded("farmersdelight") - .save(recipes, modLoc("compat/farmersdelight/cutting/akashic_trapdoor")); + this.conditions.apply(new FarmersDelightCuttingRecipeBuilder() + .withInput(HexBlocks.EDIFIED_TRAPDOOR) + .withTool(ingredients.axeDig()) + .withOutput(HexBlocks.EDIFIED_PLANKS)) + .whenModLoaded("farmersdelight") + .save(recipes, modLoc("compat/farmersdelight/cutting/akashic_trapdoor")); - this.conditions.apply(new FarmersDelightCuttingRecipeBuilder() - .withInput(HexBlocks.EDIFIED_DOOR) - .withTool(ingredients.axeDig()) - .withOutput(HexBlocks.EDIFIED_PLANKS)) - .whenModLoaded("farmersdelight") - .save(recipes, modLoc("compat/farmersdelight/cutting/akashic_door")); - } + this.conditions.apply(new FarmersDelightCuttingRecipeBuilder() + .withInput(HexBlocks.EDIFIED_DOOR) + .withTool(ingredients.axeDig()) + .withOutput(HexBlocks.EDIFIED_PLANKS)) + .whenModLoaded("farmersdelight") + .save(recipes, modLoc("compat/farmersdelight/cutting/akashic_door")); + } - private void staffRecipe(Consumer recipes, ItemStaff staff, Item plank) { - ShapedRecipeBuilder.shaped(staff) - .define('W', plank) - .define('S', Items.STICK) - .define('A', HexItems.CHARGED_AMETHYST) - .pattern(" SA") - .pattern(" WS") - .pattern("S ") - .unlockedBy("has_item", hasItem(HexItems.CHARGED_AMETHYST)) - .save(recipes); - } + private void staffRecipe(Consumer recipes, ItemStaff staff, Item plank) { + ShapedRecipeBuilder.shaped(staff) + .define('W', plank) + .define('S', Items.STICK) + .define('A', HexItems.CHARGED_AMETHYST) + .pattern(" SA") + .pattern(" WS") + .pattern("S ") + .unlockedBy("has_item", hasItem(HexItems.CHARGED_AMETHYST)) + .save(recipes); + } - private void gayRecipe(Consumer recipes, ItemPrideColorizer.Type type, Ingredient material) { - var colorizer = HexItems.PRIDE_COLORIZERS.get(type); - ShapedRecipeBuilder.shaped(colorizer) - .define('D', HexItems.AMETHYST_DUST) - .define('C', material) - .pattern(" D ") - .pattern("DCD") - .pattern(" D ") - .unlockedBy("has_item", hasItem(HexItems.AMETHYST_DUST)) - .save(recipes); - } + private void gayRecipe(Consumer recipes, ItemPrideColorizer.Type type, Ingredient material) { + var colorizer = HexItems.PRIDE_COLORIZERS.get(type); + ShapedRecipeBuilder.shaped(colorizer) + .define('D', HexItems.AMETHYST_DUST) + .define('C', material) + .pattern(" D ") + .pattern("DCD") + .pattern(" D ") + .unlockedBy("has_item", hasItem(HexItems.AMETHYST_DUST)) + .save(recipes); + } - private void specialRecipe(Consumer consumer, SimpleRecipeSerializer serializer) { - var name = Registry.RECIPE_SERIALIZER.getKey(serializer); - SpecialRecipeBuilder.special(serializer).save(consumer, HexAPI.MOD_ID + ":dynamic" + name.getPath()); - } + private void specialRecipe(Consumer consumer, SimpleRecipeSerializer serializer) { + var name = Registry.RECIPE_SERIALIZER.getKey(serializer); + SpecialRecipeBuilder.special(serializer).save(consumer, HexAPI.MOD_ID + ":dynamic" + name.getPath()); + } } diff --git a/Common/src/main/java/at/petrak/hexcasting/datagen/tag/HexItemTagProvider.java b/Common/src/main/java/at/petrak/hexcasting/datagen/tag/HexItemTagProvider.java index 2ea0f8e6..43ca91de 100644 --- a/Common/src/main/java/at/petrak/hexcasting/datagen/tag/HexItemTagProvider.java +++ b/Common/src/main/java/at/petrak/hexcasting/datagen/tag/HexItemTagProvider.java @@ -27,7 +27,7 @@ public class HexItemTagProvider extends PaucalItemTagProvider { tag(HexTags.Items.STAVES).add(HexItems.STAFF_EDIFIED, HexItems.STAFF_OAK, HexItems.STAFF_SPRUCE, HexItems.STAFF_BIRCH, HexItems.STAFF_JUNGLE, HexItems.STAFF_ACACIA, HexItems.STAFF_DARK_OAK, - HexItems.STAFF_CRIMSON, HexItems.STAFF_WARPED); + HexItems.STAFF_CRIMSON, HexItems.STAFF_WARPED, HexItems.STAFF_MANGROVE); tag(HexTags.Items.PHIAL_BASE).add(Items.GLASS_BOTTLE); tag(HexTags.Items.GRANTS_ROOT_ADVANCEMENT).add(HexItems.AMETHYST_DUST, Items.AMETHYST_SHARD, diff --git a/Common/src/main/resources/assets/hexcasting/lang/en_us.json b/Common/src/main/resources/assets/hexcasting/lang/en_us.json index 8f1f061f..4b3c1661 100644 --- a/Common/src/main/resources/assets/hexcasting/lang/en_us.json +++ b/Common/src/main/resources/assets/hexcasting/lang/en_us.json @@ -8,6 +8,7 @@ "item.hexcasting.dark_oak_staff": "Dark Oak Staff", "item.hexcasting.crimson_staff": "Crimson Staff", "item.hexcasting.warped_staff": "Warped Staff", + "item.hexcasting.mangrove_staff": "Mangrove Staff", "item.hexcasting.edified_staff": "Edified Staff", "item.hexcasting.focus": "Focus", "item.hexcasting.focus.sealed": "Sealed Focus", diff --git a/Common/src/main/resources/assets/hexcasting/textures/item/staves/bosnia.png b/Common/src/main/resources/assets/hexcasting/textures/item/staves/mangrove.png similarity index 100% rename from Common/src/main/resources/assets/hexcasting/textures/item/staves/bosnia.png rename to Common/src/main/resources/assets/hexcasting/textures/item/staves/mangrove.png diff --git a/Common/src/main/resources/data/hexcasting/patchouli_books/thehexbook/en_us/entries/items/staff.json b/Common/src/main/resources/data/hexcasting/patchouli_books/thehexbook/en_us/entries/items/staff.json index 550741eb..1657e696 100644 --- a/Common/src/main/resources/data/hexcasting/patchouli_books/thehexbook/en_us/entries/items/staff.json +++ b/Common/src/main/resources/data/hexcasting/patchouli_books/thehexbook/en_us/entries/items/staff.json @@ -23,6 +23,7 @@ "hexcasting:dark_oak_staff", "hexcasting:crimson_staff", "hexcasting:warped_staff", + "hexcasting:mangrove_staff", "hexcasting:edified_staff" ] } diff --git a/Fabric/src/generated/resources/.cache/03e4de26f1265135874f8cdcaebc09d9c08eb42b b/Fabric/src/generated/resources/.cache/03e4de26f1265135874f8cdcaebc09d9c08eb42b index 141c0654..fb837374 100644 --- a/Fabric/src/generated/resources/.cache/03e4de26f1265135874f8cdcaebc09d9c08eb42b +++ b/Fabric/src/generated/resources/.cache/03e4de26f1265135874f8cdcaebc09d9c08eb42b @@ -1,4 +1,4 @@ -// 1.19.2 2023-01-21T15:43:08.87507582 Tags for minecraft:item +// 1.19.2 2023-01-22T12:42:43.342254542 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 @@ -6,7 +6,7 @@ e5df19a1dc6eadf14cd9b0f0fe45a74330b745e9 data/hexcasting/tags/items/edified_plan fdb48f194d7937ab6b423fa4b90a4d438bf6dd90 data/minecraft/tags/items/doors.json 37cff4ce449b8069b59b2327d78e073fc026d348 data/minecraft/tags/items/wooden_pressure_plates.json 38d781b60c5c37dc025d4c7e9ec5aa680f2a5835 data/c/tags/items/gems.json -72ae9c5305aa948e78f95069eb34ecd532915fbf data/hexcasting/tags/items/staves.json +40ad4686dcbbfce1191edd8ce4d839651b48ba8c data/hexcasting/tags/items/staves.json 684c3206f38cc9cc494d5875c5e56aad004486af data/minecraft/tags/items/logs_that_burn.json 20183cd61968ff6548df2dde1100b6378d68d64b data/minecraft/tags/items/wooden_buttons.json 24145229528668829a1bcecf18a6377ebd07ccf8 data/hexcasting/tags/items/grants_root_advancement.json diff --git a/Fabric/src/generated/resources/.cache/67cce32b1c3cbbcb1f646605f4914e3f196986c2 b/Fabric/src/generated/resources/.cache/67cce32b1c3cbbcb1f646605f4914e3f196986c2 index bb8ba8b2..479335ce 100644 --- a/Fabric/src/generated/resources/.cache/67cce32b1c3cbbcb1f646605f4914e3f196986c2 +++ b/Fabric/src/generated/resources/.cache/67cce32b1c3cbbcb1f646605f4914e3f196986c2 @@ -1,4 +1,4 @@ -// 1.19.2 2023-01-21T15:43:08.837666395 LootTables +// 1.19.2 2023-01-22T12:42:43.346904818 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 a228aeb4..0a28641c 100644 --- a/Fabric/src/generated/resources/.cache/75bcd4dba6ca7d365462b0ec45e291d1056349c4 +++ b/Fabric/src/generated/resources/.cache/75bcd4dba6ca7d365462b0ec45e291d1056349c4 @@ -1,4 +1,4 @@ -// 1.19.2 2023-01-21T15:43:08.873838666 Tags for minecraft:block +// 1.19.2 2023-01-22T12:42:43.346084202 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 a3f20e0e..991ab707 100644 --- a/Fabric/src/generated/resources/.cache/844611d4af49e23072b8a888c8e73c6c5d8c0768 +++ b/Fabric/src/generated/resources/.cache/844611d4af49e23072b8a888c8e73c6c5d8c0768 @@ -1,4 +1,4 @@ -// 1.19.2 2023-01-21T15:43:08.846211098 Tags for hexcasting:action +// 1.19.2 2023-01-22T12:42:43.353710487 Tags for hexcasting:action e5afc567ea17f035e4eb1d1d48825100b7f6ad68 data/hexcasting/tags/action/per_world_pattern.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 32b686cd..7f023349 100644 --- a/Fabric/src/generated/resources/.cache/9fb1092f32d4fcbf9e061ffd718d4ec689c6c95e +++ b/Fabric/src/generated/resources/.cache/9fb1092f32d4fcbf9e061ffd718d4ec689c6c95e @@ -1,4 +1,4 @@ -// 1.19.2 2023-01-21T15:43:08.846955947 Recipes +// 1.19.2 2023-01-22T12:42:43.349741357 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 @@ -92,6 +92,7 @@ b62b3b67e6a105e1eb47d04c2ededd8d408df7b7 data/hexcasting/advancements/recipes/he b494dc17959c76857f25368eb845e58e4f8bca92 data/hexcasting/recipes/compat/farmersdelight/cutting/akashic_door.json 36c97b8de7a0b67256e8966eca289a865cb85df5 data/hexcasting/advancements/recipes/hexcasting.creative_tab/pride_colorizer_bisexual.json 4bff4a59e32c6d1d99bc3a8abd16cd88c51a8e73 data/hexcasting/recipes/dye_colorizer_orange.json +cba5ffa7cd89116aba040956f4a85073cedd39cf data/hexcasting/recipes/mangrove_staff.json 1f04d75a1c713d3c5ac44e62889ce834f12d6234 data/hexcasting/recipes/jeweler_hammer.json 0de6f2437a3c33a92de2f3e6b7ac6102996c8779 data/hexcasting/advancements/recipes/brainsweep/brainsweep/testing/bad_to_the_bone.json 8a9e7aa8d07556649768729348dff5305b84e1b9 data/hexcasting/recipes/edified_door.json @@ -119,6 +120,7 @@ ba08fd11d19f54c504ceed6f162a5d814e03d1e8 data/hexcasting/recipes/brainsweep/test ab26481b45a7f463e2225b9a04d24a1b4d84daef data/hexcasting/recipes/abacus.json fccc3e05b011e1fd1a41a0bfca11876d0fb16df2 data/hexcasting/advancements/recipes/hexcasting.creative_tab/scroll_small.json 38e7b64a4a15f1ce496f8c156d7262426f98fbcc data/hexcasting/recipes/acacia_staff.json +6a9a89cfa34732437996431a9c885332cf714449 data/hexcasting/advancements/recipes/hexcasting.creative_tab/mangrove_staff.json 7c7888ba95d1e2e8620a916df546a2b06b592d37 data/hexcasting/recipes/edified_planks.json 0d08dab8c9700c7b5b32ad35e7b665a2e3c2cdc7 data/hexcasting/advancements/recipes/hexcasting.creative_tab/artifact.json 0859373b9e60e80f3c8b0962a3bc94903af43d36 data/hexcasting/recipes/stripped_edified_wood.json diff --git a/Fabric/src/generated/resources/data/hexcasting/advancements/recipes/hexcasting.creative_tab/mangrove_staff.json b/Fabric/src/generated/resources/data/hexcasting/advancements/recipes/hexcasting.creative_tab/mangrove_staff.json new file mode 100644 index 00000000..44132129 --- /dev/null +++ b/Fabric/src/generated/resources/data/hexcasting/advancements/recipes/hexcasting.creative_tab/mangrove_staff.json @@ -0,0 +1,34 @@ +{ + "parent": "minecraft:recipes/root", + "criteria": { + "has_item": { + "conditions": { + "items": [ + { + "items": [ + "hexcasting:charged_amethyst" + ] + } + ] + }, + "trigger": "minecraft:inventory_changed" + }, + "has_the_recipe": { + "conditions": { + "recipe": "hexcasting:mangrove_staff" + }, + "trigger": "minecraft:recipe_unlocked" + } + }, + "requirements": [ + [ + "has_item", + "has_the_recipe" + ] + ], + "rewards": { + "recipes": [ + "hexcasting:mangrove_staff" + ] + } +} \ No newline at end of file diff --git a/Fabric/src/generated/resources/data/hexcasting/recipes/mangrove_staff.json b/Fabric/src/generated/resources/data/hexcasting/recipes/mangrove_staff.json new file mode 100644 index 00000000..38467cb1 --- /dev/null +++ b/Fabric/src/generated/resources/data/hexcasting/recipes/mangrove_staff.json @@ -0,0 +1,22 @@ +{ + "type": "minecraft:crafting_shaped", + "key": { + "A": { + "item": "hexcasting:charged_amethyst" + }, + "S": { + "item": "minecraft:stick" + }, + "W": { + "item": "minecraft:mangrove_planks" + } + }, + "pattern": [ + " SA", + " WS", + "S " + ], + "result": { + "item": "hexcasting:mangrove_staff" + } +} \ No newline at end of file diff --git a/Fabric/src/generated/resources/data/hexcasting/tags/items/staves.json b/Fabric/src/generated/resources/data/hexcasting/tags/items/staves.json index 0f4c7e2b..3a1cf7b1 100644 --- a/Fabric/src/generated/resources/data/hexcasting/tags/items/staves.json +++ b/Fabric/src/generated/resources/data/hexcasting/tags/items/staves.json @@ -9,6 +9,7 @@ "hexcasting:acacia_staff", "hexcasting:dark_oak_staff", "hexcasting:crimson_staff", - "hexcasting:warped_staff" + "hexcasting:warped_staff", + "hexcasting:mangrove_staff" ] } \ No newline at end of file diff --git a/Forge/src/generated/resources/.cache/03e4de26f1265135874f8cdcaebc09d9c08eb42b b/Forge/src/generated/resources/.cache/03e4de26f1265135874f8cdcaebc09d9c08eb42b index 48532985..6809751e 100644 --- a/Forge/src/generated/resources/.cache/03e4de26f1265135874f8cdcaebc09d9c08eb42b +++ b/Forge/src/generated/resources/.cache/03e4de26f1265135874f8cdcaebc09d9c08eb42b @@ -1,11 +1,11 @@ -// 1.19.2 2022-11-09T19:46:44.024478 Tags for minecraft:item +// 1.19.2 2023-01-22T12:41:48.309723436 Tags for minecraft:item 2f5c5bd21580004c998765215166adaa72e0d96b data/forge/tags/items/dusts/amethyst.json 873bab891e0827973ebfe9fedd352c95778d7fbe data/forge/tags/items/gems.json 42c76a43081acfb0194e2cee6de18104fb0ba5ad data/hexcasting/tags/items/edified_logs.json 86828f8056bfdfdd2aff10d7a9dbc6c269c25b8a data/hexcasting/tags/items/edified_planks.json 03bd3a58ae7367d6a21eb3acbbd70fe65a41b8f6 data/hexcasting/tags/items/grants_root_advancement.json 7f7d5f6cc9b5cfb39d240fc901c4ae2d2037ec14 data/hexcasting/tags/items/phial_base.json -fd0b813b22847aa5dbe2730d633a342c4978e2b1 data/hexcasting/tags/items/staves.json +29bbe0aca81c2498b790dbf8e0fd837a07ed9090 data/hexcasting/tags/items/staves.json 841dfbe4970e9167b205e5aa2b0f0936c6b9af60 data/minecraft/tags/items/buttons.json cba96d2ff28087e7fd9807e5e80104f3befc2512 data/minecraft/tags/items/doors.json 6312e44ef31d2401dddbd46c4d3eda03da6e2db3 data/minecraft/tags/items/leaves.json diff --git a/Forge/src/generated/resources/.cache/9fb1092f32d4fcbf9e061ffd718d4ec689c6c95e b/Forge/src/generated/resources/.cache/9fb1092f32d4fcbf9e061ffd718d4ec689c6c95e index 8ce849b4..4e4b63b3 100644 --- a/Forge/src/generated/resources/.cache/9fb1092f32d4fcbf9e061ffd718d4ec689c6c95e +++ b/Forge/src/generated/resources/.cache/9fb1092f32d4fcbf9e061ffd718d4ec689c6c95e @@ -1,4 +1,4 @@ -// 1.19.2 2022-12-29T13:32:49.589849082 Recipes +// 1.19.2 2023-01-22T12:41:48.311183435 Recipes 29056d8bbc023668564ee81f4eb8b2a11411cf4a data/create/recipes/crushing/amethyst_block.json 5bb0b70967a422bfd88c01fa1af64e9b98781fd1 data/create/recipes/crushing/amethyst_cluster.json 8d6f58c45be52e22559fdbc2806ee48ab40d133c data/hexcasting/advancements/recipes/brainsweep/brainsweep/akashic_record.json @@ -58,6 +58,7 @@ dfc171097bdd8a8f280e6787ea999286deda643e data/hexcasting/advancements/recipes/he 48b6d3429e3536a85f3a0e9585a7d252ae0d57a3 data/hexcasting/advancements/recipes/hexcasting/jeweler_hammer.json 182c2b5dd406c80ed957e1b43d554cce1b212d28 data/hexcasting/advancements/recipes/hexcasting/jungle_staff.json 8715e71c2fb59ee458ce217040c9a8dd0db04789 data/hexcasting/advancements/recipes/hexcasting/lens.json +6a9a89cfa34732437996431a9c885332cf714449 data/hexcasting/advancements/recipes/hexcasting/mangrove_staff.json a58f37bc66e65c1ac00ba7dbc4d9a7b902f42aad data/hexcasting/advancements/recipes/hexcasting/oak_staff.json f9e4d9171ffc6a125d9899f1867398acf8037b27 data/hexcasting/advancements/recipes/hexcasting/pride_colorizer_agender.json b7d75dcd88e5091ff44eec236531a56e82c7bd91 data/hexcasting/advancements/recipes/hexcasting/pride_colorizer_aroace.json @@ -155,6 +156,7 @@ c7d28ccf9df6fc46aa142c2e7b176cc0cb5ea62b data/hexcasting/recipes/empty_impetus.j f124395483d1ae0e10b7db2b1828f1a4e269a88c data/hexcasting/recipes/jeweler_hammer.json a776209b64fea520f6a2fff9f1623e7086939dd9 data/hexcasting/recipes/jungle_staff.json 3662834d6e0bac03aba28f0f9d9f07f511492118 data/hexcasting/recipes/lens.json +cba5ffa7cd89116aba040956f4a85073cedd39cf data/hexcasting/recipes/mangrove_staff.json 735a7d770f23a02dc4ae93644e7f4c44a32e313a data/hexcasting/recipes/oak_staff.json ce0cd4d73792c30dcec2eea306bff44b28cb237f data/hexcasting/recipes/pride_colorizer_agender.json 17aa26ce6bc9941d1477dee99e514fd66be7f664 data/hexcasting/recipes/pride_colorizer_aroace.json diff --git a/Forge/src/generated/resources/data/hexcasting/advancements/recipes/hexcasting/mangrove_staff.json b/Forge/src/generated/resources/data/hexcasting/advancements/recipes/hexcasting/mangrove_staff.json new file mode 100644 index 00000000..44132129 --- /dev/null +++ b/Forge/src/generated/resources/data/hexcasting/advancements/recipes/hexcasting/mangrove_staff.json @@ -0,0 +1,34 @@ +{ + "parent": "minecraft:recipes/root", + "criteria": { + "has_item": { + "conditions": { + "items": [ + { + "items": [ + "hexcasting:charged_amethyst" + ] + } + ] + }, + "trigger": "minecraft:inventory_changed" + }, + "has_the_recipe": { + "conditions": { + "recipe": "hexcasting:mangrove_staff" + }, + "trigger": "minecraft:recipe_unlocked" + } + }, + "requirements": [ + [ + "has_item", + "has_the_recipe" + ] + ], + "rewards": { + "recipes": [ + "hexcasting:mangrove_staff" + ] + } +} \ No newline at end of file diff --git a/Forge/src/generated/resources/data/hexcasting/recipes/mangrove_staff.json b/Forge/src/generated/resources/data/hexcasting/recipes/mangrove_staff.json new file mode 100644 index 00000000..38467cb1 --- /dev/null +++ b/Forge/src/generated/resources/data/hexcasting/recipes/mangrove_staff.json @@ -0,0 +1,22 @@ +{ + "type": "minecraft:crafting_shaped", + "key": { + "A": { + "item": "hexcasting:charged_amethyst" + }, + "S": { + "item": "minecraft:stick" + }, + "W": { + "item": "minecraft:mangrove_planks" + } + }, + "pattern": [ + " SA", + " WS", + "S " + ], + "result": { + "item": "hexcasting:mangrove_staff" + } +} \ No newline at end of file diff --git a/Forge/src/generated/resources/data/hexcasting/tags/items/staves.json b/Forge/src/generated/resources/data/hexcasting/tags/items/staves.json index 5697145a..1e10db6c 100644 --- a/Forge/src/generated/resources/data/hexcasting/tags/items/staves.json +++ b/Forge/src/generated/resources/data/hexcasting/tags/items/staves.json @@ -8,6 +8,7 @@ "hexcasting:acacia_staff", "hexcasting:dark_oak_staff", "hexcasting:crimson_staff", - "hexcasting:warped_staff" + "hexcasting:warped_staff", + "hexcasting:mangrove_staff" ] } \ No newline at end of file diff --git a/Forge/src/main/java/at/petrak/hexcasting/forge/datagen/xplat/HexItemModels.java b/Forge/src/main/java/at/petrak/hexcasting/forge/datagen/xplat/HexItemModels.java index 3721c797..a4dd87da 100644 --- a/Forge/src/main/java/at/petrak/hexcasting/forge/datagen/xplat/HexItemModels.java +++ b/Forge/src/main/java/at/petrak/hexcasting/forge/datagen/xplat/HexItemModels.java @@ -74,8 +74,6 @@ public class HexItemModels extends PaucalItemModelProvider { singleTexture("old_staff", new ResourceLocation("item/handheld_rod"), "layer0", modLoc("item/staves/old")); - singleTexture("bosnia_staff", new ResourceLocation("item/handheld_rod"), - "layer0", modLoc("item/staves/bosnia")); buildStaff(HexItems.STAFF_OAK, "oak"); buildStaff(HexItems.STAFF_BIRCH, "birch"); @@ -85,6 +83,7 @@ public class HexItemModels extends PaucalItemModelProvider { buildStaff(HexItems.STAFF_ACACIA, "acacia"); buildStaff(HexItems.STAFF_CRIMSON, "crimson"); buildStaff(HexItems.STAFF_WARPED, "warped"); + buildStaff(HexItems.STAFF_MANGROVE, "mangrove"); buildStaff(HexItems.STAFF_EDIFIED, "edified"); simpleItem(modLoc("patchouli_book")); @@ -201,9 +200,6 @@ public class HexItemModels extends PaucalItemModelProvider { .end().override() .predicate(ItemStaff.FUNNY_LEVEL_PREDICATE, 1) .model(new ModelFile.UncheckedModelFile(modLoc("item/old_staff"))) - .end().override() - .predicate(ItemStaff.FUNNY_LEVEL_PREDICATE, 2) - .model(new ModelFile.UncheckedModelFile(modLoc("item/bosnia_staff"))) .end(); } diff --git a/Forge/src/main/java/at/petrak/hexcasting/forge/interop/jei/HexJEIPlugin.java b/Forge/src/main/java/at/petrak/hexcasting/forge/interop/jei/HexJEIPlugin.java index 39d6e873..f841bd11 100644 --- a/Forge/src/main/java/at/petrak/hexcasting/forge/interop/jei/HexJEIPlugin.java +++ b/Forge/src/main/java/at/petrak/hexcasting/forge/interop/jei/HexJEIPlugin.java @@ -3,10 +3,11 @@ package at.petrak.hexcasting.forge.interop.jei; import at.petrak.hexcasting.api.HexAPI; import at.petrak.hexcasting.common.casting.operators.spells.OpEdifySapling; import at.petrak.hexcasting.common.casting.operators.spells.OpMakeBattery; +import at.petrak.hexcasting.common.items.ItemStaff; import at.petrak.hexcasting.common.lib.HexItems; import at.petrak.hexcasting.common.recipe.BrainsweepRecipe; -import at.petrak.hexcasting.interop.utils.PhialRecipeStackBuilder; import at.petrak.hexcasting.common.recipe.HexRecipeStuffRegistry; +import at.petrak.hexcasting.interop.utils.PhialRecipeStackBuilder; import mezz.jei.api.IModPlugin; import mezz.jei.api.JeiPlugin; import mezz.jei.api.recipe.RecipeType; @@ -68,14 +69,19 @@ public class HexJEIPlugin implements IModPlugin { @Override public void registerRecipeCatalysts(IRecipeCatalystRegistration registration) { - registration.addRecipeCatalyst(new ItemStack(HexItems.STAFF_OAK), BRAINSWEEPING, PHIAL, EDIFY); - registration.addRecipeCatalyst(new ItemStack(HexItems.STAFF_SPRUCE), BRAINSWEEPING, PHIAL, EDIFY); - registration.addRecipeCatalyst(new ItemStack(HexItems.STAFF_BIRCH), BRAINSWEEPING, PHIAL, EDIFY); - registration.addRecipeCatalyst(new ItemStack(HexItems.STAFF_JUNGLE), BRAINSWEEPING, PHIAL, EDIFY); - registration.addRecipeCatalyst(new ItemStack(HexItems.STAFF_ACACIA), BRAINSWEEPING, PHIAL, EDIFY); - registration.addRecipeCatalyst(new ItemStack(HexItems.STAFF_DARK_OAK), BRAINSWEEPING, PHIAL, EDIFY); - registration.addRecipeCatalyst(new ItemStack(HexItems.STAFF_CRIMSON), BRAINSWEEPING, PHIAL, EDIFY); - registration.addRecipeCatalyst(new ItemStack(HexItems.STAFF_WARPED), BRAINSWEEPING, PHIAL, EDIFY); - registration.addRecipeCatalyst(new ItemStack(HexItems.STAFF_EDIFIED), BRAINSWEEPING, PHIAL, EDIFY); + for (ItemStaff staff : new ItemStaff[]{ + HexItems.STAFF_OAK, + HexItems.STAFF_SPRUCE, + HexItems.STAFF_BIRCH, + HexItems.STAFF_JUNGLE, + HexItems.STAFF_ACACIA, + HexItems.STAFF_DARK_OAK, + HexItems.STAFF_CRIMSON, + HexItems.STAFF_WARPED, + HexItems.STAFF_MANGROVE, + HexItems.STAFF_EDIFIED, + }) { + registration.addRecipeCatalyst(new ItemStack(staff), BRAINSWEEPING, PHIAL, EDIFY); + } } } From ebf43e15f21934c850fd5e8dc1adfb4145d6d8c0 Mon Sep 17 00:00:00 2001 From: "petrak@" Date: Sun, 22 Jan 2023 13:52:43 -0600 Subject: [PATCH 49/95] prevent render brainsweep crash on fabric. todo: how to make villager regalia show up --- .../at/petrak/hexcasting/client/RenderLib.kt | 35 +- .../brainsweep/BrainsweepeeIngredient.java | 88 ++-- .../brainsweep/EntityTagIngredient.java | 183 ++++---- .../brainsweep/EntityTypeIngredient.java | 135 +++--- .../brainsweep/VillagerIngredient.java | 391 +++++++++--------- .../interop/emi/BrainsweepeeEmiStack.java | 154 ++++--- .../interop/jei/BrainsweepRecipeCategory.java | 6 +- 7 files changed, 490 insertions(+), 502 deletions(-) diff --git a/Common/src/main/java/at/petrak/hexcasting/client/RenderLib.kt b/Common/src/main/java/at/petrak/hexcasting/client/RenderLib.kt index 8168b6f2..7bf6923a 100644 --- a/Common/src/main/java/at/petrak/hexcasting/client/RenderLib.kt +++ b/Common/src/main/java/at/petrak/hexcasting/client/RenderLib.kt @@ -2,13 +2,9 @@ package at.petrak.hexcasting.client -import at.petrak.hexcasting.api.mod.HexConfig import at.petrak.hexcasting.api.casting.math.HexPattern +import at.petrak.hexcasting.api.mod.HexConfig import at.petrak.hexcasting.api.utils.TAU -import at.petrak.hexcasting.api.utils.getValue -import at.petrak.hexcasting.api.utils.setValue -import at.petrak.hexcasting.api.utils.weakMapped -import at.petrak.hexcasting.common.recipe.ingredient.brainsweep.BrainsweepeeIngredient import com.mojang.blaze3d.systems.RenderSystem import com.mojang.blaze3d.vertex.DefaultVertexFormat import com.mojang.blaze3d.vertex.PoseStack @@ -23,7 +19,6 @@ import net.minecraft.core.BlockPos import net.minecraft.util.FastColor import net.minecraft.util.Mth import net.minecraft.world.entity.Entity -import net.minecraft.world.entity.npc.Villager import net.minecraft.world.item.ItemStack import net.minecraft.world.level.Level import net.minecraft.world.level.levelgen.SingleThreadedRandomSource @@ -420,38 +415,14 @@ fun transferMsToGl(ms: PoseStack, toRun: Runnable) { RenderSystem.applyModelViewMatrix() } -private var villager: Villager? by weakMapped(Villager::level) - -fun prepareVillagerForRendering(ingredient: BrainsweepeeIngredient, level: Level): Villager { - throw NotImplementedError() - /* - val minLevel: Int = ingredient.minLevel() - val profession: VillagerProfession = Registry.VILLAGER_PROFESSION.getOptional(ingredient.profession()) - .orElse(VillagerProfession.NONE) - val biome: VillagerType = Registry.VILLAGER_TYPE.getOptional(ingredient.biome()) - .orElse(VillagerType.PLAINS) - - val instantiatedVillager = villager ?: run { - val newVillager = Villager(EntityType.VILLAGER, level) - villager = newVillager - newVillager - } - - instantiatedVillager.villagerData = instantiatedVillager.villagerData - .setProfession(profession) - .setType(biome) - .setLevel(minLevel) - - return instantiatedVillager - */ -} - @JvmOverloads fun renderEntity( ms: PoseStack, entity: Entity, world: Level, x: Float, y: Float, rotation: Float, renderScale: Float, offset: Float, bufferTransformer: (MultiBufferSource) -> MultiBufferSource = { it -> it } ) { + val rotation = if (Screen.hasShiftDown()) 0.0f else rotation + entity.level = world ms.pushPose() ms.translate(x.toDouble(), y.toDouble(), 50.0) diff --git a/Common/src/main/java/at/petrak/hexcasting/common/recipe/ingredient/brainsweep/BrainsweepeeIngredient.java b/Common/src/main/java/at/petrak/hexcasting/common/recipe/ingredient/brainsweep/BrainsweepeeIngredient.java index 293857d6..d5a51c62 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/recipe/ingredient/brainsweep/BrainsweepeeIngredient.java +++ b/Common/src/main/java/at/petrak/hexcasting/common/recipe/ingredient/brainsweep/BrainsweepeeIngredient.java @@ -1,6 +1,8 @@ package at.petrak.hexcasting.common.recipe.ingredient.brainsweep; +import at.petrak.hexcasting.xplat.IXplatAbstractions; import com.google.gson.JsonObject; +import net.minecraft.ChatFormatting; import net.minecraft.client.multiplayer.ClientLevel; import net.minecraft.network.FriendlyByteBuf; import net.minecraft.network.chat.Component; @@ -19,57 +21,61 @@ import java.util.Locale; // // .equals must make sense public abstract class BrainsweepeeIngredient { - public abstract boolean test(Entity entity, ServerLevel level); + public abstract boolean test(Entity entity, ServerLevel level); - public abstract Component getName(); + public abstract Component getName(); - public abstract List getTooltip(boolean advanced); + public abstract List getTooltip(boolean advanced); - public abstract JsonObject serialize(); + public abstract JsonObject serialize(); - public abstract void write(FriendlyByteBuf buf); + public abstract void write(FriendlyByteBuf buf); - /** - * For the benefit of showing to the client, return an example of the entity. - *

- * Can return null in case someone did something stupid with a recipe - */ - @Nullable - public abstract Entity exampleEntity(ClientLevel level); + /** + * For the benefit of showing to the client, return an example of the entity. + *

+ * Can return null in case someone did something stupid with a recipe + */ + @Nullable + public abstract Entity exampleEntity(ClientLevel level); - public abstract Type ingrType(); + public abstract Type ingrType(); - public abstract String getSomeKindOfReasonableIDForEmi(); + public abstract String getSomeKindOfReasonableIDForEmi(); - public static BrainsweepeeIngredient read(FriendlyByteBuf buf) { - var type = buf.readVarInt(); - return switch (Type.values()[type]) { - case VILLAGER -> VillagerIngredient.read(buf); - case ENTITY_TYPE -> EntityTypeIngredient.read(buf); - case ENTITY_TAG -> EntityTagIngredient.read(buf); - }; - } + public static BrainsweepeeIngredient read(FriendlyByteBuf buf) { + var type = buf.readVarInt(); + return switch (Type.values()[type]) { + case VILLAGER -> VillagerIngredient.read(buf); + case ENTITY_TYPE -> EntityTypeIngredient.read(buf); + case ENTITY_TAG -> EntityTagIngredient.read(buf); + }; + } - public static BrainsweepeeIngredient deserialize(JsonObject json) { - var typestr = GsonHelper.getAsString(json, "type"); - var type = Type.valueOf(typestr.toUpperCase(Locale.ROOT)); - return switch (type) { - case VILLAGER -> VillagerIngredient.deserialize(json); - case ENTITY_TYPE -> EntityTypeIngredient.deserialize(json); - case ENTITY_TAG -> EntityTagIngredient.deserialize(json); - }; - } + public static BrainsweepeeIngredient deserialize(JsonObject json) { + var typestr = GsonHelper.getAsString(json, "type"); + var type = Type.valueOf(typestr.toUpperCase(Locale.ROOT)); + return switch (type) { + case VILLAGER -> VillagerIngredient.deserialize(json); + case ENTITY_TYPE -> EntityTypeIngredient.deserialize(json); + case ENTITY_TAG -> EntityTagIngredient.deserialize(json); + }; + } - // TODO: make this a registry? - public enum Type implements StringRepresentable { - VILLAGER, - ENTITY_TYPE, - ENTITY_TAG; + // TODO: make this a registry? + public enum Type implements StringRepresentable { + VILLAGER, + ENTITY_TYPE, + ENTITY_TAG; - @Override - public String getSerializedName() { - return this.name().toLowerCase(Locale.ROOT); - } - } + @Override + public String getSerializedName() { + return this.name().toLowerCase(Locale.ROOT); + } + } + public static Component getModNameComponent(String namespace) { + String mod = IXplatAbstractions.INSTANCE.getModName(namespace); + return Component.literal(mod).withStyle(ChatFormatting.BLUE, ChatFormatting.ITALIC); + } } diff --git a/Common/src/main/java/at/petrak/hexcasting/common/recipe/ingredient/brainsweep/EntityTagIngredient.java b/Common/src/main/java/at/petrak/hexcasting/common/recipe/ingredient/brainsweep/EntityTagIngredient.java index 1224ab6e..c461fb29 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/recipe/ingredient/brainsweep/EntityTagIngredient.java +++ b/Common/src/main/java/at/petrak/hexcasting/common/recipe/ingredient/brainsweep/EntityTagIngredient.java @@ -19,111 +19,116 @@ import java.util.List; import java.util.Objects; public class EntityTagIngredient extends BrainsweepeeIngredient { - public final TagKey> entityTypeTag; + public final TagKey> entityTypeTag; - public EntityTagIngredient(TagKey> tag) { - this.entityTypeTag = tag; - } + public EntityTagIngredient(TagKey> tag) { + this.entityTypeTag = tag; + } - @Override - public boolean test(Entity entity, ServerLevel level) { - return entity.getType().is(this.entityTypeTag); - } + @Override + public boolean test(Entity entity, ServerLevel level) { + return entity.getType().is(this.entityTypeTag); + } - private static String tagKey(ResourceLocation tagLoc) { - return "tag." - + tagLoc.getNamespace() - + "." - + tagLoc.getPath().replace('/', '.'); - } + private static String tagKey(ResourceLocation tagLoc) { + return "tag." + + tagLoc.getNamespace() + + "." + + tagLoc.getPath().replace('/', '.'); + } - @Override - public Component getName() { - String key = tagKey(this.entityTypeTag.location()); - boolean moddersDidAGoodJob = I18n.exists(key); - return moddersDidAGoodJob - ? Component.translatable(key) - : Component.literal("#" + entityTypeTag); - } + @Override + public Component getName() { + String key = tagKey(this.entityTypeTag.location()); + boolean moddersDidAGoodJob = I18n.exists(key); + return moddersDidAGoodJob + ? Component.translatable(key) + : Component.literal("#" + this.entityTypeTag.location().toString()); + } - @Override - public List getTooltip(boolean advanced) { - String key = tagKey(this.entityTypeTag.location()); - boolean moddersDidAGoodJob = I18n.exists(key); + @Override + public List getTooltip(boolean advanced) { + ResourceLocation loc = this.entityTypeTag.location(); + String key = tagKey(loc); + boolean moddersDidAGoodJob = I18n.exists(key); - var out = new ArrayList(); - out.add(moddersDidAGoodJob - ? Component.translatable(key) - : Component.literal("#" + entityTypeTag)); - if (advanced && moddersDidAGoodJob) { - out.add(Component.literal("#" + entityTypeTag).withStyle(ChatFormatting.DARK_GRAY)); - } - return out; - } + var out = new ArrayList(); + out.add(moddersDidAGoodJob + ? Component.translatable(key) + : Component.literal("#" + loc.toString())); + if (advanced && moddersDidAGoodJob) { + // Print it anyways + out.add(Component.literal("#" + loc.toString()).withStyle(ChatFormatting.DARK_GRAY)); + } - @Override - public Entity exampleEntity(ClientLevel level) { - var someEntityTys = Registry.ENTITY_TYPE.getTagOrEmpty(this.entityTypeTag).iterator(); - if (someEntityTys.hasNext()) { - var someTy = someEntityTys.next(); - return someTy.value().create(level); - } else { - return null; - } - } + out.add(BrainsweepeeIngredient.getModNameComponent(loc.getNamespace())); - @Override - public JsonObject serialize() { - var obj = new JsonObject(); - obj.addProperty("type", Type.ENTITY_TAG.getSerializedName()); + return out; + } - obj.addProperty("tag", this.entityTypeTag.location().toString()); + @Override + public Entity exampleEntity(ClientLevel level) { + var someEntityTys = Registry.ENTITY_TYPE.getTagOrEmpty(this.entityTypeTag).iterator(); + if (someEntityTys.hasNext()) { + var someTy = someEntityTys.next(); + return someTy.value().create(level); + } else { + return null; + } + } - return obj; - } + @Override + public JsonObject serialize() { + var obj = new JsonObject(); + obj.addProperty("type", Type.ENTITY_TAG.getSerializedName()); - @Override - public void write(FriendlyByteBuf buf) { - buf.writeVarInt(Type.ENTITY_TAG.ordinal()); + obj.addProperty("tag", this.entityTypeTag.location().toString()); - buf.writeResourceLocation(this.entityTypeTag.location()); - } + return obj; + } - public static EntityTagIngredient deserialize(JsonObject obj) { - var tagLoc = ResourceLocation.tryParse(GsonHelper.getAsString(obj, "tag")); - var type = TagKey.create(Registry.ENTITY_TYPE_REGISTRY, tagLoc); - return new EntityTagIngredient(type); - } + @Override + public void write(FriendlyByteBuf buf) { + buf.writeVarInt(Type.ENTITY_TAG.ordinal()); - public static EntityTagIngredient read(FriendlyByteBuf buf) { - var typeLoc = buf.readResourceLocation(); - var type = TagKey.create(Registry.ENTITY_TYPE_REGISTRY, typeLoc); - return new EntityTagIngredient(type); - } + buf.writeResourceLocation(this.entityTypeTag.location()); + } - @Override - public Type ingrType() { - return Type.ENTITY_TAG; - } + public static EntityTagIngredient deserialize(JsonObject obj) { + var tagLoc = ResourceLocation.tryParse(GsonHelper.getAsString(obj, "tag")); + var type = TagKey.create(Registry.ENTITY_TYPE_REGISTRY, tagLoc); + return new EntityTagIngredient(type); + } - @Override - public String getSomeKindOfReasonableIDForEmi() { - var resloc = this.entityTypeTag.location(); - return resloc.getNamespace() - + "//" - + resloc.getPath(); - } + public static EntityTagIngredient read(FriendlyByteBuf buf) { + var typeLoc = buf.readResourceLocation(); + var type = TagKey.create(Registry.ENTITY_TYPE_REGISTRY, typeLoc); + return new EntityTagIngredient(type); + } - @Override - public boolean equals(Object o) { - if (this == o) return true; - if (o == null || getClass() != o.getClass()) return false; - EntityTagIngredient that = (EntityTagIngredient) o; - return Objects.equals(entityTypeTag, that.entityTypeTag); - } + @Override + public Type ingrType() { + return Type.ENTITY_TAG; + } - @Override - public int hashCode() { - return Objects.hashCode(this.entityTypeTag); - } + @Override + public String getSomeKindOfReasonableIDForEmi() { + var resloc = this.entityTypeTag.location(); + return resloc.getNamespace() + + "//" + + resloc.getPath(); + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || getClass() != o.getClass()) return false; + EntityTagIngredient that = (EntityTagIngredient) o; + return Objects.equals(entityTypeTag, that.entityTypeTag); + } + + @Override + public int hashCode() { + return Objects.hashCode(this.entityTypeTag); + } } diff --git a/Common/src/main/java/at/petrak/hexcasting/common/recipe/ingredient/brainsweep/EntityTypeIngredient.java b/Common/src/main/java/at/petrak/hexcasting/common/recipe/ingredient/brainsweep/EntityTypeIngredient.java index c5b941a5..aaf036dc 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/recipe/ingredient/brainsweep/EntityTypeIngredient.java +++ b/Common/src/main/java/at/petrak/hexcasting/common/recipe/ingredient/brainsweep/EntityTypeIngredient.java @@ -15,85 +15,88 @@ import java.util.List; import java.util.Objects; public class EntityTypeIngredient extends BrainsweepeeIngredient { - public final EntityType entityType; + public final EntityType entityType; - public EntityTypeIngredient(EntityType entityType) { - this.entityType = entityType; - } + public EntityTypeIngredient(EntityType entityType) { + this.entityType = entityType; + } - @Override - public boolean test(Entity entity, ServerLevel level) { - // entity types are singletons - return entity.getType() == this.entityType; - } + @Override + public boolean test(Entity entity, ServerLevel level) { + // entity types are singletons + return entity.getType() == this.entityType; + } - @Override - public Component getName() { - return this.entityType.getDescription(); - } + @Override + public Component getName() { + return this.entityType.getDescription(); + } - @Override - public List getTooltip(boolean advanced) { - return List.of(this.entityType.getDescription()); - } + @Override + public List getTooltip(boolean advanced) { + return List.of( + this.entityType.getDescription(), + BrainsweepeeIngredient.getModNameComponent(Registry.ENTITY_TYPE.getKey(this.entityType).getNamespace()) + ); + } - @Override - public Entity exampleEntity(ClientLevel level) { - return this.entityType.create(level); - } + @Override + public Entity exampleEntity(ClientLevel level) { + return this.entityType.create(level); + } - @Override - public JsonObject serialize() { - var obj = new JsonObject(); - obj.addProperty("type", Type.ENTITY_TYPE.getSerializedName()); - obj.addProperty("entityType", Registry.ENTITY_TYPE.getKey(this.entityType).toString()); + @Override + public JsonObject serialize() { + var obj = new JsonObject(); + obj.addProperty("type", Type.ENTITY_TYPE.getSerializedName()); + obj.addProperty("entityType", Registry.ENTITY_TYPE.getKey(this.entityType).toString()); - return obj; - } + return obj; + } - @Override - public void write(FriendlyByteBuf buf) { - buf.writeVarInt(Type.ENTITY_TYPE.ordinal()); + @Override + public void write(FriendlyByteBuf buf) { + buf.writeVarInt(Type.ENTITY_TYPE.ordinal()); - buf.writeVarInt(Registry.ENTITY_TYPE.getId(this.entityType)); - } + buf.writeVarInt(Registry.ENTITY_TYPE.getId(this.entityType)); + } - public static EntityTypeIngredient deserialize(JsonObject obj) { - var typeLoc = ResourceLocation.tryParse(GsonHelper.getAsString(obj, "entityType")); - if (!Registry.ENTITY_TYPE.containsKey(typeLoc)) { - throw new IllegalArgumentException("unknown entity type " + typeLoc); - } - return new EntityTypeIngredient(Registry.ENTITY_TYPE.get(typeLoc)); - } + public static EntityTypeIngredient deserialize(JsonObject obj) { + var typeLoc = ResourceLocation.tryParse(GsonHelper.getAsString(obj, "entityType")); + if (!Registry.ENTITY_TYPE.containsKey(typeLoc)) { + throw new IllegalArgumentException("unknown entity type " + typeLoc); + } + return new EntityTypeIngredient(Registry.ENTITY_TYPE.get(typeLoc)); + } - public static EntityTypeIngredient read(FriendlyByteBuf buf) { - var tyId = buf.readVarInt(); - return new EntityTypeIngredient(Registry.ENTITY_TYPE.byId(tyId)); - } + public static EntityTypeIngredient read(FriendlyByteBuf buf) { + var tyId = buf.readVarInt(); + return new EntityTypeIngredient(Registry.ENTITY_TYPE.byId(tyId)); + } - @Override - public Type ingrType() { - return Type.ENTITY_TYPE; - } + @Override + public Type ingrType() { + return Type.ENTITY_TYPE; + } - @Override - public String getSomeKindOfReasonableIDForEmi() { - var resloc = Registry.ENTITY_TYPE.getKey(this.entityType); - return resloc.getNamespace() - + "//" - + resloc.getPath(); - } + @Override + public String getSomeKindOfReasonableIDForEmi() { + var resloc = Registry.ENTITY_TYPE.getKey(this.entityType); + return resloc.getNamespace() + + "//" + + resloc.getPath(); + } - @Override - public boolean equals(Object o) { - if (this == o) return true; - if (o == null || getClass() != o.getClass()) return false; - EntityTypeIngredient that = (EntityTypeIngredient) o; - return Objects.equals(entityType, that.entityType); - } + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || getClass() != o.getClass()) return false; + EntityTypeIngredient that = (EntityTypeIngredient) o; + return Objects.equals(entityType, that.entityType); + } - @Override - public int hashCode() { - return Objects.hash(entityType); - } + @Override + public int hashCode() { + return Objects.hash(entityType); + } } diff --git a/Common/src/main/java/at/petrak/hexcasting/common/recipe/ingredient/brainsweep/VillagerIngredient.java b/Common/src/main/java/at/petrak/hexcasting/common/recipe/ingredient/brainsweep/VillagerIngredient.java index c3b82581..f8a3006a 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/recipe/ingredient/brainsweep/VillagerIngredient.java +++ b/Common/src/main/java/at/petrak/hexcasting/common/recipe/ingredient/brainsweep/VillagerIngredient.java @@ -1,10 +1,10 @@ package at.petrak.hexcasting.common.recipe.ingredient.brainsweep; -import at.petrak.hexcasting.xplat.IXplatAbstractions; import com.google.gson.JsonObject; import net.minecraft.ChatFormatting; import net.minecraft.client.multiplayer.ClientLevel; import net.minecraft.core.Registry; +import net.minecraft.nbt.CompoundTag; import net.minecraft.network.FriendlyByteBuf; import net.minecraft.network.chat.Component; import net.minecraft.network.chat.MutableComponent; @@ -26,224 +26,231 @@ import java.util.Objects; * Special case for villagers so we can have biome/profession/level reqs */ public class VillagerIngredient extends BrainsweepeeIngredient { - public final @Nullable VillagerProfession profession; - public final @Nullable VillagerType biome; - public final int minLevel; + public final @Nullable VillagerProfession profession; + public final @Nullable VillagerType biome; + public final int minLevel; - public VillagerIngredient( - @Nullable VillagerProfession profession, - @Nullable VillagerType biome, - int minLevel - ) { - this.profession = profession; - this.biome = biome; - this.minLevel = minLevel; - } + public VillagerIngredient( + @Nullable VillagerProfession profession, + @Nullable VillagerType biome, + int minLevel + ) { + this.profession = profession; + this.biome = biome; + this.minLevel = minLevel; + } - @Override - public boolean test(Entity entity, ServerLevel level) { - if (!(entity instanceof Villager villager)) return false; + @Override + public boolean test(Entity entity, ServerLevel level) { + if (!(entity instanceof Villager villager)) return false; - var data = villager.getVillagerData(); + var data = villager.getVillagerData(); - return (this.profession == null || this.profession.equals(data.getProfession())) - && (this.biome == null || this.biome.equals(data.getType())) - && this.minLevel <= data.getLevel(); - } + return (this.profession == null || this.profession.equals(data.getProfession())) + && (this.biome == null || this.biome.equals(data.getType())) + && this.minLevel <= data.getLevel(); + } - @Override - public Entity exampleEntity(ClientLevel level) { - var biome = Objects.requireNonNullElse(this.biome, VillagerType.PLAINS); - var out = new Villager(EntityType.VILLAGER, level, biome); + @Override + public Entity exampleEntity(ClientLevel level) { + var biome = Objects.requireNonNullElse(this.biome, VillagerType.PLAINS); + var profession = Objects.requireNonNullElse(this.profession, VillagerProfession.TOOLSMITH); + var tradeLevel = Math.min(this.minLevel, 1); - var profession = Objects.requireNonNullElse(this.profession, VillagerProfession.TOOLSMITH); - out.getVillagerData().setProfession(profession); - out.getVillagerData().setLevel(Math.max(this.minLevel, 1)); - return out; - } + var out = new Villager(EntityType.VILLAGER, level); - @Override - public List getTooltip(boolean advanced) { - List tooltip = new ArrayList<>(); - tooltip.add(this.getName()); + var data = out.getVillagerData(); + data + .setProfession(profession) + .setType(biome) + .setLevel(tradeLevel); + out.setVillagerData(data); - if (advanced) { - if (minLevel >= 5) { - tooltip.add(Component.translatable("hexcasting.tooltip.brainsweep.level", 5) - .withStyle(ChatFormatting.DARK_GRAY)); - } else if (minLevel > 1) { - tooltip.add(Component.translatable("hexcasting.tooltip.brainsweep.min_level", minLevel) - .withStyle(ChatFormatting.DARK_GRAY)); - } + // just random bullshit go to try and get it to update for god's sake + var tag = new CompoundTag(); + out.save(tag); + out.load(tag); - if (this.biome != null) { - tooltip.add(Component.literal(this.biome.toString()).withStyle(ChatFormatting.DARK_GRAY)); - } + return out; + } - if (this.profession != null) { - tooltip.add(Component.literal(this.profession.toString()).withStyle(ChatFormatting.DARK_GRAY)); - } - } + @Override + public List getTooltip(boolean advanced) { + List tooltip = new ArrayList<>(); + tooltip.add(this.getName()); - tooltip.add(this.getModNameComponent()); + if (advanced) { + if (minLevel >= 5) { + tooltip.add(Component.translatable("hexcasting.tooltip.brainsweep.level", 5) + .withStyle(ChatFormatting.DARK_GRAY)); + } else if (minLevel > 1) { + tooltip.add(Component.translatable("hexcasting.tooltip.brainsweep.min_level", minLevel) + .withStyle(ChatFormatting.DARK_GRAY)); + } - return tooltip; - } + if (this.biome != null) { + tooltip.add(Component.literal(this.biome.toString()).withStyle(ChatFormatting.DARK_GRAY)); + } - @Override - public Component getName() { - MutableComponent component = Component.literal(""); + if (this.profession != null) { + tooltip.add(Component.literal(this.profession.toString()).withStyle(ChatFormatting.DARK_GRAY)); + } + } - boolean addedAny = false; + tooltip.add(BrainsweepeeIngredient.getModNameComponent( + this.profession == null + ? "minecraft" + : Registry.VILLAGER_PROFESSION.getKey(this.profession).getNamespace())); - if (minLevel >= 5) { - component.append(Component.translatable("merchant.level.5")); - addedAny = true; - } else if (minLevel > 1) { - component.append(Component.translatable("merchant.level." + minLevel)); - addedAny = true; - } else if (profession != null) { - component.append(Component.translatable("merchant.level.1")); - addedAny = true; - } + return tooltip; + } - if (biome != null) { - if (addedAny) { - component.append(" "); - } - var biomeLoc = Registry.VILLAGER_TYPE.getKey(this.biome); - component.append(Component.translatable("biome." + biomeLoc.getNamespace() + "." + biomeLoc.getPath())); - addedAny = true; - } + @Override + public Component getName() { + MutableComponent component = Component.literal(""); - if (profession != null) { - // We've for sure added something - component.append(" "); - var professionLoc = Registry.VILLAGER_PROFESSION.getKey(this.profession); - // TODO: what's the convention used for modded villager types? - // Villager::getTypeName implies that it there's no namespace information. - // i hope there is some convention - component.append(Component.translatable("entity.minecraft.villager." + professionLoc.getPath())); - } else { - if (addedAny) { - component.append(" "); - } - component.append(EntityType.VILLAGER.getDescription()); - } + boolean addedAny = false; - return component; - } + if (minLevel >= 5) { + component.append(Component.translatable("merchant.level.5")); + addedAny = true; + } else if (minLevel > 1) { + component.append(Component.translatable("merchant.level." + minLevel)); + addedAny = true; + } else if (profession != null) { + component.append(Component.translatable("merchant.level.1")); + addedAny = true; + } - public Component getModNameComponent() { - String namespace = profession == null - ? "minecraft" - : Registry.VILLAGER_PROFESSION.getKey(this.profession).getNamespace(); - String mod = IXplatAbstractions.INSTANCE.getModName(namespace); - return Component.literal(mod).withStyle(ChatFormatting.BLUE, ChatFormatting.ITALIC); - } + if (biome != null) { + if (addedAny) { + component.append(" "); + } + var biomeLoc = Registry.VILLAGER_TYPE.getKey(this.biome); + component.append(Component.translatable("biome." + biomeLoc.getNamespace() + "." + biomeLoc.getPath())); + addedAny = true; + } - @Override - public JsonObject serialize() { - var obj = new JsonObject(); - obj.addProperty("type", Type.VILLAGER.getSerializedName()); + if (profession != null) { + // We've for sure added something + component.append(" "); + var professionLoc = Registry.VILLAGER_PROFESSION.getKey(this.profession); + // TODO: what's the convention used for modded villager types? + // Villager::getTypeName implies that it there's no namespace information. + // i hope there is some convention + component.append(Component.translatable("entity.minecraft.villager." + professionLoc.getPath())); + } else { + if (addedAny) { + component.append(" "); + } + component.append(EntityType.VILLAGER.getDescription()); + } - if (this.profession != null) { - obj.addProperty("profession", this.profession.toString()); - } - if (this.biome != null) { - obj.addProperty("biome", this.biome.toString()); - } - obj.addProperty("minLevel", this.minLevel); - return obj; - } + return component; + } - @Override - public void write(FriendlyByteBuf buf) { - if (this.profession != null) { - buf.writeVarInt(1); - buf.writeVarInt(Registry.VILLAGER_PROFESSION.getId(this.profession)); - } else { - buf.writeVarInt(0); - } - if (this.biome != null) { - buf.writeVarInt(1); - buf.writeVarInt(Registry.VILLAGER_TYPE.getId(this.biome)); - } else { - buf.writeVarInt(0); - } - buf.writeInt(this.minLevel); - } + @Override + public JsonObject serialize() { + var obj = new JsonObject(); + obj.addProperty("type", Type.VILLAGER.getSerializedName()); - public static VillagerIngredient deserialize(JsonObject json) { - VillagerProfession profession = null; - if (json.has("profession") && !json.get("profession").isJsonNull()) { - profession = Registry.VILLAGER_PROFESSION.get(new ResourceLocation(GsonHelper.getAsString(json, - "profession"))); - } - VillagerType biome = null; - if (json.has("biome") && !json.get("biome").isJsonNull()) { - biome = Registry.VILLAGER_TYPE.get(new ResourceLocation(GsonHelper.getAsString(json, "biome"))); - } - int minLevel = GsonHelper.getAsInt(json, "minLevel"); - return new VillagerIngredient(profession, biome, minLevel); - } + if (this.profession != null) { + obj.addProperty("profession", this.profession.toString()); + } + if (this.biome != null) { + obj.addProperty("biome", this.biome.toString()); + } + obj.addProperty("minLevel", this.minLevel); + return obj; + } - public static VillagerIngredient read(FriendlyByteBuf buf) { - VillagerProfession profession = null; - var hasProfession = buf.readVarInt(); - if (hasProfession != 0) { - profession = Registry.VILLAGER_PROFESSION.byId(buf.readVarInt()); - } - VillagerType biome = null; - var hasBiome = buf.readVarInt(); - if (hasBiome != 0) { - biome = Registry.VILLAGER_TYPE.byId(buf.readVarInt()); - } - int minLevel = buf.readInt(); - return new VillagerIngredient(profession, biome, minLevel); - } + @Override + public void write(FriendlyByteBuf buf) { + if (this.profession != null) { + buf.writeVarInt(1); + buf.writeVarInt(Registry.VILLAGER_PROFESSION.getId(this.profession)); + } else { + buf.writeVarInt(0); + } + if (this.biome != null) { + buf.writeVarInt(1); + buf.writeVarInt(Registry.VILLAGER_TYPE.getId(this.biome)); + } else { + buf.writeVarInt(0); + } + buf.writeInt(this.minLevel); + } - @Override - public Type ingrType() { - return Type.VILLAGER; - } + public static VillagerIngredient deserialize(JsonObject json) { + VillagerProfession profession = null; + if (json.has("profession") && !json.get("profession").isJsonNull()) { + profession = Registry.VILLAGER_PROFESSION.get(new ResourceLocation(GsonHelper.getAsString(json, + "profession"))); + } + VillagerType biome = null; + if (json.has("biome") && !json.get("biome").isJsonNull()) { + biome = Registry.VILLAGER_TYPE.get(new ResourceLocation(GsonHelper.getAsString(json, "biome"))); + } + int minLevel = GsonHelper.getAsInt(json, "minLevel"); + return new VillagerIngredient(profession, biome, minLevel); + } - @Override - public String getSomeKindOfReasonableIDForEmi() { - var bob = new StringBuilder(); - if (this.profession != null) { - var profLoc = Registry.VILLAGER_PROFESSION.getKey(this.profession); - bob.append(profLoc.getNamespace()) - .append("//") - .append(profLoc.getPath()); - } else { - bob.append("null"); - } - bob.append("_"); - if (this.biome != null) { - var biomeLoc = Registry.VILLAGER_TYPE.getKey(this.biome); - bob.append(biomeLoc.getNamespace()) - .append("//") - .append(biomeLoc.getPath()); - } else { - bob.append("null"); - } + public static VillagerIngredient read(FriendlyByteBuf buf) { + VillagerProfession profession = null; + var hasProfession = buf.readVarInt(); + if (hasProfession != 0) { + profession = Registry.VILLAGER_PROFESSION.byId(buf.readVarInt()); + } + VillagerType biome = null; + var hasBiome = buf.readVarInt(); + if (hasBiome != 0) { + biome = Registry.VILLAGER_TYPE.byId(buf.readVarInt()); + } + int minLevel = buf.readInt(); + return new VillagerIngredient(profession, biome, minLevel); + } - bob.append(this.minLevel); - return bob.toString(); - } + @Override + public Type ingrType() { + return Type.VILLAGER; + } - @Override - public boolean equals(Object o) { - if (this == o) return true; - if (o == null || getClass() != o.getClass()) return false; - VillagerIngredient that = (VillagerIngredient) o; - return minLevel == that.minLevel && Objects.equals(profession, that.profession) && Objects.equals(biome, - that.biome); - } + @Override + public String getSomeKindOfReasonableIDForEmi() { + var bob = new StringBuilder(); + if (this.profession != null) { + var profLoc = Registry.VILLAGER_PROFESSION.getKey(this.profession); + bob.append(profLoc.getNamespace()) + .append("//") + .append(profLoc.getPath()); + } else { + bob.append("null"); + } + bob.append("_"); + if (this.biome != null) { + var biomeLoc = Registry.VILLAGER_TYPE.getKey(this.biome); + bob.append(biomeLoc.getNamespace()) + .append("//") + .append(biomeLoc.getPath()); + } else { + bob.append("null"); + } - @Override - public int hashCode() { - return Objects.hash(profession, biome, minLevel); - } + bob.append(this.minLevel); + return bob.toString(); + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || getClass() != o.getClass()) return false; + VillagerIngredient that = (VillagerIngredient) o; + return minLevel == that.minLevel && Objects.equals(profession, that.profession) && Objects.equals(biome, + that.biome); + } + + @Override + public int hashCode() { + return Objects.hash(profession, biome, minLevel); + } } diff --git a/Fabric/src/main/java/at/petrak/hexcasting/fabric/interop/emi/BrainsweepeeEmiStack.java b/Fabric/src/main/java/at/petrak/hexcasting/fabric/interop/emi/BrainsweepeeEmiStack.java index bd72ece1..43af627d 100644 --- a/Fabric/src/main/java/at/petrak/hexcasting/fabric/interop/emi/BrainsweepeeEmiStack.java +++ b/Fabric/src/main/java/at/petrak/hexcasting/fabric/interop/emi/BrainsweepeeEmiStack.java @@ -1,7 +1,6 @@ package at.petrak.hexcasting.fabric.interop.emi; import at.petrak.hexcasting.client.ClientTickCounter; -import at.petrak.hexcasting.client.RenderLib; import at.petrak.hexcasting.common.recipe.ingredient.brainsweep.BrainsweepeeIngredient; import com.mojang.blaze3d.systems.RenderSystem; import com.mojang.blaze3d.vertex.PoseStack; @@ -12,7 +11,6 @@ import net.minecraft.client.multiplayer.ClientLevel; import net.minecraft.nbt.CompoundTag; import net.minecraft.network.chat.Component; import net.minecraft.resources.ResourceLocation; -import net.minecraft.world.entity.npc.Villager; import java.util.List; import java.util.stream.Collectors; @@ -21,102 +19,102 @@ import static at.petrak.hexcasting.api.HexAPI.modLoc; import static at.petrak.hexcasting.client.RenderLib.renderEntity; public class BrainsweepeeEmiStack extends EmiStack { - public final BrainsweepeeIngredient ingredient; - private final ResourceLocation id; - private final BrainsweepeeEntry entry; + public final BrainsweepeeIngredient ingredient; + private final ResourceLocation id; + private final BrainsweepeeEntry entry; - public BrainsweepeeEmiStack(BrainsweepeeIngredient ingr) { - this.ingredient = ingr; + public BrainsweepeeEmiStack(BrainsweepeeIngredient ingr) { + this.ingredient = ingr; - var bareId = this.ingredient.getSomeKindOfReasonableIDForEmi(); - this.id = modLoc(bareId); - this.entry = new BrainsweepeeEntry(this.ingredient); - } + var bareId = this.ingredient.getSomeKindOfReasonableIDForEmi(); + this.id = modLoc(bareId); + this.entry = new BrainsweepeeEntry(this.ingredient); + } - @Override - public EmiStack copy() { - return new BrainsweepeeEmiStack(this.ingredient); - } + @Override + public EmiStack copy() { + return new BrainsweepeeEmiStack(this.ingredient); + } - @Override - public boolean isEmpty() { - return false; - } + @Override + public boolean isEmpty() { + return false; + } - @Override - public CompoundTag getNbt() { - return null; - } + @Override + public CompoundTag getNbt() { + return null; + } - @Override - public Object getKey() { - return id; - } + @Override + public Object getKey() { + return id; + } - @Override - public Entry getEntry() { - return entry; - } + @Override + public Entry getEntry() { + return entry; + } - @Override - public ResourceLocation getId() { - return id; - } + @Override + public ResourceLocation getId() { + return id; + } - @Override - public List getTooltipText() { - Minecraft mc = Minecraft.getInstance(); - boolean advanced = mc.options.advancedItemTooltips; + @Override + public List getTooltipText() { + Minecraft mc = Minecraft.getInstance(); + boolean advanced = mc.options.advancedItemTooltips; - return ingredient.getTooltip(advanced); - } + return ingredient.getTooltip(advanced); + } - @Override - public List getTooltip() { - return getTooltipText().stream() - .map(Component::getVisualOrderText) - .map(ClientTooltipComponent::create) - .collect(Collectors.toList()); - } + @Override + public List getTooltip() { + return getTooltipText().stream() + .map(Component::getVisualOrderText) + .map(ClientTooltipComponent::create) + .collect(Collectors.toList()); + } - @Override - public Component getName() { - return ingredient.getName(); - } + @Override + public Component getName() { + return ingredient.getName(); + } - @Override - public void render(PoseStack poseStack, int x, int y, float delta, int flags) { - if ((flags & RENDER_ICON) != 0) { - Minecraft mc = Minecraft.getInstance(); - ClientLevel level = mc.level; - if (level != null) { - Villager villager = RenderLib.prepareVillagerForRendering(ingredient, level); + @Override + public void render(PoseStack poseStack, int x, int y, float delta, int flags) { + if ((flags & RENDER_ICON) != 0) { + Minecraft mc = Minecraft.getInstance(); + ClientLevel level = mc.level; + if (level != null) { + var example = this.ingredient.exampleEntity(level); - RenderSystem.enableBlend(); - RenderSystem.setShaderColor(1.0F, 1.0F, 1.0F, 1.0F); - renderEntity(poseStack, villager, level, x + 8, y + 16, ClientTickCounter.getTotal(), 8, 0, it -> it); - } - } + RenderSystem.enableBlend(); + RenderSystem.setShaderColor(1.0F, 1.0F, 1.0F, 1.0F); + renderEntity(poseStack, example, level, x + 8, y + 16, ClientTickCounter.getTotal(), 8, 0, it -> it); + } + } // if ((flags & RENDER_REMAINDER) != 0) { // EmiRender.renderRemainderIcon(this, poseStack, x, y); // } - } + } - public static class BrainsweepeeEntry extends EmiStack.Entry { + public static class BrainsweepeeEntry extends EmiStack.Entry { - public BrainsweepeeEntry(BrainsweepeeIngredient variant) { - super(variant); - } + public BrainsweepeeEntry(BrainsweepeeIngredient variant) { + super(variant); + } - @Override - public Class getType() { - return BrainsweepeeIngredient.class; - } + @Override + public Class getType() { + return BrainsweepeeIngredient.class; + } - @Override - public boolean equals(Object obj) { - return obj instanceof BrainsweepeeIngredient bi && bi.equals(this.getValue()); - } - } + @Override + public boolean equals(Object obj) { + return obj instanceof BrainsweepeeIngredient bi && bi.equals(this.getValue()); + } + } } diff --git a/Forge/src/main/java/at/petrak/hexcasting/forge/interop/jei/BrainsweepRecipeCategory.java b/Forge/src/main/java/at/petrak/hexcasting/forge/interop/jei/BrainsweepRecipeCategory.java index 3d42d3ac..79816540 100644 --- a/Forge/src/main/java/at/petrak/hexcasting/forge/interop/jei/BrainsweepRecipeCategory.java +++ b/Forge/src/main/java/at/petrak/hexcasting/forge/interop/jei/BrainsweepRecipeCategory.java @@ -1,7 +1,6 @@ package at.petrak.hexcasting.forge.interop.jei; import at.petrak.hexcasting.client.ClientTickCounter; -import at.petrak.hexcasting.client.RenderLib; import at.petrak.hexcasting.common.recipe.BrainsweepRecipe; import com.mojang.blaze3d.systems.RenderSystem; import com.mojang.blaze3d.vertex.PoseStack; @@ -18,7 +17,6 @@ import net.minecraft.client.Minecraft; import net.minecraft.client.multiplayer.ClientLevel; import net.minecraft.network.chat.Component; import net.minecraft.resources.ResourceLocation; -import net.minecraft.world.entity.npc.Villager; import net.minecraft.world.item.ItemStack; import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.OnlyIn; @@ -81,11 +79,11 @@ public class BrainsweepRecipeCategory implements IRecipeCategory Date: Sun, 22 Jan 2023 14:08:09 -0600 Subject: [PATCH 50/95] close #384 (and also change scrolls) --- .../petrak/hexcasting/common/items/ItemScroll.java | 12 ++++++++---- .../at/petrak/hexcasting/common/items/ItemSlate.java | 7 ++----- .../ingredient/brainsweep/VillagerIngredient.java | 1 - 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/Common/src/main/java/at/petrak/hexcasting/common/items/ItemScroll.java b/Common/src/main/java/at/petrak/hexcasting/common/items/ItemScroll.java index 64f57c77..922dfbe6 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/items/ItemScroll.java +++ b/Common/src/main/java/at/petrak/hexcasting/common/items/ItemScroll.java @@ -1,9 +1,9 @@ package at.petrak.hexcasting.common.items; -import at.petrak.hexcasting.api.item.IotaHolderItem; import at.petrak.hexcasting.api.casting.iota.Iota; import at.petrak.hexcasting.api.casting.iota.PatternIota; import at.petrak.hexcasting.api.casting.math.HexPattern; +import at.petrak.hexcasting.api.item.IotaHolderItem; import at.petrak.hexcasting.api.utils.NBTHelper; import at.petrak.hexcasting.client.gui.PatternTooltipComponent; import at.petrak.hexcasting.common.entities.EntityWallScroll; @@ -65,13 +65,17 @@ public class ItemScroll extends Item implements IotaHolderItem { @Override public boolean canWrite(ItemStack stack, Iota datum) { - return datum instanceof PatternIota && !NBTHelper.hasCompound(stack, TAG_PATTERN); + return datum instanceof PatternIota || datum == null; } @Override public void writeDatum(ItemStack stack, Iota datum) { - if (this.canWrite(stack, datum) && datum instanceof PatternIota pat) { - NBTHelper.putCompound(stack, TAG_PATTERN, pat.getPattern().serializeToNBT()); + if (this.canWrite(stack, datum)) { + if (datum instanceof PatternIota pat) { + NBTHelper.putCompound(stack, TAG_PATTERN, pat.getPattern().serializeToNBT()); + } else if (datum == null) { + NBTHelper.remove(stack, TAG_PATTERN); + } } } diff --git a/Common/src/main/java/at/petrak/hexcasting/common/items/ItemSlate.java b/Common/src/main/java/at/petrak/hexcasting/common/items/ItemSlate.java index 8d388139..db576751 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/items/ItemSlate.java +++ b/Common/src/main/java/at/petrak/hexcasting/common/items/ItemSlate.java @@ -2,10 +2,10 @@ package at.petrak.hexcasting.common.items; import at.petrak.hexcasting.annotations.SoftImplement; import at.petrak.hexcasting.api.HexAPI; -import at.petrak.hexcasting.api.item.IotaHolderItem; import at.petrak.hexcasting.api.casting.iota.Iota; import at.petrak.hexcasting.api.casting.iota.PatternIota; import at.petrak.hexcasting.api.casting.math.HexPattern; +import at.petrak.hexcasting.api.item.IotaHolderItem; import at.petrak.hexcasting.api.utils.NBTHelper; import at.petrak.hexcasting.client.gui.PatternTooltipComponent; import at.petrak.hexcasting.common.blocks.circles.BlockEntitySlate; @@ -86,10 +86,7 @@ public class ItemSlate extends BlockItem implements IotaHolderItem { @Override public boolean canWrite(ItemStack stack, Iota datum) { - var isWritten = NBTHelper.hasCompound(stack, "BlockEntityTag") - && stack.getTag().getCompound("BlockEntityTag").contains(BlockEntitySlate.TAG_PATTERN); - return (datum instanceof PatternIota && !isWritten) - || (datum == null && isWritten); + return datum instanceof PatternIota || datum == null; } @Override diff --git a/Common/src/main/java/at/petrak/hexcasting/common/recipe/ingredient/brainsweep/VillagerIngredient.java b/Common/src/main/java/at/petrak/hexcasting/common/recipe/ingredient/brainsweep/VillagerIngredient.java index f8a3006a..9acfef0c 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/recipe/ingredient/brainsweep/VillagerIngredient.java +++ b/Common/src/main/java/at/petrak/hexcasting/common/recipe/ingredient/brainsweep/VillagerIngredient.java @@ -69,7 +69,6 @@ public class VillagerIngredient extends BrainsweepeeIngredient { // just random bullshit go to try and get it to update for god's sake var tag = new CompoundTag(); out.save(tag); - out.load(tag); return out; } From 07df9298e8979cee0201c7d379cbcdf065b88be7 Mon Sep 17 00:00:00 2001 From: "petrak@" Date: Sun, 22 Jan 2023 14:08:32 -0600 Subject: [PATCH 51/95] fix localization of scrolls --- .../main/java/at/petrak/hexcasting/common/items/ItemScroll.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Common/src/main/java/at/petrak/hexcasting/common/items/ItemScroll.java b/Common/src/main/java/at/petrak/hexcasting/common/items/ItemScroll.java index 922dfbe6..c0fa5de2 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/items/ItemScroll.java +++ b/Common/src/main/java/at/petrak/hexcasting/common/items/ItemScroll.java @@ -125,7 +125,7 @@ public class ItemScroll extends Item implements IotaHolderItem { var ancientId = NBTHelper.getString(pStack, TAG_OP_ID); if (ancientId != null) { return Component.translatable(descID + ".of", - Component.translatable("hexcasting.spell." + ResourceLocation.tryParse(ancientId))); + Component.translatable("hexcasting.action." + ResourceLocation.tryParse(ancientId))); } else if (NBTHelper.hasCompound(pStack, TAG_PATTERN)) { return Component.translatable(descID); } else { From 1845a11797183db47666ddfe75cb9cfa604e945b Mon Sep 17 00:00:00 2001 From: "petrak@" Date: Sun, 22 Jan 2023 14:13:55 -0600 Subject: [PATCH 52/95] Close #371 Summoned rain lasts 0.5-1.5hrs; summoned sunshine lasts 2-3hrs. --- .../common/casting/operators/spells/great/OpWeather.kt | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) 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 49e8e942..e349fe0e 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 @@ -30,10 +30,12 @@ class OpWeather(val rain: Boolean) : SpellAction { if (w.isRaining != rain) { w.levelData.isRaining = rain // i hex the rains down in minecraftia + val (minTime, maxTime) = if (rain) (30 to 90) else (60 to 180) + val time = (w.random.nextInt(minTime, maxTime)) * 20 * 60 if (rain) { - w.setWeatherParameters(0, 6000, true, w.random.nextDouble() < 0.05) + w.setWeatherParameters(0, time, true, w.random.nextDouble() < 0.05) } else { - w.setWeatherParameters(6000, 0, false, false) + w.setWeatherParameters(time, 0, false, false) } } } From eade2a52067d5bbda86a9d5e37adf5ca5f862e4b Mon Sep 17 00:00:00 2001 From: "petrak@" Date: Sun, 22 Jan 2023 17:02:17 -0600 Subject: [PATCH 53/95] fix #362 --- .../src/main/java/at/petrak/hexcasting/interop/HexInterop.java | 3 +-- .../thehexbook/en_us/entries/interop/gravity.json | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/Common/src/main/java/at/petrak/hexcasting/interop/HexInterop.java b/Common/src/main/java/at/petrak/hexcasting/interop/HexInterop.java index ab1379b3..b74a2ceb 100644 --- a/Common/src/main/java/at/petrak/hexcasting/interop/HexInterop.java +++ b/Common/src/main/java/at/petrak/hexcasting/interop/HexInterop.java @@ -18,8 +18,7 @@ public class HexInterop { } public static final class Fabric { - // TODO: the ID for this mod changed, fix that, #362 - public static final String GRAVITY_CHANGER_API_ID = "gravitychanger"; + public static final String GRAVITY_CHANGER_API_ID = "gravity_api"; public static final String TRINKETS_API_ID = "trinkets"; } diff --git a/Common/src/main/resources/data/hexcasting/patchouli_books/thehexbook/en_us/entries/interop/gravity.json b/Common/src/main/resources/data/hexcasting/patchouli_books/thehexbook/en_us/entries/interop/gravity.json index fd07884e..8a638d55 100644 --- a/Common/src/main/resources/data/hexcasting/patchouli_books/thehexbook/en_us/entries/interop/gravity.json +++ b/Common/src/main/resources/data/hexcasting/patchouli_books/thehexbook/en_us/entries/interop/gravity.json @@ -3,7 +3,7 @@ "icon": "minecraft:anvil", "category": "hexcasting:interop", "advancement": "hexcasting:root", - "flag": "mod:gravitychanger", + "flag": "mod:gravity_api", "pages": [ "hexcasting.page.interop.gravity.1", { From c6c862d0f47bdad445c01e8576ed726d14d370c3 Mon Sep 17 00:00:00 2001 From: "petrak@" Date: Sun, 22 Jan 2023 19:47:18 -0600 Subject: [PATCH 54/95] close #387 (picked 8192) --- .../casting/operators/spells/OpAddMotion.kt | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/spells/OpAddMotion.kt b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/spells/OpAddMotion.kt index 2af09626..36f370c3 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/spells/OpAddMotion.kt +++ b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/spells/OpAddMotion.kt @@ -1,10 +1,13 @@ package at.petrak.hexcasting.common.casting.operators.spells -import at.petrak.hexcasting.api.misc.MediaConstants -import at.petrak.hexcasting.api.casting.* +import at.petrak.hexcasting.api.casting.ParticleSpray +import at.petrak.hexcasting.api.casting.RenderedSpell import at.petrak.hexcasting.api.casting.castables.SpellAction import at.petrak.hexcasting.api.casting.eval.CastingEnvironment +import at.petrak.hexcasting.api.casting.getEntity +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.world.entity.Entity import net.minecraft.world.phys.Vec3 @@ -12,6 +15,9 @@ object OpAddMotion : SpellAction { override val argc: Int get() = 2 + // for bug #387 + val MAX_MOTION: Double = 8192.0 + override fun execute( args: List, ctx: CastingEnvironment @@ -23,8 +29,13 @@ object OpAddMotion : SpellAction { if (ctx.hasBeenGivenMotion(target)) motionForCost++ ctx.markEntityAsMotionAdded(target) + + val shrunkMotion = if (motion.lengthSqr() > MAX_MOTION * MAX_MOTION) + motion.normalize().scale(MAX_MOTION) + else + motion return Triple( - Spell(target, motion), + Spell(target, shrunkMotion), (motionForCost * MediaConstants.DUST_UNIT).toInt(), listOf( ParticleSpray( From 9d2d56916aebdf4022dd2af62d838c8bdb99963a Mon Sep 17 00:00:00 2001 From: "petrak@" Date: Sun, 22 Jan 2023 20:06:54 -0600 Subject: [PATCH 55/95] fix bowlglimmer and ligature costs, re #360, closes #351 --- .../hexcasting/datagen/HexAdvancements.java | 20 +++++---- .../datagen/recipe/HexplatRecipes.java | 37 +++++++--------- .../03e4de26f1265135874f8cdcaebc09d9c08eb42b | 2 +- .../67cce32b1c3cbbcb1f646605f4914e3f196986c2 | 2 +- .../75bcd4dba6ca7d365462b0ec45e291d1056349c4 | 2 +- .../844611d4af49e23072b8a888c8e73c6c5d8c0768 | 2 +- .../9fb1092f32d4fcbf9e061ffd718d4ec689c6c95e | 42 +++++++++---------- .../brainsweep/brainsweep/akashic_record.json | 4 +- .../brainsweep/budding_amethyst.json | 4 +- .../brainsweep/directrix_redstone.json | 4 +- .../brainsweep/brainsweep/impetus_look.json | 4 +- .../brainsweep/impetus_rightclick.json | 4 +- .../brainsweep/impetus_storedplayer.json | 4 +- .../brainsweep/testing/bad_to_the_bone.json | 4 +- .../brainsweep/testing/flowey_the_flower.json | 4 +- .../akashic_bookshelf.json | 4 +- .../akashic_connector.json | 4 +- .../empty_directrix.json | 4 +- .../empty_impetus.json | 4 +- .../hexcasting.creative_tab/scroll.json | 4 +- .../scroll_medium.json | 4 +- .../hexcasting.creative_tab/scroll_small.json | 4 +- .../hexcasting/recipes/akashic_connector.json | 11 ++++- .../data/hexcasting/recipes/scroll.json | 2 +- .../hexcasting/recipes/scroll_medium.json | 2 +- .../data/hexcasting/recipes/scroll_small.json | 2 +- .../hexcasting/recipes/uuid_colorizer.json | 7 +--- .../9fb1092f32d4fcbf9e061ffd718d4ec689c6c95e | 42 +++++++++---------- .../brainsweep/brainsweep/akashic_record.json | 4 +- .../brainsweep/budding_amethyst.json | 4 +- .../brainsweep/directrix_redstone.json | 4 +- .../brainsweep/brainsweep/impetus_look.json | 4 +- .../brainsweep/impetus_rightclick.json | 4 +- .../brainsweep/impetus_storedplayer.json | 4 +- .../brainsweep/testing/bad_to_the_bone.json | 4 +- .../brainsweep/testing/flowey_the_flower.json | 4 +- .../recipes/hexcasting/akashic_bookshelf.json | 4 +- .../recipes/hexcasting/akashic_connector.json | 4 +- .../recipes/hexcasting/empty_directrix.json | 4 +- .../recipes/hexcasting/empty_impetus.json | 4 +- .../recipes/hexcasting/scroll.json | 4 +- .../recipes/hexcasting/scroll_medium.json | 4 +- .../recipes/hexcasting/scroll_small.json | 4 +- .../hexcasting/recipes/akashic_connector.json | 11 ++++- .../data/hexcasting/recipes/scroll.json | 2 +- .../hexcasting/recipes/scroll_medium.json | 2 +- .../data/hexcasting/recipes/scroll_small.json | 2 +- .../hexcasting/recipes/uuid_colorizer.json | 7 +--- 48 files changed, 154 insertions(+), 163 deletions(-) diff --git a/Common/src/main/java/at/petrak/hexcasting/datagen/HexAdvancements.java b/Common/src/main/java/at/petrak/hexcasting/datagen/HexAdvancements.java index 4cfd011f..9320c79e 100644 --- a/Common/src/main/java/at/petrak/hexcasting/datagen/HexAdvancements.java +++ b/Common/src/main/java/at/petrak/hexcasting/datagen/HexAdvancements.java @@ -23,6 +23,16 @@ import net.minecraft.world.item.Items; import java.util.function.Consumer; public class HexAdvancements extends PaucalAdvancementProvider { + public static final OvercastTrigger.Instance ENLIGHTEN = + new OvercastTrigger.Instance(EntityPredicate.Composite.ANY, + MinMaxBounds.Ints.ANY, + // add a little bit of slop here. use 80% or more health ... + MinMaxBounds.Doubles.atLeast(0.8), + // and be left with under 1 healthpoint (half a heart) + // TODO this means if 80% of your health is less than half a heart, so if you have 2.5 hearts or + // less, you can't become enlightened. + MinMaxBounds.Doubles.between(Double.MIN_NORMAL, 1.0)); + public HexAdvancements(DataGenerator generatorIn) { super(generatorIn, HexAPI.MOD_ID); } @@ -83,15 +93,7 @@ public class HexAdvancements extends PaucalAdvancementProvider { null, FrameType.CHALLENGE, true, true, true)) .parent(opened_eyes) - .addCriterion("health_used", - new OvercastTrigger.Instance(EntityPredicate.Composite.ANY, - MinMaxBounds.Ints.ANY, - // add a little bit of slop here. use 80% or more health ... - MinMaxBounds.Doubles.atLeast(0.8), - // and be left with under 1 healthpoint (half a heart) - // TODO this means if 80% of your health is less than half a heart, so if you have 2.5 hearts or - // less, you can't become enlightened. - MinMaxBounds.Doubles.between(Double.MIN_NORMAL, 1.0))) + .addCriterion("health_used", ENLIGHTEN) .save(consumer, prefix("enlightenment")); var loreRoot = Advancement.Builder.advancement() diff --git a/Common/src/main/java/at/petrak/hexcasting/datagen/recipe/HexplatRecipes.java b/Common/src/main/java/at/petrak/hexcasting/datagen/recipe/HexplatRecipes.java index 2fd999e6..39bf8dc6 100644 --- a/Common/src/main/java/at/petrak/hexcasting/datagen/recipe/HexplatRecipes.java +++ b/Common/src/main/java/at/petrak/hexcasting/datagen/recipe/HexplatRecipes.java @@ -1,7 +1,6 @@ package at.petrak.hexcasting.datagen.recipe; import at.petrak.hexcasting.api.HexAPI; -import at.petrak.hexcasting.api.advancements.OvercastTrigger; import at.petrak.hexcasting.api.misc.MediaConstants; import at.petrak.hexcasting.api.mod.HexTags; import at.petrak.hexcasting.common.items.ItemStaff; @@ -14,6 +13,7 @@ import at.petrak.hexcasting.common.recipe.ingredient.StateIngredientHelper; import at.petrak.hexcasting.common.recipe.ingredient.brainsweep.EntityTagIngredient; import at.petrak.hexcasting.common.recipe.ingredient.brainsweep.EntityTypeIngredient; import at.petrak.hexcasting.common.recipe.ingredient.brainsweep.VillagerIngredient; +import at.petrak.hexcasting.datagen.HexAdvancements; import at.petrak.hexcasting.datagen.IXplatConditionsBuilder; import at.petrak.hexcasting.datagen.IXplatIngredients; import at.petrak.hexcasting.datagen.recipe.builders.BrainsweepRecipeBuilder; @@ -21,8 +21,6 @@ import at.petrak.hexcasting.datagen.recipe.builders.CompatIngredientValue; import at.petrak.hexcasting.datagen.recipe.builders.CreateCrushingRecipeBuilder; import at.petrak.hexcasting.datagen.recipe.builders.FarmersDelightCuttingRecipeBuilder; import at.petrak.paucal.api.datagen.PaucalRecipeProvider; -import net.minecraft.advancements.critereon.EntityPredicate; -import net.minecraft.advancements.critereon.MinMaxBounds; import net.minecraft.core.Registry; import net.minecraft.data.DataGenerator; import net.minecraft.data.recipes.*; @@ -171,36 +169,35 @@ public class HexplatRecipes extends PaucalRecipeProvider { gayRecipe(recipes, ItemPrideColorizer.Type.TRANSGENDER, Ingredient.of(Items.EGG)); ShapedRecipeBuilder.shaped(HexItems.UUID_COLORIZER) - .define('B', Items.BOWL) .define('D', HexItems.AMETHYST_DUST) .define('C', Items.AMETHYST_SHARD) - .pattern(" C ") .pattern(" D ") - .pattern(" B ") + .pattern("DCD") + .pattern(" D ") .unlockedBy("has_item", hasItem(HexItems.AMETHYST_DUST)).save(recipes); ShapedRecipeBuilder.shaped(HexItems.SCROLL_SMOL) .define('P', Items.PAPER) - .define('A', Items.AMETHYST_SHARD) + .define('A', HexItems.AMETHYST_DUST) .pattern(" A") .pattern("P ") - .unlockedBy("has_item", hasItem(Items.AMETHYST_SHARD)).save(recipes); + .unlockedBy("has_item", hasItem(HexTags.Items.STAVES)).save(recipes); ShapedRecipeBuilder.shaped(HexItems.SCROLL_MEDIUM) .define('P', Items.PAPER) - .define('A', Items.AMETHYST_SHARD) + .define('A', HexItems.AMETHYST_DUST) .pattern(" A") .pattern("PP ") .pattern("PP ") - .unlockedBy("has_item", hasItem(Items.AMETHYST_SHARD)).save(recipes); + .unlockedBy("has_item", hasItem(HexTags.Items.STAVES)).save(recipes); ShapedRecipeBuilder.shaped(HexItems.SCROLL_LARGE) .define('P', Items.PAPER) - .define('A', Items.AMETHYST_SHARD) + .define('A', HexItems.AMETHYST_DUST) .pattern("PPA") .pattern("PPP") .pattern("PPP") - .unlockedBy("has_item", hasItem(Items.AMETHYST_SHARD)).save(recipes); + .unlockedBy("has_item", hasItem(HexTags.Items.STAVES)).save(recipes); ShapedRecipeBuilder.shaped(HexItems.SLATE, 6) .define('S', Items.DEEPSLATE) @@ -325,13 +322,7 @@ public class HexplatRecipes extends PaucalRecipeProvider { .requires(HexTags.Items.EDIFIED_PLANKS) .unlockedBy("has_item", hasItem(HexTags.Items.EDIFIED_PLANKS)).save(recipes); - // TODO: probably should have some constant enlightenment trigger somewhere - var enlightenment = new OvercastTrigger.Instance( - EntityPredicate.Composite.ANY, - MinMaxBounds.Ints.ANY, // add a little bit of slop here - MinMaxBounds.Doubles.atLeast(0.8), - MinMaxBounds.Doubles.between(0.1, 2.05) - ); + var enlightenment = HexAdvancements.ENLIGHTEN; ShapedRecipeBuilder.shaped(HexBlocks.EMPTY_IMPETUS) .define('B', Items.IRON_BARS) .define('A', HexItems.CHARGED_AMETHYST) @@ -361,12 +352,14 @@ public class HexplatRecipes extends PaucalRecipeProvider { .pattern("LPL") .unlockedBy("enlightenment", enlightenment).save(recipes); - ShapedRecipeBuilder.shaped(HexBlocks.AKASHIC_LIGATURE) + ShapedRecipeBuilder.shaped(HexBlocks.AKASHIC_LIGATURE, 4) .define('L', HexTags.Items.EDIFIED_LOGS) .define('P', HexTags.Items.EDIFIED_PLANKS) - .define('C', HexItems.CHARGED_AMETHYST) + .define('1', HexItems.AMETHYST_DUST) + .define('2', Items.AMETHYST_SHARD) + .define('3', HexItems.CHARGED_AMETHYST) .pattern("LPL") - .pattern("CCC") + .pattern("123") .pattern("LPL") .unlockedBy("enlightenment", enlightenment).save(recipes); diff --git a/Fabric/src/generated/resources/.cache/03e4de26f1265135874f8cdcaebc09d9c08eb42b b/Fabric/src/generated/resources/.cache/03e4de26f1265135874f8cdcaebc09d9c08eb42b index fb837374..4c465521 100644 --- a/Fabric/src/generated/resources/.cache/03e4de26f1265135874f8cdcaebc09d9c08eb42b +++ b/Fabric/src/generated/resources/.cache/03e4de26f1265135874f8cdcaebc09d9c08eb42b @@ -1,4 +1,4 @@ -// 1.19.2 2023-01-22T12:42:43.342254542 Tags for minecraft:item +// 1.19.2 2023-01-22T20:01:15.102275514 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 479335ce..06443f8e 100644 --- a/Fabric/src/generated/resources/.cache/67cce32b1c3cbbcb1f646605f4914e3f196986c2 +++ b/Fabric/src/generated/resources/.cache/67cce32b1c3cbbcb1f646605f4914e3f196986c2 @@ -1,4 +1,4 @@ -// 1.19.2 2023-01-22T12:42:43.346904818 LootTables +// 1.19.2 2023-01-22T20:01:15.106418886 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 0a28641c..47ff92eb 100644 --- a/Fabric/src/generated/resources/.cache/75bcd4dba6ca7d365462b0ec45e291d1056349c4 +++ b/Fabric/src/generated/resources/.cache/75bcd4dba6ca7d365462b0ec45e291d1056349c4 @@ -1,4 +1,4 @@ -// 1.19.2 2023-01-22T12:42:43.346084202 Tags for minecraft:block +// 1.19.2 2023-01-22T20:01:15.101152195 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 991ab707..dfb78b05 100644 --- a/Fabric/src/generated/resources/.cache/844611d4af49e23072b8a888c8e73c6c5d8c0768 +++ b/Fabric/src/generated/resources/.cache/844611d4af49e23072b8a888c8e73c6c5d8c0768 @@ -1,4 +1,4 @@ -// 1.19.2 2023-01-22T12:42:43.353710487 Tags for hexcasting:action +// 1.19.2 2023-01-22T20:01:15.100005619 Tags for hexcasting:action e5afc567ea17f035e4eb1d1d48825100b7f6ad68 data/hexcasting/tags/action/per_world_pattern.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 7f023349..b852d2ab 100644 --- a/Fabric/src/generated/resources/.cache/9fb1092f32d4fcbf9e061ffd718d4ec689c6c95e +++ b/Fabric/src/generated/resources/.cache/9fb1092f32d4fcbf9e061ffd718d4ec689c6c95e @@ -1,28 +1,28 @@ -// 1.19.2 2023-01-22T12:42:43.349741357 Recipes +// 1.19.2 2023-01-22T20:01:15.102891719 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 04569ccadfd99f203b0485d0c3e877209290f2b3 data/hexcasting/advancements/recipes/hexcasting.creative_tab/dye_colorizer_pink.json 0101f5c24d8beedcc884ce87b052ad4f6884ddc4 data/hexcasting/recipes/akashic_bookshelf.json -f58700261f72cf87acacf1df0f163890c8b7ae00 data/hexcasting/advancements/recipes/brainsweep/brainsweep/directrix_redstone.json +2a9d4a0f3618abf9e9b8699b318a984d2c836913 data/hexcasting/advancements/recipes/brainsweep/brainsweep/directrix_redstone.json 1b510d32bad1a51ad6795fb8e7702d34c8c8cfbe data/hexcasting/advancements/recipes/hexcasting.creative_tab/dye_colorizer_green.json d73e5d8fec4d3f7d15888bd292f4ad9c1b37cac5 data/hexcasting/advancements/recipes/hexcasting.creative_tab/ageing_scroll_paper_lantern.json b54339a9e990419e4820491001c4cbdb7aa9fddb data/hexcasting/recipes/artifact.json -c3f9cca50935f7abf141825d78b441033fc0dab8 data/hexcasting/advancements/recipes/hexcasting.creative_tab/scroll.json +bfca15c4ef7bea4704d062c3ab690e23887e55b0 data/hexcasting/advancements/recipes/hexcasting.creative_tab/scroll.json ef5a19ab2710fd0ce836d767588fe6a54a528a48 data/hexcasting/recipes/dye_colorizer_white.json 768d70365c56ef1fbad089d3e3fd68548f964227 data/hexcasting/recipes/dye_colorizer_black.json dfb42a8b723b37df5c8888bdef86a1be35f2de72 data/hexcasting/recipes/pride_colorizer_bisexual.json 605f921a98b5dabbd80bc762070916e7d6756df6 data/hexcasting/advancements/recipes/hexcasting.creative_tab/dye_colorizer_orange.json 17aa26ce6bc9941d1477dee99e514fd66be7f664 data/hexcasting/recipes/pride_colorizer_aroace.json 6978ff90efdd067940caccdd29437d2aefd0fe1f data/hexcasting/recipes/scroll_paper.json -8d6f58c45be52e22559fdbc2806ee48ab40d133c data/hexcasting/advancements/recipes/brainsweep/brainsweep/akashic_record.json +229931adf8d62f659de5950d711afd24fb5aa535 data/hexcasting/advancements/recipes/brainsweep/brainsweep/akashic_record.json 1754e1304908edf58a70fe8548f9d0ede22a1dd3 data/hexcasting/recipes/pride_colorizer_pansexual.json -92d5ec5ddf2b35cc59f5bfe389f80443e7ee1ff8 data/hexcasting/recipes/uuid_colorizer.json +ffba0344dfc7f604e8e33a333549f74c53f3e7e6 data/hexcasting/recipes/uuid_colorizer.json d684142c75bee35e6035d1829e271704d4ccdff3 data/hexcasting/advancements/recipes/hexcasting.creative_tab/pride_colorizer_lesbian.json dfc171097bdd8a8f280e6787ea999286deda643e data/hexcasting/advancements/recipes/hexcasting.creative_tab/focus.json e6ba57745f6841c2dcb537ada2475e880ea25186 data/hexcasting/recipes/dye_colorizer_green.json a3c7f19df257ee07f0894708b48438fdf3b14a47 data/hexcasting/advancements/recipes/hexcasting.creative_tab/dye_colorizer_black.json -b9202eb55254abe6cbffc6ce73ba9dcf36a84ffe data/hexcasting/advancements/recipes/brainsweep/brainsweep/budding_amethyst.json +15608e5929da4801fc933e79a9e37419ce60e18d data/hexcasting/advancements/recipes/brainsweep/brainsweep/budding_amethyst.json a776209b64fea520f6a2fff9f1623e7086939dd9 data/hexcasting/recipes/jungle_staff.json 4ffed306e5f640054a6f269ae0e548388f087996 data/hexcasting/recipes/warped_staff.json 2b16fb3f6b4e4e31c5c507e6c0535bd12c7c63a1 data/hexcasting/recipes/dye_colorizer_brown.json @@ -56,13 +56,13 @@ f8e027860b2505a7217d1264c5d0b6f7feea0679 data/hexcasting/advancements/recipes/he 63da3af421dfb38283d750eb3b9761f42e95fb91 data/hexcasting/advancements/recipes/hexcasting.creative_tab/stripped_edified_wood.json 24984d728a5c05967c58be9c0dc1c59e986602e6 data/hexcasting/recipes/brainsweep/impetus_storedplayer.json 326925a948aeb17aabafbc25ed2562a257796d29 data/hexcasting/recipes/dye_colorizer_yellow.json -2a1021614882392be78d22cb557e43cbbd9092ca data/hexcasting/advancements/recipes/brainsweep/brainsweep/impetus_rightclick.json +9f55e6ff1f2633e4ad390868e7952b700e5309a4 data/hexcasting/advancements/recipes/brainsweep/brainsweep/impetus_rightclick.json 4440b41499c9c32e297dc184c39da010ff82ac5e data/hexcasting/advancements/recipes/hexcasting.creative_tab/uuid_colorizer.json 5a90084c03d6e8424872870c8b65f4771b447f03 data/hexcasting/recipes/brainsweep/budding_amethyst.json 6e6c73a93e0e06ff399d95e40baf4e06f3a25a0a data/hexcasting/advancements/recipes/hexcasting.creative_tab/slate_block_from_slates.json 3662834d6e0bac03aba28f0f9d9f07f511492118 data/hexcasting/recipes/lens.json -4ba0fcb9b3142029c36cc48b250b89b0cac3f6de data/hexcasting/recipes/akashic_connector.json -eaba34eebb8cb0d8d752ab1d574752e651626c24 data/hexcasting/advancements/recipes/brainsweep/brainsweep/testing/flowey_the_flower.json +638c534059597cebb9dc1e927c76a2809ddbfd42 data/hexcasting/recipes/akashic_connector.json +afbeab63d6f09200c91014b0ba2570ed2a29fc52 data/hexcasting/advancements/recipes/brainsweep/brainsweep/testing/flowey_the_flower.json 1c5681b6bf354ce068c51852b51a5aba9ac2d8f9 data/hexcasting/recipes/compat/create/crushing/amethyst_shard.json 336465276c06fc59be003ccad3d6fc121fa438f5 data/hexcasting/recipes/edified_staff.json 1086a6e3f284fc3b575ee3a21d2b13d0bc62d2bb data/hexcasting/recipes/brainsweep/impetus_rightclick.json @@ -73,10 +73,10 @@ a331f4ce9b8d3565cbb154af4d63279f1e2c7a41 data/hexcasting/recipes/compat/farmersd 108421ab59fc52c69913676abda5e0a045fe1b04 data/hexcasting/recipes/pride_colorizer_gay.json f75c21d35b926a2303d60115a297c387790bbbd9 data/hexcasting/advancements/recipes/hexcasting.creative_tab/edified_trapdoor.json 3b83dd1c1aa1bcc58e6512bca75c3a6a3b7482b3 data/hexcasting/recipes/edified_tile.json -7ae2bd282afbf2f460a6bb705fe301a2a11d7835 data/hexcasting/advancements/recipes/hexcasting.creative_tab/akashic_connector.json +ceab17c3df28bb48bc9d99097051c601f5b981f5 data/hexcasting/advancements/recipes/hexcasting.creative_tab/akashic_connector.json d603560d9bbe0bd3e9c0ca5cd502fe874337599e data/hexcasting/advancements/recipes/hexcasting.creative_tab/dye_colorizer_light_gray.json 0ee8d29cb06065a55017a8fc50576193107f958d data/hexcasting/recipes/dynamicseal_focus.json -da3c95902e93fe82e489ceccc84a56159329e091 data/hexcasting/advancements/recipes/brainsweep/brainsweep/impetus_look.json +f48c2df6c0981b959c2e1b0bf8ecc4739b2e034f data/hexcasting/advancements/recipes/brainsweep/brainsweep/impetus_look.json 8c49c1c022cee20fb2a44046425b48cd0e6659af data/hexcasting/advancements/recipes/hexcasting.creative_tab/birch_staff.json 12e1ba1ec29bf0eadf1210d2307fab35e9685085 data/hexcasting/recipes/empty_directrix.json 898319b3a4ee7a8d7bd7a4af0313593561ed657e data/hexcasting/advancements/recipes/hexcasting.creative_tab/scroll_paper.json @@ -84,7 +84,7 @@ da3c95902e93fe82e489ceccc84a56159329e091 data/hexcasting/advancements/recipes/br 64f509c0496204d39c38a4a64a1fbe0f84b9e5ae data/hexcasting/advancements/recipes/hexcasting.creative_tab/dye_colorizer_magenta.json aa6c75e8834d47b0a144dac7b6448cbaecb7df44 data/hexcasting/recipes/pride_colorizer_aromantic.json a16ce751797baf92c3dd3f125b564e789aeec260 data/hexcasting/advancements/recipes/hexcasting.creative_tab/edified_planks.json -c8ff04819448a3efb2c031e06045be761db6a2f1 data/hexcasting/advancements/recipes/hexcasting.creative_tab/scroll_medium.json +7df149b266e4f7925defd3b017163698070dbcb9 data/hexcasting/advancements/recipes/hexcasting.creative_tab/scroll_medium.json dc2a9bf96ca9d04ea6bdeb32249322530b5e1cbf data/hexcasting/advancements/recipes/hexcasting.creative_tab/warped_staff.json b62b3b67e6a105e1eb47d04c2ededd8d408df7b7 data/hexcasting/advancements/recipes/hexcasting.creative_tab/ancient_scroll_paper.json 1ba5dada44ad7c008756f0e8e7adfe30e2520239 data/hexcasting/recipes/dye_colorizer_lime.json @@ -94,18 +94,18 @@ b494dc17959c76857f25368eb845e58e4f8bca92 data/hexcasting/recipes/compat/farmersd 4bff4a59e32c6d1d99bc3a8abd16cd88c51a8e73 data/hexcasting/recipes/dye_colorizer_orange.json cba5ffa7cd89116aba040956f4a85073cedd39cf data/hexcasting/recipes/mangrove_staff.json 1f04d75a1c713d3c5ac44e62889ce834f12d6234 data/hexcasting/recipes/jeweler_hammer.json -0de6f2437a3c33a92de2f3e6b7ac6102996c8779 data/hexcasting/advancements/recipes/brainsweep/brainsweep/testing/bad_to_the_bone.json +4565df318c12afe89322d2459c06bdfc34901679 data/hexcasting/advancements/recipes/brainsweep/brainsweep/testing/bad_to_the_bone.json 8a9e7aa8d07556649768729348dff5305b84e1b9 data/hexcasting/recipes/edified_door.json e52dbfc2d86bb3e87ff554fc8d5f0d43b7ff334a data/hexcasting/advancements/recipes/hexcasting.creative_tab/dye_colorizer_gray.json b6d6716724729f0530a524f92d7e4646455de344 data/hexcasting/advancements/recipes/hexcasting.creative_tab/dye_colorizer_red.json 993a613fabd0ee1005bde11ebe92f8046351ba9e data/hexcasting/advancements/recipes/hexcasting.creative_tab/trinket.json -b2496e7ff3b631a148de37896eeb7dbcd2cbf04a data/hexcasting/recipes/scroll_medium.json -6e8ba1635146314810ce9181c83024c0c0a931f7 data/hexcasting/advancements/recipes/hexcasting.creative_tab/akashic_bookshelf.json +2e02e371ed43f72f101588ce4fa6e7ac8b5ef471 data/hexcasting/recipes/scroll_medium.json +99ebed784d731042da34187b829e1b9560cbebb2 data/hexcasting/advancements/recipes/hexcasting.creative_tab/akashic_bookshelf.json bd3e10b3d468e48e72ad060b9eb0b9f8f4057bf1 data/hexcasting/recipes/ageing_scroll_paper_lantern.json 5627128775e24fb6281a0576a931cfa88a909bc0 data/hexcasting/recipes/slate_block_from_slates.json 6aa3e7825025d055a70a58acd4fd48eef0480721 data/hexcasting/recipes/edified_wood.json 783c691f24bc4259ba5da014133763dce26ee4bd data/hexcasting/recipes/crimson_staff.json -437f92b83317beda07c55c122224e6740573a05e data/hexcasting/recipes/scroll.json +446b5adea918e25bb93959fe381e4c8f3fe789f5 data/hexcasting/recipes/scroll.json 6479526ac6b8732814ea3feb97e877896c17f7b7 data/hexcasting/recipes/edified_trapdoor.json 0cb3e2e6e0be9f53811f24ad43bf711d07560210 data/hexcasting/advancements/recipes/hexcasting.creative_tab/acacia_staff.json 6641b22c79fa29fab15d414afecabd3aa7402b38 data/hexcasting/advancements/recipes/hexcasting.creative_tab/scroll_paper_lantern.json @@ -118,13 +118,13 @@ c93cecd3f883e57f3cce7ad3d6aad44000ed541c data/hexcasting/recipes/ancient_scroll_ ba08fd11d19f54c504ceed6f162a5d814e03d1e8 data/hexcasting/recipes/brainsweep/testing/flowey_the_flower.json 12d9ec588869179a8e8a1f4bce718175d57e4a71 data/create/recipes/crushing/amethyst_block.json ab26481b45a7f463e2225b9a04d24a1b4d84daef data/hexcasting/recipes/abacus.json -fccc3e05b011e1fd1a41a0bfca11876d0fb16df2 data/hexcasting/advancements/recipes/hexcasting.creative_tab/scroll_small.json +2e943ea3077aa46f16d78c04ab417677fc326e78 data/hexcasting/advancements/recipes/hexcasting.creative_tab/scroll_small.json 38e7b64a4a15f1ce496f8c156d7262426f98fbcc data/hexcasting/recipes/acacia_staff.json 6a9a89cfa34732437996431a9c885332cf714449 data/hexcasting/advancements/recipes/hexcasting.creative_tab/mangrove_staff.json 7c7888ba95d1e2e8620a916df546a2b06b592d37 data/hexcasting/recipes/edified_planks.json 0d08dab8c9700c7b5b32ad35e7b665a2e3c2cdc7 data/hexcasting/advancements/recipes/hexcasting.creative_tab/artifact.json 0859373b9e60e80f3c8b0962a3bc94903af43d36 data/hexcasting/recipes/stripped_edified_wood.json -414d605b72164240bc308444c48ed03571cc0d61 data/hexcasting/advancements/recipes/hexcasting.creative_tab/empty_directrix.json +01f8281d0b4b1fa7116989c9a01d71a3312d8d11 data/hexcasting/advancements/recipes/hexcasting.creative_tab/empty_directrix.json e687ceab424098d586f0b67a34fe65bee1f4dfca data/hexcasting/advancements/recipes/hexcasting.creative_tab/dye_colorizer_blue.json 013a4b5603757f8610709428dad8de79bd9bd590 data/hexcasting/recipes/dye_colorizer_pink.json 202e70722198141d5dd961bb087a25873e4928af data/hexcasting/recipes/edified_stairs.json @@ -132,7 +132,7 @@ e687ceab424098d586f0b67a34fe65bee1f4dfca data/hexcasting/advancements/recipes/he b640608755649a8bde55a434016b14522fa6d2e0 data/hexcasting/advancements/recipes/hexcasting.creative_tab/edified_wood.json d323e21de69d0606d1fac03fa8820e5857e4e1f1 data/hexcasting/recipes/dynamicseal_spellbook.json e0e49c8a9977fe2b0619179b11a4379b5b19ace9 data/hexcasting/advancements/recipes/hexcasting.creative_tab/sub_sandwich.json -b2dc08cc62b9a36d6b034aead99e0b328b5efecb data/hexcasting/recipes/scroll_small.json +08c200b6d3a3aacb434112aacab9851e7d5f6083 data/hexcasting/recipes/scroll_small.json e3416c3e103fe206cbaa352eb5011f81ccfc6aca data/hexcasting/recipes/slate.json 0b8a01eab5d4ce90974c6c53b6d397f8e9398385 data/hexcasting/recipes/slate_block.json bb42a28d7b19f8f8057630f0d2e99b371e93126a data/hexcasting/advancements/recipes/hexcasting.creative_tab/dye_colorizer_light_blue.json @@ -168,7 +168,7 @@ b7fc41f8cfd83a0d138290251d63bb6cc04e0f9a data/hexcasting/recipes/edified_pressur a58f37bc66e65c1ac00ba7dbc4d9a7b902f42aad data/hexcasting/advancements/recipes/hexcasting.creative_tab/oak_staff.json 13d03da2cfee5c29e5432806189e18eeefb76e11 data/hexcasting/advancements/recipes/hexcasting.creative_tab/pride_colorizer_gay.json fc0476880c79cf4458dd5b24f77fc980b02534d2 data/hexcasting/recipes/edified_button.json -a22233090497e1c44082b6eb16ad079d9acc8f7c data/hexcasting/advancements/recipes/brainsweep/brainsweep/impetus_storedplayer.json +fc7fe64799c10482c01aaf467c6447503d3ffb70 data/hexcasting/advancements/recipes/brainsweep/brainsweep/impetus_storedplayer.json aa4a00864f1b22835612fe60a4715250f3ab2126 data/hexcasting/advancements/recipes/hexcasting.creative_tab/edified_panel.json 6f5ee50706640e9be82810e22388fc7b2bce13b1 data/hexcasting/recipes/birch_staff.json e35c89ccc099c511c9ab321a7490d35f2e8c9353 data/hexcasting/advancements/recipes/hexcasting.creative_tab/amethyst_dust_packing.json @@ -188,5 +188,5 @@ bc91b7e096d8a0033916101f21fa43c06b343e86 data/hexcasting/recipes/dye_colorizer_r c9c2b33afc4b5de1f10df08d901312ee1ded1c5e data/hexcasting/advancements/recipes/hexcasting.creative_tab/pride_colorizer_pansexual.json fa49dab810cff4f827d2662a93fc3439a8e99cba data/hexcasting/recipes/pride_colorizer_genderqueer.json 25df58c8b78028142c47deb060768d4fbfe2c38e data/hexcasting/advancements/recipes/hexcasting.creative_tab/pride_colorizer_nonbinary.json -28fa66705fcd6dbfa46ec76602497441cde579ef data/hexcasting/advancements/recipes/hexcasting.creative_tab/empty_impetus.json +3db193fa4246ffa5bbfa45ce901bbfaeada0a942 data/hexcasting/advancements/recipes/hexcasting.creative_tab/empty_impetus.json 182c2b5dd406c80ed957e1b43d554cce1b212d28 data/hexcasting/advancements/recipes/hexcasting.creative_tab/jungle_staff.json diff --git a/Fabric/src/generated/resources/data/hexcasting/advancements/recipes/brainsweep/brainsweep/akashic_record.json b/Fabric/src/generated/resources/data/hexcasting/advancements/recipes/brainsweep/brainsweep/akashic_record.json index 51781ecf..84c4996f 100644 --- a/Fabric/src/generated/resources/data/hexcasting/advancements/recipes/brainsweep/brainsweep/akashic_record.json +++ b/Fabric/src/generated/resources/data/hexcasting/advancements/recipes/brainsweep/brainsweep/akashic_record.json @@ -7,8 +7,8 @@ "min": 0.8 }, "mojang_i_am_begging_and_crying_please_add_an_entity_health_criterion": { - "max": 2.05, - "min": 0.1 + "max": 1.0, + "min": 2.2250738585072014E-308 } }, "trigger": "hexcasting:overcast" diff --git a/Fabric/src/generated/resources/data/hexcasting/advancements/recipes/brainsweep/brainsweep/budding_amethyst.json b/Fabric/src/generated/resources/data/hexcasting/advancements/recipes/brainsweep/brainsweep/budding_amethyst.json index 98cd1c55..7eb634f3 100644 --- a/Fabric/src/generated/resources/data/hexcasting/advancements/recipes/brainsweep/brainsweep/budding_amethyst.json +++ b/Fabric/src/generated/resources/data/hexcasting/advancements/recipes/brainsweep/brainsweep/budding_amethyst.json @@ -7,8 +7,8 @@ "min": 0.8 }, "mojang_i_am_begging_and_crying_please_add_an_entity_health_criterion": { - "max": 2.05, - "min": 0.1 + "max": 1.0, + "min": 2.2250738585072014E-308 } }, "trigger": "hexcasting:overcast" diff --git a/Fabric/src/generated/resources/data/hexcasting/advancements/recipes/brainsweep/brainsweep/directrix_redstone.json b/Fabric/src/generated/resources/data/hexcasting/advancements/recipes/brainsweep/brainsweep/directrix_redstone.json index 64eef6d9..d13bfdd2 100644 --- a/Fabric/src/generated/resources/data/hexcasting/advancements/recipes/brainsweep/brainsweep/directrix_redstone.json +++ b/Fabric/src/generated/resources/data/hexcasting/advancements/recipes/brainsweep/brainsweep/directrix_redstone.json @@ -7,8 +7,8 @@ "min": 0.8 }, "mojang_i_am_begging_and_crying_please_add_an_entity_health_criterion": { - "max": 2.05, - "min": 0.1 + "max": 1.0, + "min": 2.2250738585072014E-308 } }, "trigger": "hexcasting:overcast" diff --git a/Fabric/src/generated/resources/data/hexcasting/advancements/recipes/brainsweep/brainsweep/impetus_look.json b/Fabric/src/generated/resources/data/hexcasting/advancements/recipes/brainsweep/brainsweep/impetus_look.json index c170998f..73c3ff4a 100644 --- a/Fabric/src/generated/resources/data/hexcasting/advancements/recipes/brainsweep/brainsweep/impetus_look.json +++ b/Fabric/src/generated/resources/data/hexcasting/advancements/recipes/brainsweep/brainsweep/impetus_look.json @@ -7,8 +7,8 @@ "min": 0.8 }, "mojang_i_am_begging_and_crying_please_add_an_entity_health_criterion": { - "max": 2.05, - "min": 0.1 + "max": 1.0, + "min": 2.2250738585072014E-308 } }, "trigger": "hexcasting:overcast" diff --git a/Fabric/src/generated/resources/data/hexcasting/advancements/recipes/brainsweep/brainsweep/impetus_rightclick.json b/Fabric/src/generated/resources/data/hexcasting/advancements/recipes/brainsweep/brainsweep/impetus_rightclick.json index 7363fb48..a5659135 100644 --- a/Fabric/src/generated/resources/data/hexcasting/advancements/recipes/brainsweep/brainsweep/impetus_rightclick.json +++ b/Fabric/src/generated/resources/data/hexcasting/advancements/recipes/brainsweep/brainsweep/impetus_rightclick.json @@ -7,8 +7,8 @@ "min": 0.8 }, "mojang_i_am_begging_and_crying_please_add_an_entity_health_criterion": { - "max": 2.05, - "min": 0.1 + "max": 1.0, + "min": 2.2250738585072014E-308 } }, "trigger": "hexcasting:overcast" diff --git a/Fabric/src/generated/resources/data/hexcasting/advancements/recipes/brainsweep/brainsweep/impetus_storedplayer.json b/Fabric/src/generated/resources/data/hexcasting/advancements/recipes/brainsweep/brainsweep/impetus_storedplayer.json index a1ac2cb7..04916925 100644 --- a/Fabric/src/generated/resources/data/hexcasting/advancements/recipes/brainsweep/brainsweep/impetus_storedplayer.json +++ b/Fabric/src/generated/resources/data/hexcasting/advancements/recipes/brainsweep/brainsweep/impetus_storedplayer.json @@ -7,8 +7,8 @@ "min": 0.8 }, "mojang_i_am_begging_and_crying_please_add_an_entity_health_criterion": { - "max": 2.05, - "min": 0.1 + "max": 1.0, + "min": 2.2250738585072014E-308 } }, "trigger": "hexcasting:overcast" diff --git a/Fabric/src/generated/resources/data/hexcasting/advancements/recipes/brainsweep/brainsweep/testing/bad_to_the_bone.json b/Fabric/src/generated/resources/data/hexcasting/advancements/recipes/brainsweep/brainsweep/testing/bad_to_the_bone.json index edd1db8e..f1051911 100644 --- a/Fabric/src/generated/resources/data/hexcasting/advancements/recipes/brainsweep/brainsweep/testing/bad_to_the_bone.json +++ b/Fabric/src/generated/resources/data/hexcasting/advancements/recipes/brainsweep/brainsweep/testing/bad_to_the_bone.json @@ -7,8 +7,8 @@ "min": 0.8 }, "mojang_i_am_begging_and_crying_please_add_an_entity_health_criterion": { - "max": 2.05, - "min": 0.1 + "max": 1.0, + "min": 2.2250738585072014E-308 } }, "trigger": "hexcasting:overcast" diff --git a/Fabric/src/generated/resources/data/hexcasting/advancements/recipes/brainsweep/brainsweep/testing/flowey_the_flower.json b/Fabric/src/generated/resources/data/hexcasting/advancements/recipes/brainsweep/brainsweep/testing/flowey_the_flower.json index 7b01dd50..9d0da247 100644 --- a/Fabric/src/generated/resources/data/hexcasting/advancements/recipes/brainsweep/brainsweep/testing/flowey_the_flower.json +++ b/Fabric/src/generated/resources/data/hexcasting/advancements/recipes/brainsweep/brainsweep/testing/flowey_the_flower.json @@ -7,8 +7,8 @@ "min": 0.8 }, "mojang_i_am_begging_and_crying_please_add_an_entity_health_criterion": { - "max": 2.05, - "min": 0.1 + "max": 1.0, + "min": 2.2250738585072014E-308 } }, "trigger": "hexcasting:overcast" diff --git a/Fabric/src/generated/resources/data/hexcasting/advancements/recipes/hexcasting.creative_tab/akashic_bookshelf.json b/Fabric/src/generated/resources/data/hexcasting/advancements/recipes/hexcasting.creative_tab/akashic_bookshelf.json index 44d1fc1c..8dd9e2dc 100644 --- a/Fabric/src/generated/resources/data/hexcasting/advancements/recipes/hexcasting.creative_tab/akashic_bookshelf.json +++ b/Fabric/src/generated/resources/data/hexcasting/advancements/recipes/hexcasting.creative_tab/akashic_bookshelf.json @@ -7,8 +7,8 @@ "min": 0.8 }, "mojang_i_am_begging_and_crying_please_add_an_entity_health_criterion": { - "max": 2.05, - "min": 0.1 + "max": 1.0, + "min": 2.2250738585072014E-308 } }, "trigger": "hexcasting:overcast" diff --git a/Fabric/src/generated/resources/data/hexcasting/advancements/recipes/hexcasting.creative_tab/akashic_connector.json b/Fabric/src/generated/resources/data/hexcasting/advancements/recipes/hexcasting.creative_tab/akashic_connector.json index 9b1c9407..93d5c1a5 100644 --- a/Fabric/src/generated/resources/data/hexcasting/advancements/recipes/hexcasting.creative_tab/akashic_connector.json +++ b/Fabric/src/generated/resources/data/hexcasting/advancements/recipes/hexcasting.creative_tab/akashic_connector.json @@ -7,8 +7,8 @@ "min": 0.8 }, "mojang_i_am_begging_and_crying_please_add_an_entity_health_criterion": { - "max": 2.05, - "min": 0.1 + "max": 1.0, + "min": 2.2250738585072014E-308 } }, "trigger": "hexcasting:overcast" diff --git a/Fabric/src/generated/resources/data/hexcasting/advancements/recipes/hexcasting.creative_tab/empty_directrix.json b/Fabric/src/generated/resources/data/hexcasting/advancements/recipes/hexcasting.creative_tab/empty_directrix.json index b03a1bff..4d17b106 100644 --- a/Fabric/src/generated/resources/data/hexcasting/advancements/recipes/hexcasting.creative_tab/empty_directrix.json +++ b/Fabric/src/generated/resources/data/hexcasting/advancements/recipes/hexcasting.creative_tab/empty_directrix.json @@ -7,8 +7,8 @@ "min": 0.8 }, "mojang_i_am_begging_and_crying_please_add_an_entity_health_criterion": { - "max": 2.05, - "min": 0.1 + "max": 1.0, + "min": 2.2250738585072014E-308 } }, "trigger": "hexcasting:overcast" diff --git a/Fabric/src/generated/resources/data/hexcasting/advancements/recipes/hexcasting.creative_tab/empty_impetus.json b/Fabric/src/generated/resources/data/hexcasting/advancements/recipes/hexcasting.creative_tab/empty_impetus.json index 206f2746..bafe9654 100644 --- a/Fabric/src/generated/resources/data/hexcasting/advancements/recipes/hexcasting.creative_tab/empty_impetus.json +++ b/Fabric/src/generated/resources/data/hexcasting/advancements/recipes/hexcasting.creative_tab/empty_impetus.json @@ -7,8 +7,8 @@ "min": 0.8 }, "mojang_i_am_begging_and_crying_please_add_an_entity_health_criterion": { - "max": 2.05, - "min": 0.1 + "max": 1.0, + "min": 2.2250738585072014E-308 } }, "trigger": "hexcasting:overcast" diff --git a/Fabric/src/generated/resources/data/hexcasting/advancements/recipes/hexcasting.creative_tab/scroll.json b/Fabric/src/generated/resources/data/hexcasting/advancements/recipes/hexcasting.creative_tab/scroll.json index 90810ddb..344b0d90 100644 --- a/Fabric/src/generated/resources/data/hexcasting/advancements/recipes/hexcasting.creative_tab/scroll.json +++ b/Fabric/src/generated/resources/data/hexcasting/advancements/recipes/hexcasting.creative_tab/scroll.json @@ -5,9 +5,7 @@ "conditions": { "items": [ { - "items": [ - "minecraft:amethyst_shard" - ] + "tag": "hexcasting:staves" } ] }, diff --git a/Fabric/src/generated/resources/data/hexcasting/advancements/recipes/hexcasting.creative_tab/scroll_medium.json b/Fabric/src/generated/resources/data/hexcasting/advancements/recipes/hexcasting.creative_tab/scroll_medium.json index 74e7644f..ab07471c 100644 --- a/Fabric/src/generated/resources/data/hexcasting/advancements/recipes/hexcasting.creative_tab/scroll_medium.json +++ b/Fabric/src/generated/resources/data/hexcasting/advancements/recipes/hexcasting.creative_tab/scroll_medium.json @@ -5,9 +5,7 @@ "conditions": { "items": [ { - "items": [ - "minecraft:amethyst_shard" - ] + "tag": "hexcasting:staves" } ] }, diff --git a/Fabric/src/generated/resources/data/hexcasting/advancements/recipes/hexcasting.creative_tab/scroll_small.json b/Fabric/src/generated/resources/data/hexcasting/advancements/recipes/hexcasting.creative_tab/scroll_small.json index a44e7ec6..58534499 100644 --- a/Fabric/src/generated/resources/data/hexcasting/advancements/recipes/hexcasting.creative_tab/scroll_small.json +++ b/Fabric/src/generated/resources/data/hexcasting/advancements/recipes/hexcasting.creative_tab/scroll_small.json @@ -5,9 +5,7 @@ "conditions": { "items": [ { - "items": [ - "minecraft:amethyst_shard" - ] + "tag": "hexcasting:staves" } ] }, diff --git a/Fabric/src/generated/resources/data/hexcasting/recipes/akashic_connector.json b/Fabric/src/generated/resources/data/hexcasting/recipes/akashic_connector.json index 9f80ef91..47b07841 100644 --- a/Fabric/src/generated/resources/data/hexcasting/recipes/akashic_connector.json +++ b/Fabric/src/generated/resources/data/hexcasting/recipes/akashic_connector.json @@ -1,7 +1,13 @@ { "type": "minecraft:crafting_shaped", "key": { - "C": { + "1": { + "item": "hexcasting:amethyst_dust" + }, + "2": { + "item": "minecraft:amethyst_shard" + }, + "3": { "item": "hexcasting:charged_amethyst" }, "L": { @@ -13,10 +19,11 @@ }, "pattern": [ "LPL", - "CCC", + "123", "LPL" ], "result": { + "count": 4, "item": "hexcasting:akashic_connector" } } \ No newline at end of file diff --git a/Fabric/src/generated/resources/data/hexcasting/recipes/scroll.json b/Fabric/src/generated/resources/data/hexcasting/recipes/scroll.json index a94fa920..41b06343 100644 --- a/Fabric/src/generated/resources/data/hexcasting/recipes/scroll.json +++ b/Fabric/src/generated/resources/data/hexcasting/recipes/scroll.json @@ -2,7 +2,7 @@ "type": "minecraft:crafting_shaped", "key": { "A": { - "item": "minecraft:amethyst_shard" + "item": "hexcasting:amethyst_dust" }, "P": { "item": "minecraft:paper" diff --git a/Fabric/src/generated/resources/data/hexcasting/recipes/scroll_medium.json b/Fabric/src/generated/resources/data/hexcasting/recipes/scroll_medium.json index 41829055..cb9efd06 100644 --- a/Fabric/src/generated/resources/data/hexcasting/recipes/scroll_medium.json +++ b/Fabric/src/generated/resources/data/hexcasting/recipes/scroll_medium.json @@ -2,7 +2,7 @@ "type": "minecraft:crafting_shaped", "key": { "A": { - "item": "minecraft:amethyst_shard" + "item": "hexcasting:amethyst_dust" }, "P": { "item": "minecraft:paper" diff --git a/Fabric/src/generated/resources/data/hexcasting/recipes/scroll_small.json b/Fabric/src/generated/resources/data/hexcasting/recipes/scroll_small.json index 3f2e8b65..bc4da2be 100644 --- a/Fabric/src/generated/resources/data/hexcasting/recipes/scroll_small.json +++ b/Fabric/src/generated/resources/data/hexcasting/recipes/scroll_small.json @@ -2,7 +2,7 @@ "type": "minecraft:crafting_shaped", "key": { "A": { - "item": "minecraft:amethyst_shard" + "item": "hexcasting:amethyst_dust" }, "P": { "item": "minecraft:paper" diff --git a/Fabric/src/generated/resources/data/hexcasting/recipes/uuid_colorizer.json b/Fabric/src/generated/resources/data/hexcasting/recipes/uuid_colorizer.json index dc558516..30d6d41e 100644 --- a/Fabric/src/generated/resources/data/hexcasting/recipes/uuid_colorizer.json +++ b/Fabric/src/generated/resources/data/hexcasting/recipes/uuid_colorizer.json @@ -1,9 +1,6 @@ { "type": "minecraft:crafting_shaped", "key": { - "B": { - "item": "minecraft:bowl" - }, "C": { "item": "minecraft:amethyst_shard" }, @@ -12,9 +9,9 @@ } }, "pattern": [ - " C ", " D ", - " B " + "DCD", + " D " ], "result": { "item": "hexcasting:uuid_colorizer" diff --git a/Forge/src/generated/resources/.cache/9fb1092f32d4fcbf9e061ffd718d4ec689c6c95e b/Forge/src/generated/resources/.cache/9fb1092f32d4fcbf9e061ffd718d4ec689c6c95e index 4e4b63b3..5887c16a 100644 --- a/Forge/src/generated/resources/.cache/9fb1092f32d4fcbf9e061ffd718d4ec689c6c95e +++ b/Forge/src/generated/resources/.cache/9fb1092f32d4fcbf9e061ffd718d4ec689c6c95e @@ -1,19 +1,19 @@ -// 1.19.2 2023-01-22T12:41:48.311183435 Recipes +// 1.19.2 2023-01-22T19:58:44.861340174 Recipes 29056d8bbc023668564ee81f4eb8b2a11411cf4a data/create/recipes/crushing/amethyst_block.json 5bb0b70967a422bfd88c01fa1af64e9b98781fd1 data/create/recipes/crushing/amethyst_cluster.json -8d6f58c45be52e22559fdbc2806ee48ab40d133c data/hexcasting/advancements/recipes/brainsweep/brainsweep/akashic_record.json -b9202eb55254abe6cbffc6ce73ba9dcf36a84ffe data/hexcasting/advancements/recipes/brainsweep/brainsweep/budding_amethyst.json -f58700261f72cf87acacf1df0f163890c8b7ae00 data/hexcasting/advancements/recipes/brainsweep/brainsweep/directrix_redstone.json -da3c95902e93fe82e489ceccc84a56159329e091 data/hexcasting/advancements/recipes/brainsweep/brainsweep/impetus_look.json -2a1021614882392be78d22cb557e43cbbd9092ca data/hexcasting/advancements/recipes/brainsweep/brainsweep/impetus_rightclick.json -a22233090497e1c44082b6eb16ad079d9acc8f7c data/hexcasting/advancements/recipes/brainsweep/brainsweep/impetus_storedplayer.json -0de6f2437a3c33a92de2f3e6b7ac6102996c8779 data/hexcasting/advancements/recipes/brainsweep/brainsweep/testing/bad_to_the_bone.json -eaba34eebb8cb0d8d752ab1d574752e651626c24 data/hexcasting/advancements/recipes/brainsweep/brainsweep/testing/flowey_the_flower.json +229931adf8d62f659de5950d711afd24fb5aa535 data/hexcasting/advancements/recipes/brainsweep/brainsweep/akashic_record.json +15608e5929da4801fc933e79a9e37419ce60e18d data/hexcasting/advancements/recipes/brainsweep/brainsweep/budding_amethyst.json +2a9d4a0f3618abf9e9b8699b318a984d2c836913 data/hexcasting/advancements/recipes/brainsweep/brainsweep/directrix_redstone.json +f48c2df6c0981b959c2e1b0bf8ecc4739b2e034f data/hexcasting/advancements/recipes/brainsweep/brainsweep/impetus_look.json +9f55e6ff1f2633e4ad390868e7952b700e5309a4 data/hexcasting/advancements/recipes/brainsweep/brainsweep/impetus_rightclick.json +fc7fe64799c10482c01aaf467c6447503d3ffb70 data/hexcasting/advancements/recipes/brainsweep/brainsweep/impetus_storedplayer.json +4565df318c12afe89322d2459c06bdfc34901679 data/hexcasting/advancements/recipes/brainsweep/brainsweep/testing/bad_to_the_bone.json +afbeab63d6f09200c91014b0ba2570ed2a29fc52 data/hexcasting/advancements/recipes/brainsweep/brainsweep/testing/flowey_the_flower.json ae2c6392cc0ec104c4e3019e1824a1e7f811f1de data/hexcasting/advancements/recipes/hexcasting/abacus.json 0cb3e2e6e0be9f53811f24ad43bf711d07560210 data/hexcasting/advancements/recipes/hexcasting/acacia_staff.json d73e5d8fec4d3f7d15888bd292f4ad9c1b37cac5 data/hexcasting/advancements/recipes/hexcasting/ageing_scroll_paper_lantern.json -6e8ba1635146314810ce9181c83024c0c0a931f7 data/hexcasting/advancements/recipes/hexcasting/akashic_bookshelf.json -7ae2bd282afbf2f460a6bb705fe301a2a11d7835 data/hexcasting/advancements/recipes/hexcasting/akashic_connector.json +99ebed784d731042da34187b829e1b9560cbebb2 data/hexcasting/advancements/recipes/hexcasting/akashic_bookshelf.json +ceab17c3df28bb48bc9d99097051c601f5b981f5 data/hexcasting/advancements/recipes/hexcasting/akashic_connector.json e35c89ccc099c511c9ab321a7490d35f2e8c9353 data/hexcasting/advancements/recipes/hexcasting/amethyst_dust_packing.json 62bfad9dc29406a9807ea33f866cbdfca32e7d0a data/hexcasting/advancements/recipes/hexcasting/amethyst_dust_unpacking.json 220f4dc7c8f857092bcb85b5ccf8936237ededa4 data/hexcasting/advancements/recipes/hexcasting/amethyst_sconce.json @@ -52,8 +52,8 @@ f45428f892d2064fafa29ea644eea21354e2e322 data/hexcasting/advancements/recipes/he 0ed898da60aa78cd526ff4ae0524359891dbd976 data/hexcasting/advancements/recipes/hexcasting/edified_tile.json f75c21d35b926a2303d60115a297c387790bbbd9 data/hexcasting/advancements/recipes/hexcasting/edified_trapdoor.json b640608755649a8bde55a434016b14522fa6d2e0 data/hexcasting/advancements/recipes/hexcasting/edified_wood.json -414d605b72164240bc308444c48ed03571cc0d61 data/hexcasting/advancements/recipes/hexcasting/empty_directrix.json -28fa66705fcd6dbfa46ec76602497441cde579ef data/hexcasting/advancements/recipes/hexcasting/empty_impetus.json +01f8281d0b4b1fa7116989c9a01d71a3312d8d11 data/hexcasting/advancements/recipes/hexcasting/empty_directrix.json +3db193fa4246ffa5bbfa45ce901bbfaeada0a942 data/hexcasting/advancements/recipes/hexcasting/empty_impetus.json dfc171097bdd8a8f280e6787ea999286deda643e data/hexcasting/advancements/recipes/hexcasting/focus.json 48b6d3429e3536a85f3a0e9585a7d252ae0d57a3 data/hexcasting/advancements/recipes/hexcasting/jeweler_hammer.json 182c2b5dd406c80ed957e1b43d554cce1b212d28 data/hexcasting/advancements/recipes/hexcasting/jungle_staff.json @@ -76,11 +76,11 @@ d684142c75bee35e6035d1829e271704d4ccdff3 data/hexcasting/advancements/recipes/he c9c2b33afc4b5de1f10df08d901312ee1ded1c5e data/hexcasting/advancements/recipes/hexcasting/pride_colorizer_pansexual.json cd22886924e7aaeb62e8f7da0747cc950af9dc32 data/hexcasting/advancements/recipes/hexcasting/pride_colorizer_plural.json be7ceaf2b55525f06178fb09070dfeeef8da1c65 data/hexcasting/advancements/recipes/hexcasting/pride_colorizer_transgender.json -c3f9cca50935f7abf141825d78b441033fc0dab8 data/hexcasting/advancements/recipes/hexcasting/scroll.json -c8ff04819448a3efb2c031e06045be761db6a2f1 data/hexcasting/advancements/recipes/hexcasting/scroll_medium.json +bfca15c4ef7bea4704d062c3ab690e23887e55b0 data/hexcasting/advancements/recipes/hexcasting/scroll.json +7df149b266e4f7925defd3b017163698070dbcb9 data/hexcasting/advancements/recipes/hexcasting/scroll_medium.json 898319b3a4ee7a8d7bd7a4af0313593561ed657e data/hexcasting/advancements/recipes/hexcasting/scroll_paper.json 6641b22c79fa29fab15d414afecabd3aa7402b38 data/hexcasting/advancements/recipes/hexcasting/scroll_paper_lantern.json -fccc3e05b011e1fd1a41a0bfca11876d0fb16df2 data/hexcasting/advancements/recipes/hexcasting/scroll_small.json +2e943ea3077aa46f16d78c04ab417677fc326e78 data/hexcasting/advancements/recipes/hexcasting/scroll_small.json f0a77ba758e649d0c16a8e2d9964d18f95a544f4 data/hexcasting/advancements/recipes/hexcasting/slate.json 5ba498c4c19f74cbb456385bccda96d4a8d1d1cc data/hexcasting/advancements/recipes/hexcasting/slate_block.json 6e6c73a93e0e06ff399d95e40baf4e06f3a25a0a data/hexcasting/advancements/recipes/hexcasting/slate_block_from_slates.json @@ -96,7 +96,7 @@ ab26481b45a7f463e2225b9a04d24a1b4d84daef data/hexcasting/recipes/abacus.json 38e7b64a4a15f1ce496f8c156d7262426f98fbcc data/hexcasting/recipes/acacia_staff.json d2e2b8e86799546638fd3ff90b04acb98732e9f5 data/hexcasting/recipes/ageing_scroll_paper_lantern.json 0101f5c24d8beedcc884ce87b052ad4f6884ddc4 data/hexcasting/recipes/akashic_bookshelf.json -4ba0fcb9b3142029c36cc48b250b89b0cac3f6de data/hexcasting/recipes/akashic_connector.json +638c534059597cebb9dc1e927c76a2809ddbfd42 data/hexcasting/recipes/akashic_connector.json 90088535c8e4d0beb0725878314c49ac8deb373b data/hexcasting/recipes/amethyst_dust_packing.json 5ffea2f9ccbb855ab3f5aca9cb572f57f26619ae data/hexcasting/recipes/amethyst_dust_unpacking.json 4f3d6de41aa70a73cc4ba5f56404ff0030e7eeb5 data/hexcasting/recipes/amethyst_sconce.json @@ -174,11 +174,11 @@ fa49dab810cff4f827d2662a93fc3439a8e99cba data/hexcasting/recipes/pride_colorizer 1754e1304908edf58a70fe8548f9d0ede22a1dd3 data/hexcasting/recipes/pride_colorizer_pansexual.json db105c67babb1ffc1bcad53ed1c98d7eb2fee4b1 data/hexcasting/recipes/pride_colorizer_plural.json dc0fb37084974cf396264d046fa6708338eb0879 data/hexcasting/recipes/pride_colorizer_transgender.json -437f92b83317beda07c55c122224e6740573a05e data/hexcasting/recipes/scroll.json -b2496e7ff3b631a148de37896eeb7dbcd2cbf04a data/hexcasting/recipes/scroll_medium.json +446b5adea918e25bb93959fe381e4c8f3fe789f5 data/hexcasting/recipes/scroll.json +2e02e371ed43f72f101588ce4fa6e7ac8b5ef471 data/hexcasting/recipes/scroll_medium.json 6978ff90efdd067940caccdd29437d2aefd0fe1f data/hexcasting/recipes/scroll_paper.json 36c3ea4547b49c7553e7024192d5ddf6f2163422 data/hexcasting/recipes/scroll_paper_lantern.json -b2dc08cc62b9a36d6b034aead99e0b328b5efecb data/hexcasting/recipes/scroll_small.json +08c200b6d3a3aacb434112aacab9851e7d5f6083 data/hexcasting/recipes/scroll_small.json e3416c3e103fe206cbaa352eb5011f81ccfc6aca data/hexcasting/recipes/slate.json 0b8a01eab5d4ce90974c6c53b6d397f8e9398385 data/hexcasting/recipes/slate_block.json 5627128775e24fb6281a0576a931cfa88a909bc0 data/hexcasting/recipes/slate_block_from_slates.json @@ -188,5 +188,5 @@ f0852056a692d776bf537c821f3d166c2be88bd8 data/hexcasting/recipes/spruce_staff.js 0859373b9e60e80f3c8b0962a3bc94903af43d36 data/hexcasting/recipes/stripped_edified_wood.json 13ca24f9f87a6b34f7717e5c326291079e6db96f data/hexcasting/recipes/sub_sandwich.json 42ab683499c3b0f7ae594879490a37eb6aff9703 data/hexcasting/recipes/trinket.json -92d5ec5ddf2b35cc59f5bfe389f80443e7ee1ff8 data/hexcasting/recipes/uuid_colorizer.json +ffba0344dfc7f604e8e33a333549f74c53f3e7e6 data/hexcasting/recipes/uuid_colorizer.json 4ffed306e5f640054a6f269ae0e548388f087996 data/hexcasting/recipes/warped_staff.json diff --git a/Forge/src/generated/resources/data/hexcasting/advancements/recipes/brainsweep/brainsweep/akashic_record.json b/Forge/src/generated/resources/data/hexcasting/advancements/recipes/brainsweep/brainsweep/akashic_record.json index 51781ecf..84c4996f 100644 --- a/Forge/src/generated/resources/data/hexcasting/advancements/recipes/brainsweep/brainsweep/akashic_record.json +++ b/Forge/src/generated/resources/data/hexcasting/advancements/recipes/brainsweep/brainsweep/akashic_record.json @@ -7,8 +7,8 @@ "min": 0.8 }, "mojang_i_am_begging_and_crying_please_add_an_entity_health_criterion": { - "max": 2.05, - "min": 0.1 + "max": 1.0, + "min": 2.2250738585072014E-308 } }, "trigger": "hexcasting:overcast" diff --git a/Forge/src/generated/resources/data/hexcasting/advancements/recipes/brainsweep/brainsweep/budding_amethyst.json b/Forge/src/generated/resources/data/hexcasting/advancements/recipes/brainsweep/brainsweep/budding_amethyst.json index 98cd1c55..7eb634f3 100644 --- a/Forge/src/generated/resources/data/hexcasting/advancements/recipes/brainsweep/brainsweep/budding_amethyst.json +++ b/Forge/src/generated/resources/data/hexcasting/advancements/recipes/brainsweep/brainsweep/budding_amethyst.json @@ -7,8 +7,8 @@ "min": 0.8 }, "mojang_i_am_begging_and_crying_please_add_an_entity_health_criterion": { - "max": 2.05, - "min": 0.1 + "max": 1.0, + "min": 2.2250738585072014E-308 } }, "trigger": "hexcasting:overcast" diff --git a/Forge/src/generated/resources/data/hexcasting/advancements/recipes/brainsweep/brainsweep/directrix_redstone.json b/Forge/src/generated/resources/data/hexcasting/advancements/recipes/brainsweep/brainsweep/directrix_redstone.json index 64eef6d9..d13bfdd2 100644 --- a/Forge/src/generated/resources/data/hexcasting/advancements/recipes/brainsweep/brainsweep/directrix_redstone.json +++ b/Forge/src/generated/resources/data/hexcasting/advancements/recipes/brainsweep/brainsweep/directrix_redstone.json @@ -7,8 +7,8 @@ "min": 0.8 }, "mojang_i_am_begging_and_crying_please_add_an_entity_health_criterion": { - "max": 2.05, - "min": 0.1 + "max": 1.0, + "min": 2.2250738585072014E-308 } }, "trigger": "hexcasting:overcast" diff --git a/Forge/src/generated/resources/data/hexcasting/advancements/recipes/brainsweep/brainsweep/impetus_look.json b/Forge/src/generated/resources/data/hexcasting/advancements/recipes/brainsweep/brainsweep/impetus_look.json index c170998f..73c3ff4a 100644 --- a/Forge/src/generated/resources/data/hexcasting/advancements/recipes/brainsweep/brainsweep/impetus_look.json +++ b/Forge/src/generated/resources/data/hexcasting/advancements/recipes/brainsweep/brainsweep/impetus_look.json @@ -7,8 +7,8 @@ "min": 0.8 }, "mojang_i_am_begging_and_crying_please_add_an_entity_health_criterion": { - "max": 2.05, - "min": 0.1 + "max": 1.0, + "min": 2.2250738585072014E-308 } }, "trigger": "hexcasting:overcast" diff --git a/Forge/src/generated/resources/data/hexcasting/advancements/recipes/brainsweep/brainsweep/impetus_rightclick.json b/Forge/src/generated/resources/data/hexcasting/advancements/recipes/brainsweep/brainsweep/impetus_rightclick.json index 7363fb48..a5659135 100644 --- a/Forge/src/generated/resources/data/hexcasting/advancements/recipes/brainsweep/brainsweep/impetus_rightclick.json +++ b/Forge/src/generated/resources/data/hexcasting/advancements/recipes/brainsweep/brainsweep/impetus_rightclick.json @@ -7,8 +7,8 @@ "min": 0.8 }, "mojang_i_am_begging_and_crying_please_add_an_entity_health_criterion": { - "max": 2.05, - "min": 0.1 + "max": 1.0, + "min": 2.2250738585072014E-308 } }, "trigger": "hexcasting:overcast" diff --git a/Forge/src/generated/resources/data/hexcasting/advancements/recipes/brainsweep/brainsweep/impetus_storedplayer.json b/Forge/src/generated/resources/data/hexcasting/advancements/recipes/brainsweep/brainsweep/impetus_storedplayer.json index a1ac2cb7..04916925 100644 --- a/Forge/src/generated/resources/data/hexcasting/advancements/recipes/brainsweep/brainsweep/impetus_storedplayer.json +++ b/Forge/src/generated/resources/data/hexcasting/advancements/recipes/brainsweep/brainsweep/impetus_storedplayer.json @@ -7,8 +7,8 @@ "min": 0.8 }, "mojang_i_am_begging_and_crying_please_add_an_entity_health_criterion": { - "max": 2.05, - "min": 0.1 + "max": 1.0, + "min": 2.2250738585072014E-308 } }, "trigger": "hexcasting:overcast" diff --git a/Forge/src/generated/resources/data/hexcasting/advancements/recipes/brainsweep/brainsweep/testing/bad_to_the_bone.json b/Forge/src/generated/resources/data/hexcasting/advancements/recipes/brainsweep/brainsweep/testing/bad_to_the_bone.json index edd1db8e..f1051911 100644 --- a/Forge/src/generated/resources/data/hexcasting/advancements/recipes/brainsweep/brainsweep/testing/bad_to_the_bone.json +++ b/Forge/src/generated/resources/data/hexcasting/advancements/recipes/brainsweep/brainsweep/testing/bad_to_the_bone.json @@ -7,8 +7,8 @@ "min": 0.8 }, "mojang_i_am_begging_and_crying_please_add_an_entity_health_criterion": { - "max": 2.05, - "min": 0.1 + "max": 1.0, + "min": 2.2250738585072014E-308 } }, "trigger": "hexcasting:overcast" diff --git a/Forge/src/generated/resources/data/hexcasting/advancements/recipes/brainsweep/brainsweep/testing/flowey_the_flower.json b/Forge/src/generated/resources/data/hexcasting/advancements/recipes/brainsweep/brainsweep/testing/flowey_the_flower.json index 7b01dd50..9d0da247 100644 --- a/Forge/src/generated/resources/data/hexcasting/advancements/recipes/brainsweep/brainsweep/testing/flowey_the_flower.json +++ b/Forge/src/generated/resources/data/hexcasting/advancements/recipes/brainsweep/brainsweep/testing/flowey_the_flower.json @@ -7,8 +7,8 @@ "min": 0.8 }, "mojang_i_am_begging_and_crying_please_add_an_entity_health_criterion": { - "max": 2.05, - "min": 0.1 + "max": 1.0, + "min": 2.2250738585072014E-308 } }, "trigger": "hexcasting:overcast" diff --git a/Forge/src/generated/resources/data/hexcasting/advancements/recipes/hexcasting/akashic_bookshelf.json b/Forge/src/generated/resources/data/hexcasting/advancements/recipes/hexcasting/akashic_bookshelf.json index 44d1fc1c..8dd9e2dc 100644 --- a/Forge/src/generated/resources/data/hexcasting/advancements/recipes/hexcasting/akashic_bookshelf.json +++ b/Forge/src/generated/resources/data/hexcasting/advancements/recipes/hexcasting/akashic_bookshelf.json @@ -7,8 +7,8 @@ "min": 0.8 }, "mojang_i_am_begging_and_crying_please_add_an_entity_health_criterion": { - "max": 2.05, - "min": 0.1 + "max": 1.0, + "min": 2.2250738585072014E-308 } }, "trigger": "hexcasting:overcast" diff --git a/Forge/src/generated/resources/data/hexcasting/advancements/recipes/hexcasting/akashic_connector.json b/Forge/src/generated/resources/data/hexcasting/advancements/recipes/hexcasting/akashic_connector.json index 9b1c9407..93d5c1a5 100644 --- a/Forge/src/generated/resources/data/hexcasting/advancements/recipes/hexcasting/akashic_connector.json +++ b/Forge/src/generated/resources/data/hexcasting/advancements/recipes/hexcasting/akashic_connector.json @@ -7,8 +7,8 @@ "min": 0.8 }, "mojang_i_am_begging_and_crying_please_add_an_entity_health_criterion": { - "max": 2.05, - "min": 0.1 + "max": 1.0, + "min": 2.2250738585072014E-308 } }, "trigger": "hexcasting:overcast" diff --git a/Forge/src/generated/resources/data/hexcasting/advancements/recipes/hexcasting/empty_directrix.json b/Forge/src/generated/resources/data/hexcasting/advancements/recipes/hexcasting/empty_directrix.json index b03a1bff..4d17b106 100644 --- a/Forge/src/generated/resources/data/hexcasting/advancements/recipes/hexcasting/empty_directrix.json +++ b/Forge/src/generated/resources/data/hexcasting/advancements/recipes/hexcasting/empty_directrix.json @@ -7,8 +7,8 @@ "min": 0.8 }, "mojang_i_am_begging_and_crying_please_add_an_entity_health_criterion": { - "max": 2.05, - "min": 0.1 + "max": 1.0, + "min": 2.2250738585072014E-308 } }, "trigger": "hexcasting:overcast" diff --git a/Forge/src/generated/resources/data/hexcasting/advancements/recipes/hexcasting/empty_impetus.json b/Forge/src/generated/resources/data/hexcasting/advancements/recipes/hexcasting/empty_impetus.json index 206f2746..bafe9654 100644 --- a/Forge/src/generated/resources/data/hexcasting/advancements/recipes/hexcasting/empty_impetus.json +++ b/Forge/src/generated/resources/data/hexcasting/advancements/recipes/hexcasting/empty_impetus.json @@ -7,8 +7,8 @@ "min": 0.8 }, "mojang_i_am_begging_and_crying_please_add_an_entity_health_criterion": { - "max": 2.05, - "min": 0.1 + "max": 1.0, + "min": 2.2250738585072014E-308 } }, "trigger": "hexcasting:overcast" diff --git a/Forge/src/generated/resources/data/hexcasting/advancements/recipes/hexcasting/scroll.json b/Forge/src/generated/resources/data/hexcasting/advancements/recipes/hexcasting/scroll.json index 90810ddb..344b0d90 100644 --- a/Forge/src/generated/resources/data/hexcasting/advancements/recipes/hexcasting/scroll.json +++ b/Forge/src/generated/resources/data/hexcasting/advancements/recipes/hexcasting/scroll.json @@ -5,9 +5,7 @@ "conditions": { "items": [ { - "items": [ - "minecraft:amethyst_shard" - ] + "tag": "hexcasting:staves" } ] }, diff --git a/Forge/src/generated/resources/data/hexcasting/advancements/recipes/hexcasting/scroll_medium.json b/Forge/src/generated/resources/data/hexcasting/advancements/recipes/hexcasting/scroll_medium.json index 74e7644f..ab07471c 100644 --- a/Forge/src/generated/resources/data/hexcasting/advancements/recipes/hexcasting/scroll_medium.json +++ b/Forge/src/generated/resources/data/hexcasting/advancements/recipes/hexcasting/scroll_medium.json @@ -5,9 +5,7 @@ "conditions": { "items": [ { - "items": [ - "minecraft:amethyst_shard" - ] + "tag": "hexcasting:staves" } ] }, diff --git a/Forge/src/generated/resources/data/hexcasting/advancements/recipes/hexcasting/scroll_small.json b/Forge/src/generated/resources/data/hexcasting/advancements/recipes/hexcasting/scroll_small.json index a44e7ec6..58534499 100644 --- a/Forge/src/generated/resources/data/hexcasting/advancements/recipes/hexcasting/scroll_small.json +++ b/Forge/src/generated/resources/data/hexcasting/advancements/recipes/hexcasting/scroll_small.json @@ -5,9 +5,7 @@ "conditions": { "items": [ { - "items": [ - "minecraft:amethyst_shard" - ] + "tag": "hexcasting:staves" } ] }, diff --git a/Forge/src/generated/resources/data/hexcasting/recipes/akashic_connector.json b/Forge/src/generated/resources/data/hexcasting/recipes/akashic_connector.json index 9f80ef91..47b07841 100644 --- a/Forge/src/generated/resources/data/hexcasting/recipes/akashic_connector.json +++ b/Forge/src/generated/resources/data/hexcasting/recipes/akashic_connector.json @@ -1,7 +1,13 @@ { "type": "minecraft:crafting_shaped", "key": { - "C": { + "1": { + "item": "hexcasting:amethyst_dust" + }, + "2": { + "item": "minecraft:amethyst_shard" + }, + "3": { "item": "hexcasting:charged_amethyst" }, "L": { @@ -13,10 +19,11 @@ }, "pattern": [ "LPL", - "CCC", + "123", "LPL" ], "result": { + "count": 4, "item": "hexcasting:akashic_connector" } } \ No newline at end of file diff --git a/Forge/src/generated/resources/data/hexcasting/recipes/scroll.json b/Forge/src/generated/resources/data/hexcasting/recipes/scroll.json index a94fa920..41b06343 100644 --- a/Forge/src/generated/resources/data/hexcasting/recipes/scroll.json +++ b/Forge/src/generated/resources/data/hexcasting/recipes/scroll.json @@ -2,7 +2,7 @@ "type": "minecraft:crafting_shaped", "key": { "A": { - "item": "minecraft:amethyst_shard" + "item": "hexcasting:amethyst_dust" }, "P": { "item": "minecraft:paper" diff --git a/Forge/src/generated/resources/data/hexcasting/recipes/scroll_medium.json b/Forge/src/generated/resources/data/hexcasting/recipes/scroll_medium.json index 41829055..cb9efd06 100644 --- a/Forge/src/generated/resources/data/hexcasting/recipes/scroll_medium.json +++ b/Forge/src/generated/resources/data/hexcasting/recipes/scroll_medium.json @@ -2,7 +2,7 @@ "type": "minecraft:crafting_shaped", "key": { "A": { - "item": "minecraft:amethyst_shard" + "item": "hexcasting:amethyst_dust" }, "P": { "item": "minecraft:paper" diff --git a/Forge/src/generated/resources/data/hexcasting/recipes/scroll_small.json b/Forge/src/generated/resources/data/hexcasting/recipes/scroll_small.json index 3f2e8b65..bc4da2be 100644 --- a/Forge/src/generated/resources/data/hexcasting/recipes/scroll_small.json +++ b/Forge/src/generated/resources/data/hexcasting/recipes/scroll_small.json @@ -2,7 +2,7 @@ "type": "minecraft:crafting_shaped", "key": { "A": { - "item": "minecraft:amethyst_shard" + "item": "hexcasting:amethyst_dust" }, "P": { "item": "minecraft:paper" diff --git a/Forge/src/generated/resources/data/hexcasting/recipes/uuid_colorizer.json b/Forge/src/generated/resources/data/hexcasting/recipes/uuid_colorizer.json index dc558516..30d6d41e 100644 --- a/Forge/src/generated/resources/data/hexcasting/recipes/uuid_colorizer.json +++ b/Forge/src/generated/resources/data/hexcasting/recipes/uuid_colorizer.json @@ -1,9 +1,6 @@ { "type": "minecraft:crafting_shaped", "key": { - "B": { - "item": "minecraft:bowl" - }, "C": { "item": "minecraft:amethyst_shard" }, @@ -12,9 +9,9 @@ } }, "pattern": [ - " C ", " D ", - " B " + "DCD", + " D " ], "result": { "item": "hexcasting:uuid_colorizer" From 7e3cdb2f1a07c42372f92fd21da676886ae2df87 Mon Sep 17 00:00:00 2001 From: "petrak@" Date: Sun, 22 Jan 2023 20:08:49 -0600 Subject: [PATCH 56/95] fix bad loc on jei pat recipes --- .../hexcasting/forge/interop/jei/BrainsweepRecipeCategory.java | 2 +- .../hexcasting/forge/interop/jei/EdifyRecipeCategory.java | 2 +- .../hexcasting/forge/interop/jei/PhialRecipeCategory.java | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Forge/src/main/java/at/petrak/hexcasting/forge/interop/jei/BrainsweepRecipeCategory.java b/Forge/src/main/java/at/petrak/hexcasting/forge/interop/jei/BrainsweepRecipeCategory.java index 79816540..20276bd5 100644 --- a/Forge/src/main/java/at/petrak/hexcasting/forge/interop/jei/BrainsweepRecipeCategory.java +++ b/Forge/src/main/java/at/petrak/hexcasting/forge/interop/jei/BrainsweepRecipeCategory.java @@ -39,7 +39,7 @@ public class BrainsweepRecipeCategory implements IRecipeCategory { ResourceLocation location = modLoc("textures/gui/edify_jei.png"); background = guiHelper.drawableBuilder(location, 0, 0, 79, 61).setTextureSize(128, 128).build(); var edify = modLoc("edify"); - localizedName = Component.translatable("hexcasting.spell." + edify); + localizedName = Component.translatable("hexcasting.action." + edify); icon = new PatternDrawable(edify, 16, 16).strokeOrder(false); } diff --git a/Forge/src/main/java/at/petrak/hexcasting/forge/interop/jei/PhialRecipeCategory.java b/Forge/src/main/java/at/petrak/hexcasting/forge/interop/jei/PhialRecipeCategory.java index 49c673b0..e8e20b2e 100644 --- a/Forge/src/main/java/at/petrak/hexcasting/forge/interop/jei/PhialRecipeCategory.java +++ b/Forge/src/main/java/at/petrak/hexcasting/forge/interop/jei/PhialRecipeCategory.java @@ -31,7 +31,7 @@ public class PhialRecipeCategory implements IRecipeCategory { ResourceLocation location = modLoc("textures/gui/phial_jei.png"); background = guiHelper.drawableBuilder(location, 0, 0, 113, 40).setTextureSize(128, 128).build(); var craftPhial = modLoc("craft/battery"); - localizedName = Component.translatable("hexcasting.spell." + craftPhial); + localizedName = Component.translatable("hexcasting.action." + craftPhial); icon = new PatternDrawable(craftPhial, 12, 12); } From 91399cd5e02a89318702116a0f8623c5527d6ae4 Mon Sep 17 00:00:00 2001 From: "petrak@" Date: Sun, 22 Jan 2023 21:06:42 -0600 Subject: [PATCH 57/95] finish close #360 --- .../at/petrak/hexcasting/api/mod/HexTags.java | 1 + .../hexcasting/common/items/ItemFocus.java | 8 +- .../common/recipe/HexRecipeStuffRegistry.java | 12 +- .../common/recipe/SealFocusRecipe.java | 66 ------- .../common/recipe/SealThingsRecipe.java | 121 ++++++++++++ .../datagen/recipe/HexplatRecipes.java | 29 ++- .../datagen/tag/HexItemTagProvider.java | 1 + .../03e4de26f1265135874f8cdcaebc09d9c08eb42b | 3 +- .../67cce32b1c3cbbcb1f646605f4914e3f196986c2 | 2 +- .../75bcd4dba6ca7d365462b0ec45e291d1056349c4 | 2 +- .../844611d4af49e23072b8a888c8e73c6c5d8c0768 | 2 +- .../9fb1092f32d4fcbf9e061ffd718d4ec689c6c95e | 186 +++++++++--------- .../focus_rotated.json | 32 +++ .../data/hexcasting/recipes/focus.json | 17 +- .../hexcasting/recipes/focus_rotated.json | 30 +++ .../hexcasting/tags/items/seal_materials.json | 6 + .../hexcasting/fabric/FabricHexInitializer.kt | 3 +- .../03e4de26f1265135874f8cdcaebc09d9c08eb42b | 3 +- .../9fb1092f32d4fcbf9e061ffd718d4ec689c6c95e | 6 +- .../recipes/hexcasting/focus_rotated.json | 32 +++ .../data/hexcasting/recipes/focus.json | 17 +- .../hexcasting/recipes/focus_rotated.json | 25 +++ .../hexcasting/tags/items/seal_materials.json | 5 + 23 files changed, 411 insertions(+), 198 deletions(-) delete mode 100644 Common/src/main/java/at/petrak/hexcasting/common/recipe/SealFocusRecipe.java create mode 100644 Common/src/main/java/at/petrak/hexcasting/common/recipe/SealThingsRecipe.java create mode 100644 Fabric/src/generated/resources/data/hexcasting/advancements/recipes/hexcasting.creative_tab/focus_rotated.json create mode 100644 Fabric/src/generated/resources/data/hexcasting/recipes/focus_rotated.json create mode 100644 Fabric/src/generated/resources/data/hexcasting/tags/items/seal_materials.json create mode 100644 Forge/src/generated/resources/data/hexcasting/advancements/recipes/hexcasting/focus_rotated.json create mode 100644 Forge/src/generated/resources/data/hexcasting/recipes/focus_rotated.json create mode 100644 Forge/src/generated/resources/data/hexcasting/tags/items/seal_materials.json 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 711ac07d..0b329d69 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 @@ -18,6 +18,7 @@ public class HexTags { public static final TagKey STAVES = create("staves"); public static final TagKey PHIAL_BASE = create("phial_base"); public static final TagKey GRANTS_ROOT_ADVANCEMENT = create("grants_root_advancement"); + public static final TagKey SEAL_MATERIALS = create("seal_materials"); public static TagKey create(String name) { return create(modLoc(name)); diff --git a/Common/src/main/java/at/petrak/hexcasting/common/items/ItemFocus.java b/Common/src/main/java/at/petrak/hexcasting/common/items/ItemFocus.java index a736e40d..48ea9b5e 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/items/ItemFocus.java +++ b/Common/src/main/java/at/petrak/hexcasting/common/items/ItemFocus.java @@ -1,8 +1,8 @@ package at.petrak.hexcasting.common.items; -import at.petrak.hexcasting.api.item.IotaHolderItem; import at.petrak.hexcasting.api.casting.iota.Iota; import at.petrak.hexcasting.api.casting.iota.NullIota; +import at.petrak.hexcasting.api.item.IotaHolderItem; import at.petrak.hexcasting.api.utils.NBTHelper; import at.petrak.hexcasting.common.lib.hex.HexIotaTypes; import net.minecraft.nbt.CompoundTag; @@ -63,11 +63,15 @@ public class ItemFocus extends Item implements IotaHolderItem { @Override public void appendHoverText(ItemStack pStack, @Nullable Level pLevel, List pTooltipComponents, - TooltipFlag pIsAdvanced) { + TooltipFlag pIsAdvanced) { IotaHolderItem.appendHoverText(this, pStack, pTooltipComponents, pIsAdvanced); } public static boolean isSealed(ItemStack stack) { return NBTHelper.getBoolean(stack, TAG_SEALED); } + + public static void seal(ItemStack stack) { + NBTHelper.putBoolean(stack, TAG_SEALED, true); + } } diff --git a/Common/src/main/java/at/petrak/hexcasting/common/recipe/HexRecipeStuffRegistry.java b/Common/src/main/java/at/petrak/hexcasting/common/recipe/HexRecipeStuffRegistry.java index 2fe4cfe7..cc2ffbba 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/recipe/HexRecipeStuffRegistry.java +++ b/Common/src/main/java/at/petrak/hexcasting/common/recipe/HexRecipeStuffRegistry.java @@ -28,14 +28,12 @@ public class HexRecipeStuffRegistry { private static final Map> SERIALIZERS = new LinkedHashMap<>(); private static final Map> TYPES = new LinkedHashMap<>(); - // TODO: custom costs in brainsweeping. also custom entities but we'll getting there public static final RecipeSerializer BRAINSWEEP = registerSerializer("brainsweep", - new BrainsweepRecipe.Serializer()); - public static final RecipeSerializer SEAL_FOCUS = registerSerializer("seal_focus", - SealFocusRecipe.SERIALIZER); - public static final RecipeSerializer SEAL_SPELLBOOK = registerSerializer( - "seal_spellbook", - SealSpellbookRecipe.SERIALIZER); + new BrainsweepRecipe.Serializer()); + public static final RecipeSerializer SEAL_FOCUS = registerSerializer( + "seal_focus", SealThingsRecipe.FOCUS_SERIALIZER); + public static final RecipeSerializer SEAL_SPELLBOOK = registerSerializer( + "seal_spellbook", SealThingsRecipe.SPELLBOOK_SERIALIZER); public static RecipeType BRAINSWEEP_TYPE = registerType("brainsweep"); diff --git a/Common/src/main/java/at/petrak/hexcasting/common/recipe/SealFocusRecipe.java b/Common/src/main/java/at/petrak/hexcasting/common/recipe/SealFocusRecipe.java deleted file mode 100644 index 0cfc8040..00000000 --- a/Common/src/main/java/at/petrak/hexcasting/common/recipe/SealFocusRecipe.java +++ /dev/null @@ -1,66 +0,0 @@ -package at.petrak.hexcasting.common.recipe; - -import at.petrak.hexcasting.api.item.IotaHolderItem; -import at.petrak.hexcasting.api.utils.NBTHelper; -import at.petrak.hexcasting.common.items.ItemFocus; -import at.petrak.hexcasting.common.lib.HexItems; -import at.petrak.hexcasting.xplat.IXplatAbstractions; -import net.minecraft.core.NonNullList; -import net.minecraft.resources.ResourceLocation; -import net.minecraft.world.inventory.CraftingContainer; -import net.minecraft.world.item.ItemStack; -import net.minecraft.world.item.Items; -import net.minecraft.world.item.crafting.Ingredient; -import net.minecraft.world.item.crafting.RecipeSerializer; -import net.minecraft.world.item.crafting.ShapelessRecipe; -import net.minecraft.world.item.crafting.SimpleRecipeSerializer; -import org.jetbrains.annotations.NotNull; - -public class SealFocusRecipe extends ShapelessRecipe { - public static final SimpleRecipeSerializer SERIALIZER = - new SimpleRecipeSerializer<>(SealFocusRecipe::new); - - private static ItemStack getSealedStack() { - ItemStack output = new ItemStack(HexItems.FOCUS); - NBTHelper.putBoolean(output, ItemFocus.TAG_SEALED, true); - NBTHelper.putString(output, IotaHolderItem.TAG_OVERRIDE_VISUALLY, "any"); - return output; - } - - private static NonNullList createIngredients() { - NonNullList ingredients = NonNullList.createWithCapacity(2); - ingredients.add(IXplatAbstractions.INSTANCE.getUnsealedIngredient(new ItemStack(HexItems.FOCUS))); - ingredients.add(Ingredient.of(Items.HONEYCOMB)); - return ingredients; - } - - public SealFocusRecipe(ResourceLocation id) { - super(id, "", getSealedStack(), createIngredients()); - } - - @Override - public @NotNull ItemStack assemble(CraftingContainer inv) { - ItemStack out = ItemStack.EMPTY; - - for (int i = 0; i < inv.getContainerSize(); i++) { - var stack = inv.getItem(i); - if (stack.is(HexItems.FOCUS)) { - out = stack.copy(); - break; - } - } - - if (!out.isEmpty()) { - NBTHelper.putBoolean(out, ItemFocus.TAG_SEALED, true); - out.setCount(1); - } - - return out; - } - - @Override - public @NotNull RecipeSerializer getSerializer() { - return SERIALIZER; - } -} - diff --git a/Common/src/main/java/at/petrak/hexcasting/common/recipe/SealThingsRecipe.java b/Common/src/main/java/at/petrak/hexcasting/common/recipe/SealThingsRecipe.java new file mode 100644 index 00000000..b02bc7c3 --- /dev/null +++ b/Common/src/main/java/at/petrak/hexcasting/common/recipe/SealThingsRecipe.java @@ -0,0 +1,121 @@ +package at.petrak.hexcasting.common.recipe; + +import at.petrak.hexcasting.api.mod.HexTags; +import at.petrak.hexcasting.common.items.ItemFocus; +import at.petrak.hexcasting.common.items.ItemSpellbook; +import at.petrak.hexcasting.common.lib.HexItems; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.util.StringRepresentable; +import net.minecraft.world.inventory.CraftingContainer; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.item.crafting.CustomRecipe; +import net.minecraft.world.item.crafting.RecipeSerializer; +import net.minecraft.world.item.crafting.SimpleRecipeSerializer; +import net.minecraft.world.level.Level; +import org.jetbrains.annotations.NotNull; + +import java.util.Locale; + +public class SealThingsRecipe extends CustomRecipe { + public final Sealee sealee; + + public static final SimpleRecipeSerializer FOCUS_SERIALIZER = + new SimpleRecipeSerializer<>(SealThingsRecipe::focus); + public static final SimpleRecipeSerializer SPELLBOOK_SERIALIZER = + new SimpleRecipeSerializer<>(SealThingsRecipe::spellbook); + + public SealThingsRecipe(ResourceLocation id, Sealee sealee) { + super(id); + this.sealee = sealee; + } + + + @Override + public boolean canCraftInDimensions(int width, int height) { + return width * height >= 2; + } + + @Override + public boolean matches(CraftingContainer container, Level level) { + boolean foundComb = false; + boolean foundSealee = false; + + for (int i = 0; i < container.getContainerSize(); i++) { + var stack = container.getItem(i); + if (this.sealee.isCorrectSealee(stack)) { + if (foundSealee) return false; + foundSealee = true; + } else if (stack.is(HexTags.Items.SEAL_MATERIALS)) { + if (foundComb) return false; + foundComb = true; + } + } + + return foundComb && foundSealee; + } + + @Override + public @NotNull ItemStack assemble(CraftingContainer inv) { + ItemStack sealee = ItemStack.EMPTY; + + for (int i = 0; i < inv.getContainerSize(); i++) { + var stack = inv.getItem(i); + if (this.sealee.isCorrectSealee(stack)) { + sealee = stack.copy(); + break; + } + } + + if (!sealee.isEmpty()) { + this.sealee.seal(sealee); + sealee.setCount(1); + } + + return sealee; + } + + @Override + public @NotNull RecipeSerializer getSerializer() { + return switch (this.sealee) { + case FOCUS -> FOCUS_SERIALIZER; + case SPELLBOOK -> SPELLBOOK_SERIALIZER; + }; + } + + public static SealThingsRecipe focus(ResourceLocation id) { + return new SealThingsRecipe(id, Sealee.FOCUS); + } + + public static SealThingsRecipe spellbook(ResourceLocation id) { + return new SealThingsRecipe(id, Sealee.SPELLBOOK); + } + + public enum Sealee implements StringRepresentable { + FOCUS, + SPELLBOOK; + + @Override + public String getSerializedName() { + return this.name().toLowerCase(Locale.ROOT); + } + + public boolean isCorrectSealee(ItemStack stack) { + return switch (this) { + case FOCUS -> stack.is(HexItems.FOCUS) && !ItemFocus.isSealed(stack); + case SPELLBOOK -> stack.is(HexItems.SPELLBOOK) && !ItemSpellbook.isSealed(stack); + }; + } + + public void seal(ItemStack stack) { + switch (this) { + case FOCUS -> { + ItemFocus.seal(stack); + } + case SPELLBOOK -> { + ItemSpellbook.setSealed(stack, true); + } + } + } + } +} + diff --git a/Common/src/main/java/at/petrak/hexcasting/datagen/recipe/HexplatRecipes.java b/Common/src/main/java/at/petrak/hexcasting/datagen/recipe/HexplatRecipes.java index 39bf8dc6..fdab8d4c 100644 --- a/Common/src/main/java/at/petrak/hexcasting/datagen/recipe/HexplatRecipes.java +++ b/Common/src/main/java/at/petrak/hexcasting/datagen/recipe/HexplatRecipes.java @@ -7,8 +7,7 @@ import at.petrak.hexcasting.common.items.ItemStaff; import at.petrak.hexcasting.common.items.colorizer.ItemPrideColorizer; import at.petrak.hexcasting.common.lib.HexBlocks; import at.petrak.hexcasting.common.lib.HexItems; -import at.petrak.hexcasting.common.recipe.SealFocusRecipe; -import at.petrak.hexcasting.common.recipe.SealSpellbookRecipe; +import at.petrak.hexcasting.common.recipe.SealThingsRecipe; import at.petrak.hexcasting.common.recipe.ingredient.StateIngredientHelper; import at.petrak.hexcasting.common.recipe.ingredient.brainsweep.EntityTagIngredient; import at.petrak.hexcasting.common.recipe.ingredient.brainsweep.EntityTypeIngredient; @@ -58,8 +57,8 @@ public class HexplatRecipes extends PaucalRecipeProvider { @Override protected void makeRecipes(Consumer recipes) { - specialRecipe(recipes, SealFocusRecipe.SERIALIZER); - specialRecipe(recipes, SealSpellbookRecipe.SERIALIZER); + specialRecipe(recipes, SealThingsRecipe.FOCUS_SERIALIZER); + specialRecipe(recipes, SealThingsRecipe.SPELLBOOK_SERIALIZER); staffRecipe(recipes, HexItems.STAFF_OAK, Items.OAK_PLANKS); staffRecipe(recipes, HexItems.STAFF_BIRCH, Items.BIRCH_PLANKS); @@ -72,12 +71,26 @@ public class HexplatRecipes extends PaucalRecipeProvider { staffRecipe(recipes, HexItems.STAFF_MANGROVE, Items.MANGROVE_PLANKS); staffRecipe(recipes, HexItems.STAFF_EDIFIED, HexBlocks.EDIFIED_PLANKS.asItem()); - ringCornered(HexItems.FOCUS, 1, - ingredients.glowstoneDust(), - ingredients.leather(), - Ingredient.of(HexItems.CHARGED_AMETHYST)) + ShapedRecipeBuilder.shaped(HexItems.FOCUS) + .define('G', ingredients.glowstoneDust()) + .define('L', ingredients.leather()) + .define('P', Items.PAPER) + .define('A', HexItems.CHARGED_AMETHYST) + .pattern("GLG") + .pattern("PAP") + .pattern("GLG") .unlockedBy("has_item", hasItem(HexTags.Items.STAVES)) .save(recipes); + ShapedRecipeBuilder.shaped(HexItems.FOCUS) + .define('G', ingredients.glowstoneDust()) + .define('L', ingredients.leather()) + .define('P', Items.PAPER) + .define('A', HexItems.CHARGED_AMETHYST) + .pattern("GPG") + .pattern("LAL") + .pattern("GPG") + .unlockedBy("has_item", hasItem(HexTags.Items.STAVES)) + .save(recipes, modLoc("focus_rotated")); ShapedRecipeBuilder.shaped(HexItems.SPELLBOOK) .define('N', ingredients.goldNugget()) diff --git a/Common/src/main/java/at/petrak/hexcasting/datagen/tag/HexItemTagProvider.java b/Common/src/main/java/at/petrak/hexcasting/datagen/tag/HexItemTagProvider.java index 43ca91de..898fb1d2 100644 --- a/Common/src/main/java/at/petrak/hexcasting/datagen/tag/HexItemTagProvider.java +++ b/Common/src/main/java/at/petrak/hexcasting/datagen/tag/HexItemTagProvider.java @@ -32,6 +32,7 @@ public class HexItemTagProvider extends PaucalItemTagProvider { tag(HexTags.Items.PHIAL_BASE).add(Items.GLASS_BOTTLE); tag(HexTags.Items.GRANTS_ROOT_ADVANCEMENT).add(HexItems.AMETHYST_DUST, Items.AMETHYST_SHARD, HexItems.CHARGED_AMETHYST); + tag(HexTags.Items.SEAL_MATERIALS).add(Items.HONEYCOMB); this.copy(HexTags.Blocks.EDIFIED_LOGS, HexTags.Items.EDIFIED_LOGS); this.copy(HexTags.Blocks.EDIFIED_PLANKS, HexTags.Items.EDIFIED_PLANKS); diff --git a/Fabric/src/generated/resources/.cache/03e4de26f1265135874f8cdcaebc09d9c08eb42b b/Fabric/src/generated/resources/.cache/03e4de26f1265135874f8cdcaebc09d9c08eb42b index 4c465521..692ef768 100644 --- a/Fabric/src/generated/resources/.cache/03e4de26f1265135874f8cdcaebc09d9c08eb42b +++ b/Fabric/src/generated/resources/.cache/03e4de26f1265135874f8cdcaebc09d9c08eb42b @@ -1,4 +1,4 @@ -// 1.19.2 2023-01-22T20:01:15.102275514 Tags for minecraft:item +// 1.19.2 2023-01-22T20:54:31.1145534 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 @@ -11,6 +11,7 @@ fdb48f194d7937ab6b423fa4b90a4d438bf6dd90 data/minecraft/tags/items/doors.json 20183cd61968ff6548df2dde1100b6378d68d64b data/minecraft/tags/items/wooden_buttons.json 24145229528668829a1bcecf18a6377ebd07ccf8 data/hexcasting/tags/items/grants_root_advancement.json 684c3206f38cc9cc494d5875c5e56aad004486af data/hexcasting/tags/items/edified_logs.json +e186f43ed06770e698c886691f91b2c6acdb5a2a data/hexcasting/tags/items/seal_materials.json 5f3b600b4fd98744bd08c993ce7bcb9c2f195cd2 data/minecraft/tags/items/leaves.json 684c3206f38cc9cc494d5875c5e56aad004486af data/minecraft/tags/items/logs.json 5bbfd513fd2eb2090b0c2d1ec33504deb79d53b9 data/minecraft/tags/items/slabs.json diff --git a/Fabric/src/generated/resources/.cache/67cce32b1c3cbbcb1f646605f4914e3f196986c2 b/Fabric/src/generated/resources/.cache/67cce32b1c3cbbcb1f646605f4914e3f196986c2 index 06443f8e..204a0914 100644 --- a/Fabric/src/generated/resources/.cache/67cce32b1c3cbbcb1f646605f4914e3f196986c2 +++ b/Fabric/src/generated/resources/.cache/67cce32b1c3cbbcb1f646605f4914e3f196986c2 @@ -1,4 +1,4 @@ -// 1.19.2 2023-01-22T20:01:15.106418886 LootTables +// 1.19.2 2023-01-22T20:54:31.115936247 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 47ff92eb..f8ddf8a8 100644 --- a/Fabric/src/generated/resources/.cache/75bcd4dba6ca7d365462b0ec45e291d1056349c4 +++ b/Fabric/src/generated/resources/.cache/75bcd4dba6ca7d365462b0ec45e291d1056349c4 @@ -1,4 +1,4 @@ -// 1.19.2 2023-01-22T20:01:15.101152195 Tags for minecraft:block +// 1.19.2 2023-01-22T20:54:31.115320251 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 dfb78b05..e1bff53a 100644 --- a/Fabric/src/generated/resources/.cache/844611d4af49e23072b8a888c8e73c6c5d8c0768 +++ b/Fabric/src/generated/resources/.cache/844611d4af49e23072b8a888c8e73c6c5d8c0768 @@ -1,4 +1,4 @@ -// 1.19.2 2023-01-22T20:01:15.100005619 Tags for hexcasting:action +// 1.19.2 2023-01-22T20:54:31.092846061 Tags for hexcasting:action e5afc567ea17f035e4eb1d1d48825100b7f6ad68 data/hexcasting/tags/action/per_world_pattern.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 b852d2ab..08d9aa90 100644 --- a/Fabric/src/generated/resources/.cache/9fb1092f32d4fcbf9e061ffd718d4ec689c6c95e +++ b/Fabric/src/generated/resources/.cache/9fb1092f32d4fcbf9e061ffd718d4ec689c6c95e @@ -1,145 +1,74 @@ -// 1.19.2 2023-01-22T20:01:15.102891719 Recipes -858dada9c41974f5aa80c66423bf371c9e176a53 data/hexcasting/recipes/pride_colorizer_demigirl.json -bb0f91c534c888d1cff8793b49986dce236c7b2d data/hexcasting/advancements/recipes/hexcasting.creative_tab/dye_colorizer_white.json +// 1.19.2 2023-01-22T20:54:31.094256565 Recipes 9f75d3e93ecbbbf3ed9a92b2943397e09dcae1a9 data/hexcasting/recipes/dye_colorizer_light_blue.json 04569ccadfd99f203b0485d0c3e877209290f2b3 data/hexcasting/advancements/recipes/hexcasting.creative_tab/dye_colorizer_pink.json -0101f5c24d8beedcc884ce87b052ad4f6884ddc4 data/hexcasting/recipes/akashic_bookshelf.json 2a9d4a0f3618abf9e9b8699b318a984d2c836913 data/hexcasting/advancements/recipes/brainsweep/brainsweep/directrix_redstone.json 1b510d32bad1a51ad6795fb8e7702d34c8c8cfbe data/hexcasting/advancements/recipes/hexcasting.creative_tab/dye_colorizer_green.json d73e5d8fec4d3f7d15888bd292f4ad9c1b37cac5 data/hexcasting/advancements/recipes/hexcasting.creative_tab/ageing_scroll_paper_lantern.json b54339a9e990419e4820491001c4cbdb7aa9fddb data/hexcasting/recipes/artifact.json bfca15c4ef7bea4704d062c3ab690e23887e55b0 data/hexcasting/advancements/recipes/hexcasting.creative_tab/scroll.json -ef5a19ab2710fd0ce836d767588fe6a54a528a48 data/hexcasting/recipes/dye_colorizer_white.json 768d70365c56ef1fbad089d3e3fd68548f964227 data/hexcasting/recipes/dye_colorizer_black.json dfb42a8b723b37df5c8888bdef86a1be35f2de72 data/hexcasting/recipes/pride_colorizer_bisexual.json -605f921a98b5dabbd80bc762070916e7d6756df6 data/hexcasting/advancements/recipes/hexcasting.creative_tab/dye_colorizer_orange.json 17aa26ce6bc9941d1477dee99e514fd66be7f664 data/hexcasting/recipes/pride_colorizer_aroace.json -6978ff90efdd067940caccdd29437d2aefd0fe1f data/hexcasting/recipes/scroll_paper.json -229931adf8d62f659de5950d711afd24fb5aa535 data/hexcasting/advancements/recipes/brainsweep/brainsweep/akashic_record.json -1754e1304908edf58a70fe8548f9d0ede22a1dd3 data/hexcasting/recipes/pride_colorizer_pansexual.json ffba0344dfc7f604e8e33a333549f74c53f3e7e6 data/hexcasting/recipes/uuid_colorizer.json -d684142c75bee35e6035d1829e271704d4ccdff3 data/hexcasting/advancements/recipes/hexcasting.creative_tab/pride_colorizer_lesbian.json dfc171097bdd8a8f280e6787ea999286deda643e data/hexcasting/advancements/recipes/hexcasting.creative_tab/focus.json e6ba57745f6841c2dcb537ada2475e880ea25186 data/hexcasting/recipes/dye_colorizer_green.json a3c7f19df257ee07f0894708b48438fdf3b14a47 data/hexcasting/advancements/recipes/hexcasting.creative_tab/dye_colorizer_black.json 15608e5929da4801fc933e79a9e37419ce60e18d data/hexcasting/advancements/recipes/brainsweep/brainsweep/budding_amethyst.json a776209b64fea520f6a2fff9f1623e7086939dd9 data/hexcasting/recipes/jungle_staff.json -4ffed306e5f640054a6f269ae0e548388f087996 data/hexcasting/recipes/warped_staff.json 2b16fb3f6b4e4e31c5c507e6c0535bd12c7c63a1 data/hexcasting/recipes/dye_colorizer_brown.json -f45428f892d2064fafa29ea644eea21354e2e322 data/hexcasting/advancements/recipes/hexcasting.creative_tab/edified_staff.json -8715e71c2fb59ee458ce217040c9a8dd0db04789 data/hexcasting/advancements/recipes/hexcasting.creative_tab/lens.json -86d3a071eaec779167ca51dafaedde0e705cfb70 data/hexcasting/advancements/recipes/hexcasting.creative_tab/pride_colorizer_asexual.json be7ceaf2b55525f06178fb09070dfeeef8da1c65 data/hexcasting/advancements/recipes/hexcasting.creative_tab/pride_colorizer_transgender.json -3608f0ec056f2c5d29a9a89305218497fd2c4383 data/hexcasting/recipes/stonecutting/amethyst_tiles.json -260f89eb21b360ea8b7fdbd23f9977d03ab57149 data/hexcasting/recipes/ancient_scroll_paper_lantern.json -62bfad9dc29406a9807ea33f866cbdfca32e7d0a data/hexcasting/advancements/recipes/hexcasting.creative_tab/amethyst_dust_unpacking.json -4cc110d5ce9831c0072cc2c4fd8f1a6196f42331 data/hexcasting/advancements/recipes/hexcasting.creative_tab/ancient_scroll_paper_lantern.json -1315f615ebc6593829bd86318d8eb45c2de68876 data/hexcasting/advancements/recipes/hexcasting.creative_tab/edified_button.json e0609202271e402d8ae58e4f8eaf11dcdda10a9e data/hexcasting/recipes/brainsweep/akashic_record.json -b21f6cbf11e23eac313d68805428cc0da55edb83 data/hexcasting/recipes/compat/farmersdelight/cutting/akashic_log.json 1b210391768fede639b29ae6fc5adf2b8b4e64c6 data/hexcasting/advancements/recipes/hexcasting.creative_tab/dye_colorizer_brown.json -ae2c6392cc0ec104c4e3019e1824a1e7f811f1de data/hexcasting/advancements/recipes/hexcasting.creative_tab/abacus.json cd22886924e7aaeb62e8f7da0747cc950af9dc32 data/hexcasting/advancements/recipes/hexcasting.creative_tab/pride_colorizer_plural.json 6c54952ecbb6899f3291fe72486e7205e6ab76cc data/hexcasting/recipes/pride_colorizer_intersex.json -cc89232d202eec019f584e8c5cc044deee76036b data/hexcasting/recipes/amethyst_sconce.json -48b6d3429e3536a85f3a0e9585a7d252ae0d57a3 data/hexcasting/advancements/recipes/hexcasting.creative_tab/jeweler_hammer.json 709232dd093e48895014957f2e4ff5a1a76da583 data/create/recipes/crushing/amethyst_cluster.json -bc100b94798f0b456877b42a5fc9aee7c4f25218 data/hexcasting/recipes/dye_colorizer_magenta.json -85ea4913eb07d67a976891e48a32d20879f31eaa data/hexcasting/recipes/dye_colorizer_light_gray.json -7caa7a8d9f8b0859f9507376bb715bdbe4b3fb56 data/hexcasting/recipes/dye_colorizer_blue.json ad390fe854110e60aec4c805f7bb5fed45b4e5d1 data/hexcasting/advancements/recipes/hexcasting.creative_tab/amethyst_tiles.json 0ed898da60aa78cd526ff4ae0524359891dbd976 data/hexcasting/advancements/recipes/hexcasting.creative_tab/edified_tile.json ebfa29e0a62a629afbe18681e09cc7be95a3529e data/hexcasting/advancements/recipes/hexcasting.creative_tab/dye_colorizer_yellow.json 5ba498c4c19f74cbb456385bccda96d4a8d1d1cc data/hexcasting/advancements/recipes/hexcasting.creative_tab/slate_block.json -f8e027860b2505a7217d1264c5d0b6f7feea0679 data/hexcasting/advancements/recipes/hexcasting.creative_tab/edified_door.json 2aa2e5c268ae440238eaf4cea20011b0c8f81a49 data/hexcasting/advancements/recipes/hexcasting.creative_tab/pride_colorizer_demiboy.json -63da3af421dfb38283d750eb3b9761f42e95fb91 data/hexcasting/advancements/recipes/hexcasting.creative_tab/stripped_edified_wood.json -24984d728a5c05967c58be9c0dc1c59e986602e6 data/hexcasting/recipes/brainsweep/impetus_storedplayer.json 326925a948aeb17aabafbc25ed2562a257796d29 data/hexcasting/recipes/dye_colorizer_yellow.json 9f55e6ff1f2633e4ad390868e7952b700e5309a4 data/hexcasting/advancements/recipes/brainsweep/brainsweep/impetus_rightclick.json 4440b41499c9c32e297dc184c39da010ff82ac5e data/hexcasting/advancements/recipes/hexcasting.creative_tab/uuid_colorizer.json 5a90084c03d6e8424872870c8b65f4771b447f03 data/hexcasting/recipes/brainsweep/budding_amethyst.json -6e6c73a93e0e06ff399d95e40baf4e06f3a25a0a data/hexcasting/advancements/recipes/hexcasting.creative_tab/slate_block_from_slates.json -3662834d6e0bac03aba28f0f9d9f07f511492118 data/hexcasting/recipes/lens.json 638c534059597cebb9dc1e927c76a2809ddbfd42 data/hexcasting/recipes/akashic_connector.json -afbeab63d6f09200c91014b0ba2570ed2a29fc52 data/hexcasting/advancements/recipes/brainsweep/brainsweep/testing/flowey_the_flower.json 1c5681b6bf354ce068c51852b51a5aba9ac2d8f9 data/hexcasting/recipes/compat/create/crushing/amethyst_shard.json -336465276c06fc59be003ccad3d6fc121fa438f5 data/hexcasting/recipes/edified_staff.json -1086a6e3f284fc3b575ee3a21d2b13d0bc62d2bb data/hexcasting/recipes/brainsweep/impetus_rightclick.json ce0cd4d73792c30dcec2eea306bff44b28cb237f data/hexcasting/recipes/pride_colorizer_agender.json -f91ab1d68c575970ef48ad499ec92057a8ee7b2e data/hexcasting/recipes/cypher.json -a331f4ce9b8d3565cbb154af4d63279f1e2c7a41 data/hexcasting/recipes/compat/farmersdelight/cutting/akashic_trapdoor.json 4f301e8e812f409be41cfddfa74b1fb7c8034edf data/hexcasting/advancements/recipes/hexcasting.creative_tab/dye_colorizer_purple.json -108421ab59fc52c69913676abda5e0a045fe1b04 data/hexcasting/recipes/pride_colorizer_gay.json f75c21d35b926a2303d60115a297c387790bbbd9 data/hexcasting/advancements/recipes/hexcasting.creative_tab/edified_trapdoor.json 3b83dd1c1aa1bcc58e6512bca75c3a6a3b7482b3 data/hexcasting/recipes/edified_tile.json -ceab17c3df28bb48bc9d99097051c601f5b981f5 data/hexcasting/advancements/recipes/hexcasting.creative_tab/akashic_connector.json -d603560d9bbe0bd3e9c0ca5cd502fe874337599e data/hexcasting/advancements/recipes/hexcasting.creative_tab/dye_colorizer_light_gray.json -0ee8d29cb06065a55017a8fc50576193107f958d data/hexcasting/recipes/dynamicseal_focus.json f48c2df6c0981b959c2e1b0bf8ecc4739b2e034f data/hexcasting/advancements/recipes/brainsweep/brainsweep/impetus_look.json -8c49c1c022cee20fb2a44046425b48cd0e6659af data/hexcasting/advancements/recipes/hexcasting.creative_tab/birch_staff.json -12e1ba1ec29bf0eadf1210d2307fab35e9685085 data/hexcasting/recipes/empty_directrix.json -898319b3a4ee7a8d7bd7a4af0313593561ed657e data/hexcasting/advancements/recipes/hexcasting.creative_tab/scroll_paper.json +b21a84886b937a4c4e72a674f265dccb21411ab9 data/hexcasting/advancements/recipes/hexcasting.creative_tab/focus_rotated.json 0c72527448454438308ba5a4e99452b193fad421 data/hexcasting/recipes/dye_colorizer_gray.json -64f509c0496204d39c38a4a64a1fbe0f84b9e5ae data/hexcasting/advancements/recipes/hexcasting.creative_tab/dye_colorizer_magenta.json aa6c75e8834d47b0a144dac7b6448cbaecb7df44 data/hexcasting/recipes/pride_colorizer_aromantic.json -a16ce751797baf92c3dd3f125b564e789aeec260 data/hexcasting/advancements/recipes/hexcasting.creative_tab/edified_planks.json -7df149b266e4f7925defd3b017163698070dbcb9 data/hexcasting/advancements/recipes/hexcasting.creative_tab/scroll_medium.json -dc2a9bf96ca9d04ea6bdeb32249322530b5e1cbf data/hexcasting/advancements/recipes/hexcasting.creative_tab/warped_staff.json +5a076528340bd4c0007ed6123bcad30fcaaf1fc3 data/hexcasting/recipes/focus_rotated.json b62b3b67e6a105e1eb47d04c2ededd8d408df7b7 data/hexcasting/advancements/recipes/hexcasting.creative_tab/ancient_scroll_paper.json -1ba5dada44ad7c008756f0e8e7adfe30e2520239 data/hexcasting/recipes/dye_colorizer_lime.json 4692127dbfe21eab57a6e33b214a3661cf3e6d0f data/hexcasting/recipes/pride_colorizer_demiboy.json -b494dc17959c76857f25368eb845e58e4f8bca92 data/hexcasting/recipes/compat/farmersdelight/cutting/akashic_door.json 36c97b8de7a0b67256e8966eca289a865cb85df5 data/hexcasting/advancements/recipes/hexcasting.creative_tab/pride_colorizer_bisexual.json -4bff4a59e32c6d1d99bc3a8abd16cd88c51a8e73 data/hexcasting/recipes/dye_colorizer_orange.json cba5ffa7cd89116aba040956f4a85073cedd39cf data/hexcasting/recipes/mangrove_staff.json -1f04d75a1c713d3c5ac44e62889ce834f12d6234 data/hexcasting/recipes/jeweler_hammer.json 4565df318c12afe89322d2459c06bdfc34901679 data/hexcasting/advancements/recipes/brainsweep/brainsweep/testing/bad_to_the_bone.json -8a9e7aa8d07556649768729348dff5305b84e1b9 data/hexcasting/recipes/edified_door.json e52dbfc2d86bb3e87ff554fc8d5f0d43b7ff334a data/hexcasting/advancements/recipes/hexcasting.creative_tab/dye_colorizer_gray.json b6d6716724729f0530a524f92d7e4646455de344 data/hexcasting/advancements/recipes/hexcasting.creative_tab/dye_colorizer_red.json -993a613fabd0ee1005bde11ebe92f8046351ba9e data/hexcasting/advancements/recipes/hexcasting.creative_tab/trinket.json -2e02e371ed43f72f101588ce4fa6e7ac8b5ef471 data/hexcasting/recipes/scroll_medium.json -99ebed784d731042da34187b829e1b9560cbebb2 data/hexcasting/advancements/recipes/hexcasting.creative_tab/akashic_bookshelf.json bd3e10b3d468e48e72ad060b9eb0b9f8f4057bf1 data/hexcasting/recipes/ageing_scroll_paper_lantern.json -5627128775e24fb6281a0576a931cfa88a909bc0 data/hexcasting/recipes/slate_block_from_slates.json -6aa3e7825025d055a70a58acd4fd48eef0480721 data/hexcasting/recipes/edified_wood.json -783c691f24bc4259ba5da014133763dce26ee4bd data/hexcasting/recipes/crimson_staff.json 446b5adea918e25bb93959fe381e4c8f3fe789f5 data/hexcasting/recipes/scroll.json -6479526ac6b8732814ea3feb97e877896c17f7b7 data/hexcasting/recipes/edified_trapdoor.json 0cb3e2e6e0be9f53811f24ad43bf711d07560210 data/hexcasting/advancements/recipes/hexcasting.creative_tab/acacia_staff.json -6641b22c79fa29fab15d414afecabd3aa7402b38 data/hexcasting/advancements/recipes/hexcasting.creative_tab/scroll_paper_lantern.json -3ae790bef91b6ae57ed7e3e792740ea059875293 data/hexcasting/advancements/recipes/hexcasting.creative_tab/dye_colorizer_cyan.json c7d28ccf9df6fc46aa142c2e7b176cc0cb5ea62b data/hexcasting/recipes/empty_impetus.json -16c91a664dbe7914a7db566f45158c8191e52afb data/hexcasting/recipes/brainsweep/testing/bad_to_the_bone.json -f0a77ba758e649d0c16a8e2d9964d18f95a544f4 data/hexcasting/advancements/recipes/hexcasting.creative_tab/slate.json -f9e4d9171ffc6a125d9899f1867398acf8037b27 data/hexcasting/advancements/recipes/hexcasting.creative_tab/pride_colorizer_agender.json c93cecd3f883e57f3cce7ad3d6aad44000ed541c data/hexcasting/recipes/ancient_scroll_paper.json -ba08fd11d19f54c504ceed6f162a5d814e03d1e8 data/hexcasting/recipes/brainsweep/testing/flowey_the_flower.json 12d9ec588869179a8e8a1f4bce718175d57e4a71 data/create/recipes/crushing/amethyst_block.json ab26481b45a7f463e2225b9a04d24a1b4d84daef data/hexcasting/recipes/abacus.json -2e943ea3077aa46f16d78c04ab417677fc326e78 data/hexcasting/advancements/recipes/hexcasting.creative_tab/scroll_small.json 38e7b64a4a15f1ce496f8c156d7262426f98fbcc data/hexcasting/recipes/acacia_staff.json 6a9a89cfa34732437996431a9c885332cf714449 data/hexcasting/advancements/recipes/hexcasting.creative_tab/mangrove_staff.json 7c7888ba95d1e2e8620a916df546a2b06b592d37 data/hexcasting/recipes/edified_planks.json -0d08dab8c9700c7b5b32ad35e7b665a2e3c2cdc7 data/hexcasting/advancements/recipes/hexcasting.creative_tab/artifact.json 0859373b9e60e80f3c8b0962a3bc94903af43d36 data/hexcasting/recipes/stripped_edified_wood.json -01f8281d0b4b1fa7116989c9a01d71a3312d8d11 data/hexcasting/advancements/recipes/hexcasting.creative_tab/empty_directrix.json e687ceab424098d586f0b67a34fe65bee1f4dfca data/hexcasting/advancements/recipes/hexcasting.creative_tab/dye_colorizer_blue.json 013a4b5603757f8610709428dad8de79bd9bd590 data/hexcasting/recipes/dye_colorizer_pink.json -202e70722198141d5dd961bb087a25873e4928af data/hexcasting/recipes/edified_stairs.json 6e692bdb7e797c1d0fffb5fcc90c5a3b28e4aaff data/hexcasting/advancements/recipes/hexcasting.creative_tab/pride_colorizer_aromantic.json -b640608755649a8bde55a434016b14522fa6d2e0 data/hexcasting/advancements/recipes/hexcasting.creative_tab/edified_wood.json -d323e21de69d0606d1fac03fa8820e5857e4e1f1 data/hexcasting/recipes/dynamicseal_spellbook.json e0e49c8a9977fe2b0619179b11a4379b5b19ace9 data/hexcasting/advancements/recipes/hexcasting.creative_tab/sub_sandwich.json -08c200b6d3a3aacb434112aacab9851e7d5f6083 data/hexcasting/recipes/scroll_small.json e3416c3e103fe206cbaa352eb5011f81ccfc6aca data/hexcasting/recipes/slate.json 0b8a01eab5d4ce90974c6c53b6d397f8e9398385 data/hexcasting/recipes/slate_block.json bb42a28d7b19f8f8057630f0d2e99b371e93126a data/hexcasting/advancements/recipes/hexcasting.creative_tab/dye_colorizer_light_blue.json 2fa8ff79780daaa523fe9f04a8fa15c186f055c2 data/hexcasting/recipes/dye_colorizer_purple.json dc0fb37084974cf396264d046fa6708338eb0879 data/hexcasting/recipes/pride_colorizer_transgender.json -5902d75cd2474604f2bb1067187ba574eb1e15fc data/hexcasting/recipes/compat/farmersdelight/cutting/akashic_wood.json -07902912a9ca6f8da48ed579ec318bb760d4f8df data/hexcasting/recipes/pride_colorizer_nonbinary.json f0852056a692d776bf537c821f3d166c2be88bd8 data/hexcasting/recipes/spruce_staff.json b185eee3dc066959c2699284eeed8c5c5de80d33 data/hexcasting/recipes/trinket.json 65246cf025a3300dacf9235db546178e83c863e9 data/hexcasting/recipes/pride_colorizer_lesbian.json @@ -147,46 +76,119 @@ b7d75dcd88e5091ff44eec236531a56e82c7bd91 data/hexcasting/advancements/recipes/he 13ca24f9f87a6b34f7717e5c326291079e6db96f data/hexcasting/recipes/sub_sandwich.json 90088535c8e4d0beb0725878314c49ac8deb373b data/hexcasting/recipes/amethyst_dust_packing.json 220f4dc7c8f857092bcb85b5ccf8936237ededa4 data/hexcasting/advancements/recipes/hexcasting.creative_tab/amethyst_sconce.json -7a51e934846a0d7fe00a808cfa22fd85da67fe9d data/hexcasting/recipes/brainsweep/impetus_look.json f0849d723141b9f02798d474da6594f78755dd51 data/hexcasting/recipes/amethyst_tiles.json -a184ee70962538e4f8641c707d6dca8796ca36e7 data/hexcasting/recipes/edified_slab.json b7250840982952fc23c8b32b77517744329d8d2d data/hexcasting/recipes/spellbook.json -22ff2d626da7f5fdc1411b4df75a6fc6a0e52df7 data/hexcasting/advancements/recipes/hexcasting.creative_tab/edified_slab.json -3de6a907c45a97e163caf043292bb693af58e453 data/hexcasting/advancements/recipes/hexcasting.creative_tab/crimson_staff.json 494a76b3cebcd7b0b37c3f2e655d37b3c7fb762b data/hexcasting/advancements/recipes/hexcasting.creative_tab/spruce_staff.json 83ec93ac94401b356fbee3d6464f52f151edeac4 data/hexcasting/advancements/recipes/hexcasting.creative_tab/spellbook.json 9d4594ac55f0221fff91bc0a48f54e890edd3596 data/hexcasting/recipes/dark_oak_staff.json 0efcdb6cd338f382c823e8599e298322a0080dae data/hexcasting/recipes/edified_panel.json 527f52ec902b9f456099bebe066b15533fe8cffd data/hexcasting/advancements/recipes/hexcasting.creative_tab/edified_pressure_plate.json -563d6b480a6ebf1c200c2ca7cd62ed305cbf9710 data/hexcasting/advancements/recipes/hexcasting.creative_tab/dye_colorizer_lime.json d7f93550b7c25b963eaf34d4d2ab9d9871830983 data/hexcasting/recipes/dye_colorizer_cyan.json 9c8503715195c4cb2e2d9a1abe4f94df7bb9f4b5 data/hexcasting/advancements/recipes/hexcasting.creative_tab/stonecutting/amethyst_tiles.json e91b58b8a52d0d69e13102fbf743aab8be177924 data/hexcasting/recipes/pride_colorizer_genderfluid.json -b7fc41f8cfd83a0d138290251d63bb6cc04e0f9a data/hexcasting/recipes/edified_pressure_plate.json 122ca20f3a77c1267e4b8c755e9cd66e56734547 data/hexcasting/advancements/recipes/hexcasting.creative_tab/pride_colorizer_genderqueer.json -3c552071e6b3cfd4932b8f1e8d8b91aae8ead99d data/hexcasting/advancements/recipes/hexcasting.creative_tab/dark_oak_staff.json -a58f37bc66e65c1ac00ba7dbc4d9a7b902f42aad data/hexcasting/advancements/recipes/hexcasting.creative_tab/oak_staff.json -13d03da2cfee5c29e5432806189e18eeefb76e11 data/hexcasting/advancements/recipes/hexcasting.creative_tab/pride_colorizer_gay.json -fc0476880c79cf4458dd5b24f77fc980b02534d2 data/hexcasting/recipes/edified_button.json fc7fe64799c10482c01aaf467c6447503d3ffb70 data/hexcasting/advancements/recipes/brainsweep/brainsweep/impetus_storedplayer.json aa4a00864f1b22835612fe60a4715250f3ab2126 data/hexcasting/advancements/recipes/hexcasting.creative_tab/edified_panel.json -6f5ee50706640e9be82810e22388fc7b2bce13b1 data/hexcasting/recipes/birch_staff.json -e35c89ccc099c511c9ab321a7490d35f2e8c9353 data/hexcasting/advancements/recipes/hexcasting.creative_tab/amethyst_dust_packing.json -3127e275f4dc31d80a21f9119fcebc527e821caa data/hexcasting/recipes/brainsweep/directrix_redstone.json -735a7d770f23a02dc4ae93644e7f4c44a32e313a data/hexcasting/recipes/oak_staff.json d75bc1009064769735d46e7f4f32c65d10a470e3 data/hexcasting/recipes/pride_colorizer_asexual.json -36c3ea4547b49c7553e7024192d5ddf6f2163422 data/hexcasting/recipes/scroll_paper_lantern.json 50f5bf4d8a499f87fa2211489624c11cc90a95a6 data/hexcasting/advancements/recipes/hexcasting.creative_tab/edified_stairs.json -646baa3a1299b4ee296ba0763a858db30e995adb data/hexcasting/recipes/focus.json +390c7a6d359e3022fda950ddbf6a3cff0a75561b data/hexcasting/recipes/focus.json db105c67babb1ffc1bcad53ed1c98d7eb2fee4b1 data/hexcasting/recipes/pride_colorizer_plural.json bc91b7e096d8a0033916101f21fa43c06b343e86 data/hexcasting/recipes/dye_colorizer_red.json 04d5ceb50171bf1575b4c0145c4acbbc414a6390 data/hexcasting/advancements/recipes/hexcasting.creative_tab/cypher.json 323ccf5637e08024ae3984d1dd3585e6af0fd14c data/hexcasting/advancements/recipes/hexcasting.creative_tab/pride_colorizer_demigirl.json -79ebc61817f6ef529c385fe3ed3ff9edb0761f96 data/hexcasting/advancements/recipes/hexcasting.creative_tab/pride_colorizer_genderfluid.json 045e4eeefde52c09fd5bc24b8fcbe2a4e81f8bdb data/hexcasting/advancements/recipes/hexcasting.creative_tab/pride_colorizer_intersex.json +3db193fa4246ffa5bbfa45ce901bbfaeada0a942 data/hexcasting/advancements/recipes/hexcasting.creative_tab/empty_impetus.json +858dada9c41974f5aa80c66423bf371c9e176a53 data/hexcasting/recipes/pride_colorizer_demigirl.json +bb0f91c534c888d1cff8793b49986dce236c7b2d data/hexcasting/advancements/recipes/hexcasting.creative_tab/dye_colorizer_white.json +0101f5c24d8beedcc884ce87b052ad4f6884ddc4 data/hexcasting/recipes/akashic_bookshelf.json +ef5a19ab2710fd0ce836d767588fe6a54a528a48 data/hexcasting/recipes/dye_colorizer_white.json +605f921a98b5dabbd80bc762070916e7d6756df6 data/hexcasting/advancements/recipes/hexcasting.creative_tab/dye_colorizer_orange.json +6978ff90efdd067940caccdd29437d2aefd0fe1f data/hexcasting/recipes/scroll_paper.json +229931adf8d62f659de5950d711afd24fb5aa535 data/hexcasting/advancements/recipes/brainsweep/brainsweep/akashic_record.json +1754e1304908edf58a70fe8548f9d0ede22a1dd3 data/hexcasting/recipes/pride_colorizer_pansexual.json +d684142c75bee35e6035d1829e271704d4ccdff3 data/hexcasting/advancements/recipes/hexcasting.creative_tab/pride_colorizer_lesbian.json +4ffed306e5f640054a6f269ae0e548388f087996 data/hexcasting/recipes/warped_staff.json +f45428f892d2064fafa29ea644eea21354e2e322 data/hexcasting/advancements/recipes/hexcasting.creative_tab/edified_staff.json +8715e71c2fb59ee458ce217040c9a8dd0db04789 data/hexcasting/advancements/recipes/hexcasting.creative_tab/lens.json +86d3a071eaec779167ca51dafaedde0e705cfb70 data/hexcasting/advancements/recipes/hexcasting.creative_tab/pride_colorizer_asexual.json +3608f0ec056f2c5d29a9a89305218497fd2c4383 data/hexcasting/recipes/stonecutting/amethyst_tiles.json +260f89eb21b360ea8b7fdbd23f9977d03ab57149 data/hexcasting/recipes/ancient_scroll_paper_lantern.json +62bfad9dc29406a9807ea33f866cbdfca32e7d0a data/hexcasting/advancements/recipes/hexcasting.creative_tab/amethyst_dust_unpacking.json +4cc110d5ce9831c0072cc2c4fd8f1a6196f42331 data/hexcasting/advancements/recipes/hexcasting.creative_tab/ancient_scroll_paper_lantern.json +1315f615ebc6593829bd86318d8eb45c2de68876 data/hexcasting/advancements/recipes/hexcasting.creative_tab/edified_button.json +b21f6cbf11e23eac313d68805428cc0da55edb83 data/hexcasting/recipes/compat/farmersdelight/cutting/akashic_log.json +ae2c6392cc0ec104c4e3019e1824a1e7f811f1de data/hexcasting/advancements/recipes/hexcasting.creative_tab/abacus.json +cc89232d202eec019f584e8c5cc044deee76036b data/hexcasting/recipes/amethyst_sconce.json +48b6d3429e3536a85f3a0e9585a7d252ae0d57a3 data/hexcasting/advancements/recipes/hexcasting.creative_tab/jeweler_hammer.json +bc100b94798f0b456877b42a5fc9aee7c4f25218 data/hexcasting/recipes/dye_colorizer_magenta.json +85ea4913eb07d67a976891e48a32d20879f31eaa data/hexcasting/recipes/dye_colorizer_light_gray.json +7caa7a8d9f8b0859f9507376bb715bdbe4b3fb56 data/hexcasting/recipes/dye_colorizer_blue.json +f8e027860b2505a7217d1264c5d0b6f7feea0679 data/hexcasting/advancements/recipes/hexcasting.creative_tab/edified_door.json +63da3af421dfb38283d750eb3b9761f42e95fb91 data/hexcasting/advancements/recipes/hexcasting.creative_tab/stripped_edified_wood.json +24984d728a5c05967c58be9c0dc1c59e986602e6 data/hexcasting/recipes/brainsweep/impetus_storedplayer.json +6e6c73a93e0e06ff399d95e40baf4e06f3a25a0a data/hexcasting/advancements/recipes/hexcasting.creative_tab/slate_block_from_slates.json +3662834d6e0bac03aba28f0f9d9f07f511492118 data/hexcasting/recipes/lens.json +afbeab63d6f09200c91014b0ba2570ed2a29fc52 data/hexcasting/advancements/recipes/brainsweep/brainsweep/testing/flowey_the_flower.json +336465276c06fc59be003ccad3d6fc121fa438f5 data/hexcasting/recipes/edified_staff.json +1086a6e3f284fc3b575ee3a21d2b13d0bc62d2bb data/hexcasting/recipes/brainsweep/impetus_rightclick.json +f91ab1d68c575970ef48ad499ec92057a8ee7b2e data/hexcasting/recipes/cypher.json +a331f4ce9b8d3565cbb154af4d63279f1e2c7a41 data/hexcasting/recipes/compat/farmersdelight/cutting/akashic_trapdoor.json +108421ab59fc52c69913676abda5e0a045fe1b04 data/hexcasting/recipes/pride_colorizer_gay.json +ceab17c3df28bb48bc9d99097051c601f5b981f5 data/hexcasting/advancements/recipes/hexcasting.creative_tab/akashic_connector.json +d603560d9bbe0bd3e9c0ca5cd502fe874337599e data/hexcasting/advancements/recipes/hexcasting.creative_tab/dye_colorizer_light_gray.json +0ee8d29cb06065a55017a8fc50576193107f958d data/hexcasting/recipes/dynamicseal_focus.json +8c49c1c022cee20fb2a44046425b48cd0e6659af data/hexcasting/advancements/recipes/hexcasting.creative_tab/birch_staff.json +12e1ba1ec29bf0eadf1210d2307fab35e9685085 data/hexcasting/recipes/empty_directrix.json +898319b3a4ee7a8d7bd7a4af0313593561ed657e data/hexcasting/advancements/recipes/hexcasting.creative_tab/scroll_paper.json +64f509c0496204d39c38a4a64a1fbe0f84b9e5ae data/hexcasting/advancements/recipes/hexcasting.creative_tab/dye_colorizer_magenta.json +a16ce751797baf92c3dd3f125b564e789aeec260 data/hexcasting/advancements/recipes/hexcasting.creative_tab/edified_planks.json +7df149b266e4f7925defd3b017163698070dbcb9 data/hexcasting/advancements/recipes/hexcasting.creative_tab/scroll_medium.json +dc2a9bf96ca9d04ea6bdeb32249322530b5e1cbf data/hexcasting/advancements/recipes/hexcasting.creative_tab/warped_staff.json +1ba5dada44ad7c008756f0e8e7adfe30e2520239 data/hexcasting/recipes/dye_colorizer_lime.json +b494dc17959c76857f25368eb845e58e4f8bca92 data/hexcasting/recipes/compat/farmersdelight/cutting/akashic_door.json +4bff4a59e32c6d1d99bc3a8abd16cd88c51a8e73 data/hexcasting/recipes/dye_colorizer_orange.json +1f04d75a1c713d3c5ac44e62889ce834f12d6234 data/hexcasting/recipes/jeweler_hammer.json +8a9e7aa8d07556649768729348dff5305b84e1b9 data/hexcasting/recipes/edified_door.json +993a613fabd0ee1005bde11ebe92f8046351ba9e data/hexcasting/advancements/recipes/hexcasting.creative_tab/trinket.json +2e02e371ed43f72f101588ce4fa6e7ac8b5ef471 data/hexcasting/recipes/scroll_medium.json +99ebed784d731042da34187b829e1b9560cbebb2 data/hexcasting/advancements/recipes/hexcasting.creative_tab/akashic_bookshelf.json +5627128775e24fb6281a0576a931cfa88a909bc0 data/hexcasting/recipes/slate_block_from_slates.json +6aa3e7825025d055a70a58acd4fd48eef0480721 data/hexcasting/recipes/edified_wood.json +783c691f24bc4259ba5da014133763dce26ee4bd data/hexcasting/recipes/crimson_staff.json +6479526ac6b8732814ea3feb97e877896c17f7b7 data/hexcasting/recipes/edified_trapdoor.json +6641b22c79fa29fab15d414afecabd3aa7402b38 data/hexcasting/advancements/recipes/hexcasting.creative_tab/scroll_paper_lantern.json +3ae790bef91b6ae57ed7e3e792740ea059875293 data/hexcasting/advancements/recipes/hexcasting.creative_tab/dye_colorizer_cyan.json +16c91a664dbe7914a7db566f45158c8191e52afb data/hexcasting/recipes/brainsweep/testing/bad_to_the_bone.json +f0a77ba758e649d0c16a8e2d9964d18f95a544f4 data/hexcasting/advancements/recipes/hexcasting.creative_tab/slate.json +f9e4d9171ffc6a125d9899f1867398acf8037b27 data/hexcasting/advancements/recipes/hexcasting.creative_tab/pride_colorizer_agender.json +ba08fd11d19f54c504ceed6f162a5d814e03d1e8 data/hexcasting/recipes/brainsweep/testing/flowey_the_flower.json +2e943ea3077aa46f16d78c04ab417677fc326e78 data/hexcasting/advancements/recipes/hexcasting.creative_tab/scroll_small.json +0d08dab8c9700c7b5b32ad35e7b665a2e3c2cdc7 data/hexcasting/advancements/recipes/hexcasting.creative_tab/artifact.json +01f8281d0b4b1fa7116989c9a01d71a3312d8d11 data/hexcasting/advancements/recipes/hexcasting.creative_tab/empty_directrix.json +202e70722198141d5dd961bb087a25873e4928af data/hexcasting/recipes/edified_stairs.json +b640608755649a8bde55a434016b14522fa6d2e0 data/hexcasting/advancements/recipes/hexcasting.creative_tab/edified_wood.json +d323e21de69d0606d1fac03fa8820e5857e4e1f1 data/hexcasting/recipes/dynamicseal_spellbook.json +08c200b6d3a3aacb434112aacab9851e7d5f6083 data/hexcasting/recipes/scroll_small.json +5902d75cd2474604f2bb1067187ba574eb1e15fc data/hexcasting/recipes/compat/farmersdelight/cutting/akashic_wood.json +07902912a9ca6f8da48ed579ec318bb760d4f8df data/hexcasting/recipes/pride_colorizer_nonbinary.json +7a51e934846a0d7fe00a808cfa22fd85da67fe9d data/hexcasting/recipes/brainsweep/impetus_look.json +a184ee70962538e4f8641c707d6dca8796ca36e7 data/hexcasting/recipes/edified_slab.json +22ff2d626da7f5fdc1411b4df75a6fc6a0e52df7 data/hexcasting/advancements/recipes/hexcasting.creative_tab/edified_slab.json +3de6a907c45a97e163caf043292bb693af58e453 data/hexcasting/advancements/recipes/hexcasting.creative_tab/crimson_staff.json +563d6b480a6ebf1c200c2ca7cd62ed305cbf9710 data/hexcasting/advancements/recipes/hexcasting.creative_tab/dye_colorizer_lime.json +b7fc41f8cfd83a0d138290251d63bb6cc04e0f9a data/hexcasting/recipes/edified_pressure_plate.json +3c552071e6b3cfd4932b8f1e8d8b91aae8ead99d data/hexcasting/advancements/recipes/hexcasting.creative_tab/dark_oak_staff.json +a58f37bc66e65c1ac00ba7dbc4d9a7b902f42aad data/hexcasting/advancements/recipes/hexcasting.creative_tab/oak_staff.json +13d03da2cfee5c29e5432806189e18eeefb76e11 data/hexcasting/advancements/recipes/hexcasting.creative_tab/pride_colorizer_gay.json +fc0476880c79cf4458dd5b24f77fc980b02534d2 data/hexcasting/recipes/edified_button.json +6f5ee50706640e9be82810e22388fc7b2bce13b1 data/hexcasting/recipes/birch_staff.json +e35c89ccc099c511c9ab321a7490d35f2e8c9353 data/hexcasting/advancements/recipes/hexcasting.creative_tab/amethyst_dust_packing.json +3127e275f4dc31d80a21f9119fcebc527e821caa data/hexcasting/recipes/brainsweep/directrix_redstone.json +735a7d770f23a02dc4ae93644e7f4c44a32e313a data/hexcasting/recipes/oak_staff.json +36c3ea4547b49c7553e7024192d5ddf6f2163422 data/hexcasting/recipes/scroll_paper_lantern.json +79ebc61817f6ef529c385fe3ed3ff9edb0761f96 data/hexcasting/advancements/recipes/hexcasting.creative_tab/pride_colorizer_genderfluid.json 5ffea2f9ccbb855ab3f5aca9cb572f57f26619ae data/hexcasting/recipes/amethyst_dust_unpacking.json c9c2b33afc4b5de1f10df08d901312ee1ded1c5e data/hexcasting/advancements/recipes/hexcasting.creative_tab/pride_colorizer_pansexual.json fa49dab810cff4f827d2662a93fc3439a8e99cba data/hexcasting/recipes/pride_colorizer_genderqueer.json 25df58c8b78028142c47deb060768d4fbfe2c38e data/hexcasting/advancements/recipes/hexcasting.creative_tab/pride_colorizer_nonbinary.json -3db193fa4246ffa5bbfa45ce901bbfaeada0a942 data/hexcasting/advancements/recipes/hexcasting.creative_tab/empty_impetus.json 182c2b5dd406c80ed957e1b43d554cce1b212d28 data/hexcasting/advancements/recipes/hexcasting.creative_tab/jungle_staff.json diff --git a/Fabric/src/generated/resources/data/hexcasting/advancements/recipes/hexcasting.creative_tab/focus_rotated.json b/Fabric/src/generated/resources/data/hexcasting/advancements/recipes/hexcasting.creative_tab/focus_rotated.json new file mode 100644 index 00000000..8b59755f --- /dev/null +++ b/Fabric/src/generated/resources/data/hexcasting/advancements/recipes/hexcasting.creative_tab/focus_rotated.json @@ -0,0 +1,32 @@ +{ + "parent": "minecraft:recipes/root", + "criteria": { + "has_item": { + "conditions": { + "items": [ + { + "tag": "hexcasting:staves" + } + ] + }, + "trigger": "minecraft:inventory_changed" + }, + "has_the_recipe": { + "conditions": { + "recipe": "hexcasting:focus_rotated" + }, + "trigger": "minecraft:recipe_unlocked" + } + }, + "requirements": [ + [ + "has_item", + "has_the_recipe" + ] + ], + "rewards": { + "recipes": [ + "hexcasting:focus_rotated" + ] + } +} \ No newline at end of file diff --git a/Fabric/src/generated/resources/data/hexcasting/recipes/focus.json b/Fabric/src/generated/resources/data/hexcasting/recipes/focus.json index 6f1159d9..4cbe4bee 100644 --- a/Fabric/src/generated/resources/data/hexcasting/recipes/focus.json +++ b/Fabric/src/generated/resources/data/hexcasting/recipes/focus.json @@ -1,7 +1,10 @@ { "type": "minecraft:crafting_shaped", "key": { - "C": [ + "A": { + "item": "hexcasting:charged_amethyst" + }, + "G": [ { "item": "minecraft:glowstone_dust" }, @@ -9,17 +12,17 @@ "tag": "c:glowstone_dusts" } ], - "D": { + "L": { "item": "minecraft:leather" }, - "I": { - "item": "hexcasting:charged_amethyst" + "P": { + "item": "minecraft:paper" } }, "pattern": [ - "DCD", - "CIC", - "DCD" + "GLG", + "PAP", + "GLG" ], "result": { "item": "hexcasting:focus" diff --git a/Fabric/src/generated/resources/data/hexcasting/recipes/focus_rotated.json b/Fabric/src/generated/resources/data/hexcasting/recipes/focus_rotated.json new file mode 100644 index 00000000..e1636817 --- /dev/null +++ b/Fabric/src/generated/resources/data/hexcasting/recipes/focus_rotated.json @@ -0,0 +1,30 @@ +{ + "type": "minecraft:crafting_shaped", + "key": { + "A": { + "item": "hexcasting:charged_amethyst" + }, + "G": [ + { + "item": "minecraft:glowstone_dust" + }, + { + "tag": "c:glowstone_dusts" + } + ], + "L": { + "item": "minecraft:leather" + }, + "P": { + "item": "minecraft:paper" + } + }, + "pattern": [ + "GPG", + "LAL", + "GPG" + ], + "result": { + "item": "hexcasting:focus" + } +} \ No newline at end of file diff --git a/Fabric/src/generated/resources/data/hexcasting/tags/items/seal_materials.json b/Fabric/src/generated/resources/data/hexcasting/tags/items/seal_materials.json new file mode 100644 index 00000000..ae13fc41 --- /dev/null +++ b/Fabric/src/generated/resources/data/hexcasting/tags/items/seal_materials.json @@ -0,0 +1,6 @@ +{ + "replace": false, + "values": [ + "minecraft:honeycomb" + ] +} \ No newline at end of file diff --git a/Fabric/src/main/java/at/petrak/hexcasting/fabric/FabricHexInitializer.kt b/Fabric/src/main/java/at/petrak/hexcasting/fabric/FabricHexInitializer.kt index 423e0849..8cd89640 100644 --- a/Fabric/src/main/java/at/petrak/hexcasting/fabric/FabricHexInitializer.kt +++ b/Fabric/src/main/java/at/petrak/hexcasting/fabric/FabricHexInitializer.kt @@ -30,7 +30,6 @@ import at.petrak.hexcasting.fabric.interop.gravity.OpChangeGravity import at.petrak.hexcasting.fabric.interop.gravity.OpGetGravity import at.petrak.hexcasting.fabric.network.FabricPacketHandler import at.petrak.hexcasting.fabric.recipe.FabricModConditionalIngredient -import at.petrak.hexcasting.fabric.recipe.FabricUnsealedIngredient import at.petrak.hexcasting.fabric.storage.FabricImpetusStorage import at.petrak.hexcasting.interop.HexInterop import at.petrak.hexcasting.xplat.IXplatAbstractions @@ -111,7 +110,7 @@ object FabricHexInitializer : ModInitializer { HexBlocks.registerBlockItems(bind(Registry.ITEM)) HexBlockEntities.registerTiles(bind(Registry.BLOCK_ENTITY_TYPE)) HexItems.registerItems(bind(Registry.ITEM)) - Registry.register(IngredientDeserializer.REGISTRY, FabricUnsealedIngredient.ID, FabricUnsealedIngredient.Deserializer.INSTANCE) +// Registry.register(IngredientDeserializer.REGISTRY, FabricUnsealedIngredient.ID, FabricUnsealedIngredient.Deserializer.INSTANCE) Registry.register(IngredientDeserializer.REGISTRY, FabricModConditionalIngredient.ID, FabricModConditionalIngredient.Deserializer.INSTANCE) HexEntities.registerEntities(bind(Registry.ENTITY_TYPE)) diff --git a/Forge/src/generated/resources/.cache/03e4de26f1265135874f8cdcaebc09d9c08eb42b b/Forge/src/generated/resources/.cache/03e4de26f1265135874f8cdcaebc09d9c08eb42b index 6809751e..9c2fdecc 100644 --- a/Forge/src/generated/resources/.cache/03e4de26f1265135874f8cdcaebc09d9c08eb42b +++ b/Forge/src/generated/resources/.cache/03e4de26f1265135874f8cdcaebc09d9c08eb42b @@ -1,10 +1,11 @@ -// 1.19.2 2023-01-22T12:41:48.309723436 Tags for minecraft:item +// 1.19.2 2023-01-22T20:49:42.812181588 Tags for minecraft:item 2f5c5bd21580004c998765215166adaa72e0d96b data/forge/tags/items/dusts/amethyst.json 873bab891e0827973ebfe9fedd352c95778d7fbe data/forge/tags/items/gems.json 42c76a43081acfb0194e2cee6de18104fb0ba5ad data/hexcasting/tags/items/edified_logs.json 86828f8056bfdfdd2aff10d7a9dbc6c269c25b8a data/hexcasting/tags/items/edified_planks.json 03bd3a58ae7367d6a21eb3acbbd70fe65a41b8f6 data/hexcasting/tags/items/grants_root_advancement.json 7f7d5f6cc9b5cfb39d240fc901c4ae2d2037ec14 data/hexcasting/tags/items/phial_base.json +d878c230cd5cb1b54fbe6e53f3ef71379d080c6f data/hexcasting/tags/items/seal_materials.json 29bbe0aca81c2498b790dbf8e0fd837a07ed9090 data/hexcasting/tags/items/staves.json 841dfbe4970e9167b205e5aa2b0f0936c6b9af60 data/minecraft/tags/items/buttons.json cba96d2ff28087e7fd9807e5e80104f3befc2512 data/minecraft/tags/items/doors.json diff --git a/Forge/src/generated/resources/.cache/9fb1092f32d4fcbf9e061ffd718d4ec689c6c95e b/Forge/src/generated/resources/.cache/9fb1092f32d4fcbf9e061ffd718d4ec689c6c95e index 5887c16a..275e2cf4 100644 --- a/Forge/src/generated/resources/.cache/9fb1092f32d4fcbf9e061ffd718d4ec689c6c95e +++ b/Forge/src/generated/resources/.cache/9fb1092f32d4fcbf9e061ffd718d4ec689c6c95e @@ -1,4 +1,4 @@ -// 1.19.2 2023-01-22T19:58:44.861340174 Recipes +// 1.19.2 2023-01-22T20:49:42.813938013 Recipes 29056d8bbc023668564ee81f4eb8b2a11411cf4a data/create/recipes/crushing/amethyst_block.json 5bb0b70967a422bfd88c01fa1af64e9b98781fd1 data/create/recipes/crushing/amethyst_cluster.json 229931adf8d62f659de5950d711afd24fb5aa535 data/hexcasting/advancements/recipes/brainsweep/brainsweep/akashic_record.json @@ -55,6 +55,7 @@ b640608755649a8bde55a434016b14522fa6d2e0 data/hexcasting/advancements/recipes/he 01f8281d0b4b1fa7116989c9a01d71a3312d8d11 data/hexcasting/advancements/recipes/hexcasting/empty_directrix.json 3db193fa4246ffa5bbfa45ce901bbfaeada0a942 data/hexcasting/advancements/recipes/hexcasting/empty_impetus.json dfc171097bdd8a8f280e6787ea999286deda643e data/hexcasting/advancements/recipes/hexcasting/focus.json +b21a84886b937a4c4e72a674f265dccb21411ab9 data/hexcasting/advancements/recipes/hexcasting/focus_rotated.json 48b6d3429e3536a85f3a0e9585a7d252ae0d57a3 data/hexcasting/advancements/recipes/hexcasting/jeweler_hammer.json 182c2b5dd406c80ed957e1b43d554cce1b212d28 data/hexcasting/advancements/recipes/hexcasting/jungle_staff.json 8715e71c2fb59ee458ce217040c9a8dd0db04789 data/hexcasting/advancements/recipes/hexcasting/lens.json @@ -152,7 +153,8 @@ a184ee70962538e4f8641c707d6dca8796ca36e7 data/hexcasting/recipes/edified_slab.js 6aa3e7825025d055a70a58acd4fd48eef0480721 data/hexcasting/recipes/edified_wood.json 12e1ba1ec29bf0eadf1210d2307fab35e9685085 data/hexcasting/recipes/empty_directrix.json c7d28ccf9df6fc46aa142c2e7b176cc0cb5ea62b data/hexcasting/recipes/empty_impetus.json -74e43d276dad1bb6d6d9fb846cc79e6b5b5bc833 data/hexcasting/recipes/focus.json +b8145fb8e02d64d1f098ab915f11541c418bb6e3 data/hexcasting/recipes/focus.json +1b1918b442ac43eec34e29f53506380a84809977 data/hexcasting/recipes/focus_rotated.json f124395483d1ae0e10b7db2b1828f1a4e269a88c data/hexcasting/recipes/jeweler_hammer.json a776209b64fea520f6a2fff9f1623e7086939dd9 data/hexcasting/recipes/jungle_staff.json 3662834d6e0bac03aba28f0f9d9f07f511492118 data/hexcasting/recipes/lens.json diff --git a/Forge/src/generated/resources/data/hexcasting/advancements/recipes/hexcasting/focus_rotated.json b/Forge/src/generated/resources/data/hexcasting/advancements/recipes/hexcasting/focus_rotated.json new file mode 100644 index 00000000..8b59755f --- /dev/null +++ b/Forge/src/generated/resources/data/hexcasting/advancements/recipes/hexcasting/focus_rotated.json @@ -0,0 +1,32 @@ +{ + "parent": "minecraft:recipes/root", + "criteria": { + "has_item": { + "conditions": { + "items": [ + { + "tag": "hexcasting:staves" + } + ] + }, + "trigger": "minecraft:inventory_changed" + }, + "has_the_recipe": { + "conditions": { + "recipe": "hexcasting:focus_rotated" + }, + "trigger": "minecraft:recipe_unlocked" + } + }, + "requirements": [ + [ + "has_item", + "has_the_recipe" + ] + ], + "rewards": { + "recipes": [ + "hexcasting:focus_rotated" + ] + } +} \ No newline at end of file diff --git a/Forge/src/generated/resources/data/hexcasting/recipes/focus.json b/Forge/src/generated/resources/data/hexcasting/recipes/focus.json index c3550d40..54d2ce47 100644 --- a/Forge/src/generated/resources/data/hexcasting/recipes/focus.json +++ b/Forge/src/generated/resources/data/hexcasting/recipes/focus.json @@ -1,20 +1,23 @@ { "type": "minecraft:crafting_shaped", "key": { - "C": { + "A": { + "item": "hexcasting:charged_amethyst" + }, + "G": { "tag": "forge:dusts/glowstone" }, - "D": { + "L": { "tag": "forge:leather" }, - "I": { - "item": "hexcasting:charged_amethyst" + "P": { + "item": "minecraft:paper" } }, "pattern": [ - "DCD", - "CIC", - "DCD" + "GLG", + "PAP", + "GLG" ], "result": { "item": "hexcasting:focus" diff --git a/Forge/src/generated/resources/data/hexcasting/recipes/focus_rotated.json b/Forge/src/generated/resources/data/hexcasting/recipes/focus_rotated.json new file mode 100644 index 00000000..30000d43 --- /dev/null +++ b/Forge/src/generated/resources/data/hexcasting/recipes/focus_rotated.json @@ -0,0 +1,25 @@ +{ + "type": "minecraft:crafting_shaped", + "key": { + "A": { + "item": "hexcasting:charged_amethyst" + }, + "G": { + "tag": "forge:dusts/glowstone" + }, + "L": { + "tag": "forge:leather" + }, + "P": { + "item": "minecraft:paper" + } + }, + "pattern": [ + "GPG", + "LAL", + "GPG" + ], + "result": { + "item": "hexcasting:focus" + } +} \ No newline at end of file diff --git a/Forge/src/generated/resources/data/hexcasting/tags/items/seal_materials.json b/Forge/src/generated/resources/data/hexcasting/tags/items/seal_materials.json new file mode 100644 index 00000000..674a3700 --- /dev/null +++ b/Forge/src/generated/resources/data/hexcasting/tags/items/seal_materials.json @@ -0,0 +1,5 @@ +{ + "values": [ + "minecraft:honeycomb" + ] +} \ No newline at end of file From 01f461f8c60716127ecb75d5d2f8b7fae33a9dbe Mon Sep 17 00:00:00 2001 From: "petrak@" Date: Sun, 22 Jan 2023 21:15:45 -0600 Subject: [PATCH 58/95] can no longer seal unwritten things --- .../petrak/hexcasting/common/recipe/SealThingsRecipe.java | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/Common/src/main/java/at/petrak/hexcasting/common/recipe/SealThingsRecipe.java b/Common/src/main/java/at/petrak/hexcasting/common/recipe/SealThingsRecipe.java index b02bc7c3..99941f1f 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/recipe/SealThingsRecipe.java +++ b/Common/src/main/java/at/petrak/hexcasting/common/recipe/SealThingsRecipe.java @@ -101,8 +101,12 @@ public class SealThingsRecipe extends CustomRecipe { public boolean isCorrectSealee(ItemStack stack) { return switch (this) { - case FOCUS -> stack.is(HexItems.FOCUS) && !ItemFocus.isSealed(stack); - case SPELLBOOK -> stack.is(HexItems.SPELLBOOK) && !ItemSpellbook.isSealed(stack); + case FOCUS -> stack.is(HexItems.FOCUS) + && HexItems.FOCUS.readIotaTag(stack) != null + && !ItemFocus.isSealed(stack); + case SPELLBOOK -> stack.is(HexItems.SPELLBOOK) + && HexItems.SPELLBOOK.readIotaTag(stack) != null + && !ItemSpellbook.isSealed(stack); }; } From e665432718c2b1d0c170c87ad6f486cf0495f7a2 Mon Sep 17 00:00:00 2001 From: "petrak@" Date: Sun, 22 Jan 2023 21:18:25 -0600 Subject: [PATCH 59/95] easiest bugfix ever, fix #352 --- .../petrak/hexcasting/api/casting/eval/SpecialPatterns.java | 6 +++--- .../hexcasting/common/lib/hex/HexSpecialHandlers.java | 5 ----- 2 files changed, 3 insertions(+), 8 deletions(-) diff --git a/Common/src/main/java/at/petrak/hexcasting/api/casting/eval/SpecialPatterns.java b/Common/src/main/java/at/petrak/hexcasting/api/casting/eval/SpecialPatterns.java index b2276968..4aee723a 100644 --- a/Common/src/main/java/at/petrak/hexcasting/api/casting/eval/SpecialPatterns.java +++ b/Common/src/main/java/at/petrak/hexcasting/api/casting/eval/SpecialPatterns.java @@ -4,7 +4,7 @@ import at.petrak.hexcasting.api.casting.math.HexDir; import at.petrak.hexcasting.api.casting.math.HexPattern; public final class SpecialPatterns { - public static final HexPattern INTROSPECTION = HexPattern.fromAngles("qqq", HexDir.WEST); - public static final HexPattern RETROSPECTION = HexPattern.fromAngles("eee", HexDir.EAST); - public static final HexPattern CONSIDERATION = HexPattern.fromAngles("qqqaw", HexDir.EAST); + public static final HexPattern INTROSPECTION = HexPattern.fromAngles("qqq", HexDir.WEST); + public static final HexPattern RETROSPECTION = HexPattern.fromAngles("eee", HexDir.EAST); + public static final HexPattern CONSIDERATION = HexPattern.fromAngles("qqqaw", HexDir.WEST); } diff --git a/Common/src/main/java/at/petrak/hexcasting/common/lib/hex/HexSpecialHandlers.java b/Common/src/main/java/at/petrak/hexcasting/common/lib/hex/HexSpecialHandlers.java index bd8c6837..ff8da1d0 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/lib/hex/HexSpecialHandlers.java +++ b/Common/src/main/java/at/petrak/hexcasting/common/lib/hex/HexSpecialHandlers.java @@ -3,8 +3,6 @@ package at.petrak.hexcasting.common.lib.hex; import at.petrak.hexcasting.api.casting.castables.SpecialHandler; import at.petrak.hexcasting.common.casting.operators.math.SpecialHandlerNumberLiteral; import at.petrak.hexcasting.common.casting.operators.stack.SpecialHandlerMask; -import at.petrak.hexcasting.xplat.IXplatAbstractions; -import net.minecraft.core.Registry; import net.minecraft.resources.ResourceLocation; import java.util.LinkedHashMap; @@ -14,9 +12,6 @@ import java.util.function.BiConsumer; import static at.petrak.hexcasting.api.HexAPI.modLoc; public class HexSpecialHandlers { - public static final Registry> REGISTRY = - IXplatAbstractions.INSTANCE.getSpecialHandlerRegistry(); - private static final Map> SPECIAL_HANDLERS = new LinkedHashMap<>(); public static final SpecialHandler.Factory NUMBER = make("number", From 18cab3e0e3388f60af6118937c41aa7ce97a5380 Mon Sep 17 00:00:00 2001 From: "petrak@" Date: Sun, 22 Jan 2023 21:19:22 -0600 Subject: [PATCH 60/95] fix #368 --- Common/src/main/resources/assets/hexcasting/lang/en_us.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Common/src/main/resources/assets/hexcasting/lang/en_us.json b/Common/src/main/resources/assets/hexcasting/lang/en_us.json index 4b3c1661..3d374747 100644 --- a/Common/src/main/resources/assets/hexcasting/lang/en_us.json +++ b/Common/src/main/resources/assets/hexcasting/lang/en_us.json @@ -75,7 +75,8 @@ "entity.hexcasting.wall_scroll": "Hanging Scroll", - "block.hexcasting.conjured": "Conjured Block", + "block.hexcasting.conjured": "Conjured Light", + "block.hexcasting.conjured_block": "Conjured Block", "block.hexcasting.slate.blank": "Blank Slate", "block.hexcasting.slate.written": "Patterned Slate", "block.hexcasting.empty_impetus": "Empty Impetus", From edc4012f6917064e62eec237a5508f109c6b4f39 Mon Sep 17 00:00:00 2001 From: "petrak@" Date: Sun, 22 Jan 2023 21:59:48 -0600 Subject: [PATCH 61/95] loot cleanup wip! --- .../hexcasting/api/misc/ScrollQuantity.java | 12 ++--- .../common/loot/HexLootHandler.java | 29 ++++++++++++ .../hexcasting/datagen/HexLootTables.java | 22 +++++----- .../hexcasting/forge/ForgeHexInitializer.java | 3 ++ .../ForgeHexArgumentTypeRegistry.java | 5 ++- .../forge/lib/ForgeHexLootMods.java | 17 +++++++ .../forge/loot/ForgeHexScrollLootMod.java | 44 +++++++++++++++++++ 7 files changed, 115 insertions(+), 17 deletions(-) rename Forge/src/main/java/at/petrak/hexcasting/forge/{ => lib}/ForgeHexArgumentTypeRegistry.java (92%) create mode 100644 Forge/src/main/java/at/petrak/hexcasting/forge/lib/ForgeHexLootMods.java create mode 100644 Forge/src/main/java/at/petrak/hexcasting/forge/loot/ForgeHexScrollLootMod.java diff --git a/Common/src/main/java/at/petrak/hexcasting/api/misc/ScrollQuantity.java b/Common/src/main/java/at/petrak/hexcasting/api/misc/ScrollQuantity.java index bc262ea3..9b899878 100644 --- a/Common/src/main/java/at/petrak/hexcasting/api/misc/ScrollQuantity.java +++ b/Common/src/main/java/at/petrak/hexcasting/api/misc/ScrollQuantity.java @@ -6,15 +6,17 @@ import org.jetbrains.annotations.Nullable; import static at.petrak.hexcasting.api.HexAPI.modLoc; public enum ScrollQuantity { - NONE(null), - FEW(modLoc("inject/scroll_loot_few")), - SOME(modLoc("inject/scroll_loot_some")), - MANY(modLoc("inject/scroll_loot_many")); + NONE(null, 0), + FEW(modLoc("inject/scroll_loot_few"), 2), + SOME(modLoc("inject/scroll_loot_some"), 3), + MANY(modLoc("inject/scroll_loot_many"), 4); private final ResourceLocation pool; + public final int countRange; - ScrollQuantity(ResourceLocation pool) { + ScrollQuantity(ResourceLocation pool, int countRange) { this.pool = pool; + this.countRange = countRange; } @Nullable diff --git a/Common/src/main/java/at/petrak/hexcasting/common/loot/HexLootHandler.java b/Common/src/main/java/at/petrak/hexcasting/common/loot/HexLootHandler.java index c4b86324..df323794 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/loot/HexLootHandler.java +++ b/Common/src/main/java/at/petrak/hexcasting/common/loot/HexLootHandler.java @@ -2,6 +2,7 @@ package at.petrak.hexcasting.common.loot; import at.petrak.hexcasting.api.misc.ScrollQuantity; import at.petrak.hexcasting.api.mod.HexConfig; +import net.minecraft.Util; import net.minecraft.resources.ResourceLocation; import net.minecraft.world.level.block.Blocks; import net.minecraft.world.level.storage.loot.LootPool; @@ -9,12 +10,40 @@ import net.minecraft.world.level.storage.loot.entries.LootPoolEntryContainer; import net.minecraft.world.level.storage.loot.entries.LootTableReference; import net.minecraft.world.level.storage.loot.providers.number.UniformGenerator; +import java.util.EnumMap; +import java.util.List; import java.util.function.Consumer; import static at.petrak.hexcasting.api.HexAPI.modLoc; // https://github.com/VazkiiMods/Botania/blob/1.18.x/Xplat/src/main/java/vazkii/botania/common/loot/LootHandler.java +// We need to inject dungeon loot (scrolls and lore), make amethyst drop fewer shards, and the extra dust stuff. +// On forge we do it the "right" way with global loot modifiers; modifiable via a datapack. +// On fabric we do the addition of items by mixing in to loot loading and injecting some loot tables we only generate on +// Fabric as addons, and the subtraction with a loot function. so it's customizable for datapack devs. public class HexLootHandler { + // TODO: remove ScrollQuantity, use this class as the source of truth for GLM gen on forge and inject/ loot tables + // on fabric + public static final EnumMap> DEFAULT_INJECTS = Util.make(() -> { + var map = new EnumMap>(ScrollQuantity.class); + + map.put(ScrollQuantity.FEW, List.of( + new ResourceLocation("minecraft", "chests/jungle_temple"), + new ResourceLocation("minecraft", "chests/simple_dungeon"), + new ResourceLocation("minecraft", "chests/village/village_cartographer"))); + map.put(ScrollQuantity.SOME, List.of( + new ResourceLocation("minecraft", "chests/bastion_treasure"), + new ResourceLocation("minecraft", "chests/pillager_outpost"), + new ResourceLocation("minecraft", "chests/shipwreck_map") + )); + map.put(ScrollQuantity.MANY, List.of( + // ancient city chests have amethyst in them, thinking emoji + new ResourceLocation("minecraft", "chests/ancient_city"), + new ResourceLocation("minecraft", "chests/stronghold_library"))); + + return map; + }); + public static final ResourceLocation FUNC_AMETHYST_SHARD_REDUCER = modLoc("amethyst_shard_reducer"); public static final ResourceLocation TABLE_INJECT_AMETHYST_CLUSTER = modLoc("inject/amethyst_cluster"); diff --git a/Common/src/main/java/at/petrak/hexcasting/datagen/HexLootTables.java b/Common/src/main/java/at/petrak/hexcasting/datagen/HexLootTables.java index 51b41ef9..931edf5a 100644 --- a/Common/src/main/java/at/petrak/hexcasting/datagen/HexLootTables.java +++ b/Common/src/main/java/at/petrak/hexcasting/datagen/HexLootTables.java @@ -1,5 +1,6 @@ package at.petrak.hexcasting.datagen; +import at.petrak.hexcasting.api.misc.ScrollQuantity; import at.petrak.hexcasting.common.blocks.circles.BlockEntitySlate; import at.petrak.hexcasting.common.lib.HexBlocks; import at.petrak.hexcasting.common.lib.HexItems; @@ -101,19 +102,19 @@ public class HexLootTables extends PaucalLootTableProvider { .apply(SetItemCountFunction.setCount(ConstantValue.exactly(1))) .when(noSilkTouchCond).when(goodAtAmethystingCond) .when(BonusLevelTableCondition.bonusLevelFlatChance(Enchantments.BLOCK_FORTUNE, - 0.25f, 0.35f, 0.5f, 0.75f, 1.0f)); + 0.25f, 0.35f, 0.5f, 0.75f, 1.0f)); var isThatAnMFingBadBrandonSandersonReference = LootPool.lootPool() - .add(LootItem.lootTableItem(HexItems.CHARGED_AMETHYST)) - .apply(SetItemCountFunction.setCount(ConstantValue.exactly(1))) - .when(noSilkTouchCond).when(goodAtAmethystingCond.invert()) - .when(LootItemRandomChanceCondition.randomChance(0.125f)); + .add(LootItem.lootTableItem(HexItems.CHARGED_AMETHYST)) + .apply(SetItemCountFunction.setCount(ConstantValue.exactly(1))) + .when(noSilkTouchCond).when(goodAtAmethystingCond.invert()) + .when(LootItemRandomChanceCondition.randomChance(0.125f)); lootTables.put(HexLootHandler.TABLE_INJECT_AMETHYST_CLUSTER, LootTable.lootTable() - .withPool(dustPoolWhenGood) - .withPool(dustPoolWhenBad) - .withPool(isThatAnMFingBrandonSandersonReference) - .withPool(isThatAnMFingBadBrandonSandersonReference)); + .withPool(dustPoolWhenGood) + .withPool(dustPoolWhenBad) + .withPool(isThatAnMFingBrandonSandersonReference) + .withPool(isThatAnMFingBadBrandonSandersonReference)); String[] rarities = new String[]{ "few", @@ -121,7 +122,8 @@ public class HexLootTables extends PaucalLootTableProvider { "many" }; for (int i = 0; i < rarities.length; i++) { - var scrollPool = makeScrollAdder(i + 1); + var quantity = ScrollQuantity.values()[i + 1]; + var scrollPool = makeScrollAdder(quantity.countRange); lootTables.put(modLoc("inject/scroll_loot_" + rarities[i]), scrollPool); } } diff --git a/Forge/src/main/java/at/petrak/hexcasting/forge/ForgeHexInitializer.java b/Forge/src/main/java/at/petrak/hexcasting/forge/ForgeHexInitializer.java index 35361d02..8c7afea5 100644 --- a/Forge/src/main/java/at/petrak/hexcasting/forge/ForgeHexInitializer.java +++ b/Forge/src/main/java/at/petrak/hexcasting/forge/ForgeHexInitializer.java @@ -26,6 +26,8 @@ import at.petrak.hexcasting.forge.cap.ForgeCapabilityHandler; import at.petrak.hexcasting.forge.datagen.HexForgeDataGenerators; import at.petrak.hexcasting.forge.interop.curios.CuriosApiInterop; import at.petrak.hexcasting.forge.interop.curios.CuriosRenderers; +import at.petrak.hexcasting.forge.lib.ForgeHexArgumentTypeRegistry; +import at.petrak.hexcasting.forge.lib.ForgeHexLootMods; import at.petrak.hexcasting.forge.network.ForgePacketHandler; import at.petrak.hexcasting.forge.network.MsgBrainsweepAck; import at.petrak.hexcasting.forge.recipe.ForgeModConditionalIngredient; @@ -111,6 +113,7 @@ public class ForgeHexInitializer { bind(IXplatAbstractions.INSTANCE.getEvalSoundRegistry().key(), HexEvalSounds::register); ForgeHexArgumentTypeRegistry.ARGUMENT_TYPES.register(getModEventBus()); + ForgeHexLootMods.REGISTRY.register(getModEventBus()); HexAdvancementTriggers.registerTriggers(); } diff --git a/Forge/src/main/java/at/petrak/hexcasting/forge/ForgeHexArgumentTypeRegistry.java b/Forge/src/main/java/at/petrak/hexcasting/forge/lib/ForgeHexArgumentTypeRegistry.java similarity index 92% rename from Forge/src/main/java/at/petrak/hexcasting/forge/ForgeHexArgumentTypeRegistry.java rename to Forge/src/main/java/at/petrak/hexcasting/forge/lib/ForgeHexArgumentTypeRegistry.java index e8c01ab6..4a345037 100644 --- a/Forge/src/main/java/at/petrak/hexcasting/forge/ForgeHexArgumentTypeRegistry.java +++ b/Forge/src/main/java/at/petrak/hexcasting/forge/lib/ForgeHexArgumentTypeRegistry.java @@ -1,4 +1,4 @@ -package at.petrak.hexcasting.forge; +package at.petrak.hexcasting.forge.lib; import at.petrak.hexcasting.api.HexAPI; import at.petrak.hexcasting.common.command.PatternResLocArgument; @@ -16,7 +16,8 @@ public class ForgeHexArgumentTypeRegistry { ForgeRegistries.COMMAND_ARGUMENT_TYPES, HexAPI.MOD_ID); // how fucking ergonomic - public static final RegistryObject.Template>> + public static final RegistryObject.Template>> PATTERN_RESLOC = register(PatternResLocArgument.class, "pattern", SingletonArgumentInfo.contextFree(PatternResLocArgument::id) diff --git a/Forge/src/main/java/at/petrak/hexcasting/forge/lib/ForgeHexLootMods.java b/Forge/src/main/java/at/petrak/hexcasting/forge/lib/ForgeHexLootMods.java new file mode 100644 index 00000000..c1180fbf --- /dev/null +++ b/Forge/src/main/java/at/petrak/hexcasting/forge/lib/ForgeHexLootMods.java @@ -0,0 +1,17 @@ +package at.petrak.hexcasting.forge.lib; + +import at.petrak.hexcasting.api.HexAPI; +import at.petrak.hexcasting.forge.loot.ForgeHexScrollLootMod; +import com.mojang.serialization.Codec; +import net.minecraftforge.common.loot.IGlobalLootModifier; +import net.minecraftforge.registries.DeferredRegister; +import net.minecraftforge.registries.ForgeRegistries; +import net.minecraftforge.registries.RegistryObject; + +public class ForgeHexLootMods { + public static final DeferredRegister> REGISTRY = DeferredRegister.create( + ForgeRegistries.Keys.GLOBAL_LOOT_MODIFIER_SERIALIZERS, HexAPI.MOD_ID); + + public static final RegistryObject> INJECT_SCROLLS = REGISTRY.register( + "inject_scrolls", ForgeHexScrollLootMod.CODEC); +} diff --git a/Forge/src/main/java/at/petrak/hexcasting/forge/loot/ForgeHexScrollLootMod.java b/Forge/src/main/java/at/petrak/hexcasting/forge/loot/ForgeHexScrollLootMod.java new file mode 100644 index 00000000..5164986d --- /dev/null +++ b/Forge/src/main/java/at/petrak/hexcasting/forge/loot/ForgeHexScrollLootMod.java @@ -0,0 +1,44 @@ +package at.petrak.hexcasting.forge.loot; + +import at.petrak.hexcasting.api.misc.ScrollQuantity; +import com.google.common.base.Suppliers; +import com.mojang.serialization.Codec; +import com.mojang.serialization.codecs.RecordCodecBuilder; +import it.unimi.dsi.fastutil.objects.ObjectArrayList; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.level.storage.loot.LootContext; +import net.minecraft.world.level.storage.loot.predicates.LootItemCondition; +import net.minecraftforge.common.loot.IGlobalLootModifier; +import net.minecraftforge.common.loot.LootModifier; +import org.jetbrains.annotations.NotNull; + +import java.util.function.Supplier; + +public class ForgeHexScrollLootMod extends LootModifier { + public static final Supplier> CODEC = + Suppliers.memoize(() -> RecordCodecBuilder.create( + inst -> codecStart(inst).and( + Codec.INT.fieldOf("quantity").forGetter(it -> it.quantity.ordinal()) + ).apply(inst, (cond, quant) -> new ForgeHexScrollLootMod(cond, ScrollQuantity.values()[quant])) + )); + + public final ScrollQuantity quantity; + + public ForgeHexScrollLootMod(LootItemCondition[] conditionsIn, ScrollQuantity quantity) { + super(conditionsIn); + this.quantity = quantity; + } + + @Override + protected @NotNull ObjectArrayList doApply(ObjectArrayList generatedLoot, + LootContext context) { + var injectedTable = context.getLootTable(this.quantity.getPool()); + injectedTable.getRandomItemsRaw(context, generatedLoot::add); + return generatedLoot; + } + + @Override + public Codec codec() { + return null; + } +} From aca2c19be65deec76a66de11de8f74f2973f3437 Mon Sep 17 00:00:00 2001 From: "petrak@" Date: Sun, 22 Jan 2023 23:59:19 -0600 Subject: [PATCH 62/95] first smoketestable --- .../hexcasting/api/misc/ScrollQuantity.java | 26 ----- .../petrak/hexcasting/api/mod/HexConfig.java | 8 -- .../common/lib/HexLootFunctions.java | 4 +- ...va => AddPerWorldPatternToScrollFunc.java} | 28 ++++-- .../common/loot/AmethystReducerFunc.java | 10 +- .../common/loot/HexLootHandler.java | 99 ++++++++----------- .../hexcasting/datagen/HexLootTables.java | 24 ----- .../assets/hexcasting/lang/en_us.json | 11 ++- Common/src/main/resources/hexplat.mixins.json | 1 - .../03e4de26f1265135874f8cdcaebc09d9c08eb42b | 2 +- .../67cce32b1c3cbbcb1f646605f4914e3f196986c2 | 5 +- .../75bcd4dba6ca7d365462b0ec45e291d1056349c4 | 2 +- .../844611d4af49e23072b8a888c8e73c6c5d8c0768 | 2 +- .../9fb1092f32d4fcbf9e061ffd718d4ec689c6c95e | 2 +- .../loot_tables/inject/scroll_loot_few.json | 23 ----- .../loot_tables/inject/scroll_loot_many.json | 23 ----- .../loot_tables/inject/scroll_loot_some.json | 23 ----- .../hexcasting/fabric/FabricHexConfig.java | 57 ++++++----- .../hexcasting/fabric/FabricHexInitializer.kt | 10 +- .../fabric/loot/FabricHexLootModJankery.java | 46 +++++++++ .../FabricMixinReloadableServerResources.java | 11 ++- .../main/resources/fabricasting.mixins.json | 5 +- .../67cce32b1c3cbbcb1f646605f4914e3f196986c2 | 5 +- .../d4b3e6634c30118e1127c02b727ea285752e5aac | 17 ++++ .../loot_modifiers/global_loot_modifiers.json | 20 ++++ .../loot_modifiers/amethyst_cluster.json | 10 ++ .../minecraft/chests/abandoned_mineshaft.json | 10 ++ .../scroll/minecraft/chests/ancient_city.json | 10 ++ .../minecraft/chests/bastion_other.json | 10 ++ .../minecraft/chests/bastion_treasure.json | 10 ++ .../minecraft/chests/desert_pyramid.json | 10 ++ .../minecraft/chests/end_city_treasure.json | 10 ++ .../minecraft/chests/jungle_temple.json | 10 ++ .../minecraft/chests/nether_bridge.json | 10 ++ .../minecraft/chests/pillager_outpost.json | 10 ++ .../minecraft/chests/shipwreck_map.json | 10 ++ .../minecraft/chests/simple_dungeon.json | 10 ++ .../minecraft/chests/stronghold_library.json | 10 ++ .../chests/village/village_cartographer.json | 10 ++ .../minecraft/chests/woodland_mansion.json | 10 ++ .../loot_tables/inject/scroll_loot_few.json | 23 ----- .../loot_tables/inject/scroll_loot_many.json | 23 ----- .../loot_tables/inject/scroll_loot_some.json | 23 ----- .../hexcasting/forge/ForgeHexConfig.java | 40 -------- .../hexcasting/forge/ForgeHexInitializer.java | 10 +- ...er.java => ForgeHexConditionsBuilder.java} | 7 +- ...ators.java => ForgeHexDataGenerators.java} | 6 +- .../forge/datagen/ForgeHexLootModGen.java | 31 ++++++ .../forge/lib/ForgeHexLootMods.java | 3 + .../forge/loot/ForgeHexAmethystLootMod.java | 50 ++++++++++ .../forge/loot/ForgeHexScrollLootMod.java | 25 +++-- 51 files changed, 474 insertions(+), 381 deletions(-) delete mode 100644 Common/src/main/java/at/petrak/hexcasting/api/misc/ScrollQuantity.java rename Common/src/main/java/at/petrak/hexcasting/common/loot/{PatternScrollFunc.java => AddPerWorldPatternToScrollFunc.java} (65%) delete mode 100644 Fabric/src/generated/resources/data/hexcasting/loot_tables/inject/scroll_loot_few.json delete mode 100644 Fabric/src/generated/resources/data/hexcasting/loot_tables/inject/scroll_loot_many.json delete mode 100644 Fabric/src/generated/resources/data/hexcasting/loot_tables/inject/scroll_loot_some.json create mode 100644 Fabric/src/main/java/at/petrak/hexcasting/fabric/loot/FabricHexLootModJankery.java rename Common/src/main/java/at/petrak/hexcasting/mixin/MixinReloadableServerResources.java => Fabric/src/main/java/at/petrak/hexcasting/fabric/mixin/FabricMixinReloadableServerResources.java (81%) create mode 100644 Forge/src/generated/resources/.cache/d4b3e6634c30118e1127c02b727ea285752e5aac create mode 100644 Forge/src/generated/resources/data/forge/loot_modifiers/global_loot_modifiers.json create mode 100644 Forge/src/generated/resources/data/hexcasting/loot_modifiers/amethyst_cluster.json create mode 100644 Forge/src/generated/resources/data/hexcasting/loot_modifiers/scroll/minecraft/chests/abandoned_mineshaft.json create mode 100644 Forge/src/generated/resources/data/hexcasting/loot_modifiers/scroll/minecraft/chests/ancient_city.json create mode 100644 Forge/src/generated/resources/data/hexcasting/loot_modifiers/scroll/minecraft/chests/bastion_other.json create mode 100644 Forge/src/generated/resources/data/hexcasting/loot_modifiers/scroll/minecraft/chests/bastion_treasure.json create mode 100644 Forge/src/generated/resources/data/hexcasting/loot_modifiers/scroll/minecraft/chests/desert_pyramid.json create mode 100644 Forge/src/generated/resources/data/hexcasting/loot_modifiers/scroll/minecraft/chests/end_city_treasure.json create mode 100644 Forge/src/generated/resources/data/hexcasting/loot_modifiers/scroll/minecraft/chests/jungle_temple.json create mode 100644 Forge/src/generated/resources/data/hexcasting/loot_modifiers/scroll/minecraft/chests/nether_bridge.json create mode 100644 Forge/src/generated/resources/data/hexcasting/loot_modifiers/scroll/minecraft/chests/pillager_outpost.json create mode 100644 Forge/src/generated/resources/data/hexcasting/loot_modifiers/scroll/minecraft/chests/shipwreck_map.json create mode 100644 Forge/src/generated/resources/data/hexcasting/loot_modifiers/scroll/minecraft/chests/simple_dungeon.json create mode 100644 Forge/src/generated/resources/data/hexcasting/loot_modifiers/scroll/minecraft/chests/stronghold_library.json create mode 100644 Forge/src/generated/resources/data/hexcasting/loot_modifiers/scroll/minecraft/chests/village/village_cartographer.json create mode 100644 Forge/src/generated/resources/data/hexcasting/loot_modifiers/scroll/minecraft/chests/woodland_mansion.json delete mode 100644 Forge/src/generated/resources/data/hexcasting/loot_tables/inject/scroll_loot_few.json delete mode 100644 Forge/src/generated/resources/data/hexcasting/loot_tables/inject/scroll_loot_many.json delete mode 100644 Forge/src/generated/resources/data/hexcasting/loot_tables/inject/scroll_loot_some.json rename Forge/src/main/java/at/petrak/hexcasting/forge/datagen/{HexForgeConditionsBuilder.java => ForgeHexConditionsBuilder.java} (91%) rename Forge/src/main/java/at/petrak/hexcasting/forge/datagen/{HexForgeDataGenerators.java => ForgeHexDataGenerators.java} (97%) create mode 100644 Forge/src/main/java/at/petrak/hexcasting/forge/datagen/ForgeHexLootModGen.java create mode 100644 Forge/src/main/java/at/petrak/hexcasting/forge/loot/ForgeHexAmethystLootMod.java diff --git a/Common/src/main/java/at/petrak/hexcasting/api/misc/ScrollQuantity.java b/Common/src/main/java/at/petrak/hexcasting/api/misc/ScrollQuantity.java deleted file mode 100644 index 9b899878..00000000 --- a/Common/src/main/java/at/petrak/hexcasting/api/misc/ScrollQuantity.java +++ /dev/null @@ -1,26 +0,0 @@ -package at.petrak.hexcasting.api.misc; - -import net.minecraft.resources.ResourceLocation; -import org.jetbrains.annotations.Nullable; - -import static at.petrak.hexcasting.api.HexAPI.modLoc; - -public enum ScrollQuantity { - NONE(null, 0), - FEW(modLoc("inject/scroll_loot_few"), 2), - SOME(modLoc("inject/scroll_loot_some"), 3), - MANY(modLoc("inject/scroll_loot_many"), 4); - - private final ResourceLocation pool; - public final int countRange; - - ScrollQuantity(ResourceLocation pool, int countRange) { - this.pool = pool; - this.countRange = countRange; - } - - @Nullable - public ResourceLocation getPool() { - return pool; - } -} diff --git a/Common/src/main/java/at/petrak/hexcasting/api/mod/HexConfig.java b/Common/src/main/java/at/petrak/hexcasting/api/mod/HexConfig.java index aec2c2ca..baad530a 100644 --- a/Common/src/main/java/at/petrak/hexcasting/api/mod/HexConfig.java +++ b/Common/src/main/java/at/petrak/hexcasting/api/mod/HexConfig.java @@ -2,7 +2,6 @@ package at.petrak.hexcasting.api.mod; import at.petrak.hexcasting.api.HexAPI; import at.petrak.hexcasting.api.misc.MediaConstants; -import at.petrak.hexcasting.api.misc.ScrollQuantity; import net.minecraft.resources.ResourceKey; import net.minecraft.resources.ResourceLocation; import net.minecraft.world.item.Tier; @@ -60,18 +59,11 @@ public class HexConfig { // fun fact, although dimension keys are a RegistryHolder, they aren't a registry, so i can't do tags boolean canTeleportInThisDimension(ResourceKey dimension); - ScrollQuantity scrollsForLootTable(ResourceLocation lootTable); - int DEFAULT_MAX_RECURSE_DEPTH = 512; int DEFAULT_MAX_SPELL_CIRCLE_LENGTH = 1024; int DEFAULT_OP_BREAK_HARVEST_LEVEL = 3; boolean DEFAULT_VILLAGERS_DISLIKE_MIND_MURDER = true; - List DEFAULT_FEW_SCROLL_TABLES = List.of("minecraft:chests/jungle_temple", - "minecraft:chests/simple_dungeon", "minecraft:chests/village/village_cartographer"); - List DEFAULT_SOME_SCROLL_TABLES = List.of("minecraft:chests/bastion_treasure", - "minecraft:chests/shipwreck_map"); - List DEFAULT_MANY_SCROLL_TABLES = List.of("minecraft:chests/stronghold_library"); List DEFAULT_DIM_TP_DENYLIST = List.of("twilightforest:twilight_forest"); diff --git a/Common/src/main/java/at/petrak/hexcasting/common/lib/HexLootFunctions.java b/Common/src/main/java/at/petrak/hexcasting/common/lib/HexLootFunctions.java index 2d060712..bebc94ad 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/lib/HexLootFunctions.java +++ b/Common/src/main/java/at/petrak/hexcasting/common/lib/HexLootFunctions.java @@ -1,7 +1,7 @@ package at.petrak.hexcasting.common.lib; +import at.petrak.hexcasting.common.loot.AddPerWorldPatternToScrollFunc; import at.petrak.hexcasting.common.loot.AmethystReducerFunc; -import at.petrak.hexcasting.common.loot.PatternScrollFunc; import net.minecraft.resources.ResourceLocation; import net.minecraft.world.level.storage.loot.functions.LootItemFunctionType; @@ -21,7 +21,7 @@ public class HexLootFunctions { private static final Map LOOT_FUNCS = new LinkedHashMap<>(); public static final LootItemFunctionType PATTERN_SCROLL = register("pattern_scroll", - new LootItemFunctionType(new PatternScrollFunc.Serializer())); + new LootItemFunctionType(new AddPerWorldPatternToScrollFunc.Serializer())); public static final LootItemFunctionType AMETHYST_SHARD_REDUCER = register("amethyst_shard_reducer", new LootItemFunctionType(new AmethystReducerFunc.Serializer())); diff --git a/Common/src/main/java/at/petrak/hexcasting/common/loot/PatternScrollFunc.java b/Common/src/main/java/at/petrak/hexcasting/common/loot/AddPerWorldPatternToScrollFunc.java similarity index 65% rename from Common/src/main/java/at/petrak/hexcasting/common/loot/PatternScrollFunc.java rename to Common/src/main/java/at/petrak/hexcasting/common/loot/AddPerWorldPatternToScrollFunc.java index 5f158a75..5ed1ad4e 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/loot/PatternScrollFunc.java +++ b/Common/src/main/java/at/petrak/hexcasting/common/loot/AddPerWorldPatternToScrollFunc.java @@ -14,15 +14,20 @@ import net.minecraft.world.level.storage.loot.functions.LootItemFunctionType; import net.minecraft.world.level.storage.loot.predicates.LootItemCondition; /** - * Slap a random per-world pattern on the scroll + * Slap a random per-world pattern on the scroll. + *

+ * The function itself is only used on Fabric but the behavior {@link AddPerWorldPatternToScrollFunc#doStatic} + * is used on both sides */ -public class PatternScrollFunc extends LootItemConditionalFunction { - public PatternScrollFunc(LootItemCondition[] lootItemConditions) { +public class AddPerWorldPatternToScrollFunc extends LootItemConditionalFunction { + public AddPerWorldPatternToScrollFunc(LootItemCondition[] lootItemConditions) { super(lootItemConditions); } - @Override - protected ItemStack run(ItemStack stack, LootContext ctx) { + /** + * This doesn't actually have any params so extract behaviour out for the benefit of forge + */ + public static ItemStack doStatic(ItemStack stack, LootContext ctx) { var rand = ctx.getRandom(); var worldLookup = PatternRegistryManifest.getAllPerWorldActions(); @@ -39,21 +44,26 @@ public class PatternScrollFunc extends LootItemConditionalFunction { return stack; } + @Override + protected ItemStack run(ItemStack stack, LootContext ctx) { + return doStatic(stack, ctx); + } + @Override public LootItemFunctionType getType() { return HexLootFunctions.PATTERN_SCROLL; } - public static class Serializer extends LootItemConditionalFunction.Serializer { + public static class Serializer extends LootItemConditionalFunction.Serializer { @Override - public void serialize(JsonObject json, PatternScrollFunc value, JsonSerializationContext ctx) { + public void serialize(JsonObject json, AddPerWorldPatternToScrollFunc value, JsonSerializationContext ctx) { super.serialize(json, value, ctx); } @Override - public PatternScrollFunc deserialize(JsonObject object, JsonDeserializationContext ctx, + public AddPerWorldPatternToScrollFunc deserialize(JsonObject object, JsonDeserializationContext ctx, LootItemCondition[] conditions) { - return new PatternScrollFunc(conditions); + return new AddPerWorldPatternToScrollFunc(conditions); } } } diff --git a/Common/src/main/java/at/petrak/hexcasting/common/loot/AmethystReducerFunc.java b/Common/src/main/java/at/petrak/hexcasting/common/loot/AmethystReducerFunc.java index c2aecf25..cee38be6 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/loot/AmethystReducerFunc.java +++ b/Common/src/main/java/at/petrak/hexcasting/common/loot/AmethystReducerFunc.java @@ -20,14 +20,18 @@ public class AmethystReducerFunc extends LootItemConditionalFunction { this.delta = delta; } - @Override - protected ItemStack run(ItemStack stack, LootContext ctx) { + public static ItemStack doStatic(ItemStack stack, LootContext ctx, double amount) { if (stack.is(Items.AMETHYST_SHARD)) { - stack.setCount((int) (stack.getCount() * (1 + delta))); + stack.setCount((int) (stack.getCount() * (1 + amount))); } return stack; } + @Override + protected ItemStack run(ItemStack stack, LootContext ctx) { + return doStatic(stack, ctx, this.delta); + } + @Override public LootItemFunctionType getType() { return HexLootFunctions.AMETHYST_SHARD_REDUCER; diff --git a/Common/src/main/java/at/petrak/hexcasting/common/loot/HexLootHandler.java b/Common/src/main/java/at/petrak/hexcasting/common/loot/HexLootHandler.java index df323794..b1f33449 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/loot/HexLootHandler.java +++ b/Common/src/main/java/at/petrak/hexcasting/common/loot/HexLootHandler.java @@ -1,73 +1,60 @@ package at.petrak.hexcasting.common.loot; -import at.petrak.hexcasting.api.misc.ScrollQuantity; -import at.petrak.hexcasting.api.mod.HexConfig; -import net.minecraft.Util; +import com.google.common.collect.ImmutableList; import net.minecraft.resources.ResourceLocation; -import net.minecraft.world.level.block.Blocks; -import net.minecraft.world.level.storage.loot.LootPool; -import net.minecraft.world.level.storage.loot.entries.LootPoolEntryContainer; -import net.minecraft.world.level.storage.loot.entries.LootTableReference; -import net.minecraft.world.level.storage.loot.providers.number.UniformGenerator; - -import java.util.EnumMap; -import java.util.List; -import java.util.function.Consumer; +import net.minecraft.util.RandomSource; import static at.petrak.hexcasting.api.HexAPI.modLoc; // https://github.com/VazkiiMods/Botania/blob/1.18.x/Xplat/src/main/java/vazkii/botania/common/loot/LootHandler.java // We need to inject dungeon loot (scrolls and lore), make amethyst drop fewer shards, and the extra dust stuff. -// On forge we do it the "right" way with global loot modifiers; modifiable via a datapack. -// On fabric we do the addition of items by mixing in to loot loading and injecting some loot tables we only generate on -// Fabric as addons, and the subtraction with a loot function. so it's customizable for datapack devs. +// On forge: +// - Scrolls are done with a loot mod +// - Amethyst drop fiddling is done with another loot mod; the shard delta is in the loot mod data and the rest of +// the stuff is loaded from TABLE_INJECT_AMETHYST_CLUSTER +// On fabric: +// - Scrolls are done with a lootLoad listener and the amounts are loaded from config +// - Amethyst shard reduction is done with a loot function mixed in to always be on amethyst clusters, god, cause I +// don't think it's facile to use the loot pool api to try to figure out which pool is for the amethyst and reduce it +// - Amethyst dust and crystals are done by adding the loot table Forge uses in directly via listener public class HexLootHandler { - // TODO: remove ScrollQuantity, use this class as the source of truth for GLM gen on forge and inject/ loot tables - // on fabric - public static final EnumMap> DEFAULT_INJECTS = Util.make(() -> { - var map = new EnumMap>(ScrollQuantity.class); + public static final ImmutableList DEFAULT_SCROLL_INJECTS = ImmutableList.of( + // TODO: not sure what the lore implications of scrolls and the nether/end are. adding scrolls + // there for now just to be nice to players. - map.put(ScrollQuantity.FEW, List.of( - new ResourceLocation("minecraft", "chests/jungle_temple"), - new ResourceLocation("minecraft", "chests/simple_dungeon"), - new ResourceLocation("minecraft", "chests/village/village_cartographer"))); - map.put(ScrollQuantity.SOME, List.of( - new ResourceLocation("minecraft", "chests/bastion_treasure"), - new ResourceLocation("minecraft", "chests/pillager_outpost"), - new ResourceLocation("minecraft", "chests/shipwreck_map") - )); - map.put(ScrollQuantity.MANY, List.of( - // ancient city chests have amethyst in them, thinking emoji - new ResourceLocation("minecraft", "chests/ancient_city"), - new ResourceLocation("minecraft", "chests/stronghold_library"))); + // In places where it doesn't really make sense to have them lore-wise just put them rarely anyways + // to make it less of a PITA for new players + new ScrollInjection(new ResourceLocation("minecraft", "chests/simple_dungeon"), 1), + new ScrollInjection(new ResourceLocation("minecraft", "chests/abandoned_mineshaft"), 1), + new ScrollInjection(new ResourceLocation("minecraft", "chests/bastion_other"), 1), + new ScrollInjection(new ResourceLocation("minecraft", "chests/nether_bridge"), 1), - return map; - }); + new ScrollInjection(new ResourceLocation("minecraft", "chests/jungle_temple"), 2), + new ScrollInjection(new ResourceLocation("minecraft", "chests/desert_pyramid"), 2), + new ScrollInjection(new ResourceLocation("minecraft", "chests/village/village_cartographer"), 2), - public static final ResourceLocation FUNC_AMETHYST_SHARD_REDUCER = modLoc("amethyst_shard_reducer"); + new ScrollInjection(new ResourceLocation("minecraft", "chests/shipwreck_map"), 3), + new ScrollInjection(new ResourceLocation("minecraft", "chests/bastion_treasure"), 3), + new ScrollInjection(new ResourceLocation("minecraft", "chests/end_city_treasure"), 3), + + // ancient city chests have amethyst in them, thinking emoji + new ScrollInjection(new ResourceLocation("minecraft", "chests/ancient_city"), 4), + // wonder what those pillagers are up to with those scrolls + new ScrollInjection(new ResourceLocation("minecraft", "chests/pillager_outpost"), 4), + + // if you manage to find one of these things you deserve a lot of scrolls + new ScrollInjection(new ResourceLocation("minecraft", "chests/woodland_mansion"), 5), + new ScrollInjection(new ResourceLocation("minecraft", "chests/stronghold_library"), 5) + ); + + public static int getScrollCount(int range, RandomSource random) { + return Math.max(random.nextIntBetweenInclusive(-range, range), 0); + } + + public static final double DEFAULT_SHARD_MODIFICATION = -0.5; public static final ResourceLocation TABLE_INJECT_AMETHYST_CLUSTER = modLoc("inject/amethyst_cluster"); - public static void lootLoad(ResourceLocation id, Consumer addPool) { - if (id.equals(Blocks.AMETHYST_CLUSTER.getLootTable())) { - addPool.accept(getInjectPool(TABLE_INJECT_AMETHYST_CLUSTER)); - } else { - ScrollQuantity scrolls = HexConfig.server().scrollsForLootTable(id); - ResourceLocation injection = scrolls.getPool(); - if (injection != null) { - addPool.accept(getInjectPool(injection)); - } - } - } - - public static LootPool.Builder getInjectPool(ResourceLocation entry) { - return LootPool.lootPool() - .add(getInjectEntry(entry, 1)) - .setBonusRolls(UniformGenerator.between(0, 1)); - } - - private static LootPoolEntryContainer.Builder getInjectEntry(ResourceLocation table, int weight) { - return LootTableReference.lootTableReference(table) - .setWeight(weight); + public record ScrollInjection(ResourceLocation injectee, int countRange) { } } diff --git a/Common/src/main/java/at/petrak/hexcasting/datagen/HexLootTables.java b/Common/src/main/java/at/petrak/hexcasting/datagen/HexLootTables.java index 931edf5a..2bd1337b 100644 --- a/Common/src/main/java/at/petrak/hexcasting/datagen/HexLootTables.java +++ b/Common/src/main/java/at/petrak/hexcasting/datagen/HexLootTables.java @@ -1,11 +1,9 @@ package at.petrak.hexcasting.datagen; -import at.petrak.hexcasting.api.misc.ScrollQuantity; import at.petrak.hexcasting.common.blocks.circles.BlockEntitySlate; import at.petrak.hexcasting.common.lib.HexBlocks; import at.petrak.hexcasting.common.lib.HexItems; import at.petrak.hexcasting.common.loot.HexLootHandler; -import at.petrak.hexcasting.common.loot.PatternScrollFunc; import at.petrak.hexcasting.xplat.IXplatAbstractions; import at.petrak.paucal.api.datagen.PaucalLootTableProvider; import net.minecraft.advancements.critereon.EnchantmentPredicate; @@ -35,8 +33,6 @@ import net.minecraft.world.level.storage.loot.providers.number.UniformGenerator; import java.util.Map; -import static at.petrak.hexcasting.api.HexAPI.modLoc; - public class HexLootTables extends PaucalLootTableProvider { public HexLootTables(DataGenerator pGenerator) { super(pGenerator); @@ -115,17 +111,6 @@ public class HexLootTables extends PaucalLootTableProvider { .withPool(dustPoolWhenBad) .withPool(isThatAnMFingBrandonSandersonReference) .withPool(isThatAnMFingBadBrandonSandersonReference)); - - String[] rarities = new String[]{ - "few", - "some", - "many" - }; - for (int i = 0; i < rarities.length; i++) { - var quantity = ScrollQuantity.values()[i + 1]; - var scrollPool = makeScrollAdder(quantity.countRange); - lootTables.put(modLoc("inject/scroll_loot_" + rarities[i]), scrollPool); - } } private void makeLeafTable(Map lootTables, Block block) { @@ -147,13 +132,4 @@ public class HexLootTables extends PaucalLootTableProvider { .apply(ApplyExplosionDecay.explosionDecay()); lootTables.put(block, LootTable.lootTable().withPool(leafPool)); } - - // "stddev" - private LootTable.Builder makeScrollAdder(float stddev) { - var pool = LootPool.lootPool() - .setRolls(UniformGenerator.between(-stddev, stddev)) - .add(LootItem.lootTableItem(HexItems.SCROLL_LARGE)) - .apply(() -> new PatternScrollFunc(new LootItemCondition[0])); - return LootTable.lootTable().withPool(pool); - } } diff --git a/Common/src/main/resources/assets/hexcasting/lang/en_us.json b/Common/src/main/resources/assets/hexcasting/lang/en_us.json index 3d374747..30917c3e 100644 --- a/Common/src/main/resources/assets/hexcasting/lang/en_us.json +++ b/Common/src/main/resources/assets/hexcasting/lang/en_us.json @@ -174,10 +174,12 @@ "emi.category.hexcasting.villager_leveling": "Trade Leveling", "emi.category.hexcasting.villager_profession": "Villager Profession", + "text.autoconfig.hexcasting.title": "Hexcasting Config", "text.autoconfig.hexcasting.category.common": "Common", "text.autoconfig.hexcasting.category.client": "Client", "text.autoconfig.hexcasting.category.server": "Server", + "text.autoconfig.hexcasting.option.common.dustMediaAmount": "Dust Media Amount", "text.autoconfig.hexcasting.option.common.shardMediaAmount": "Shard Media Amount", "text.autoconfig.hexcasting.option.common.chargedCrystalMediaAmount": "Charged Crystal Media Amount", @@ -186,6 +188,7 @@ "text.autoconfig.hexcasting.option.common.shardMediaAmount.@Tooltip": "How much media a single Amethyst Shard item is worth", "text.autoconfig.hexcasting.option.common.chargedCrystalMediaAmount.@Tooltip": "How much media a single Charged Amethyst Crystal item is worth", "text.autoconfig.hexcasting.option.common.mediaToHealthRate.@Tooltip": "How many points of media a half-heart is worth when casting from HP", + "text.autoconfig.hexcasting.option.client.ctrlTogglesOffStrokeOrder": "Ctrl Toggles Off Stroke Order", "text.autoconfig.hexcasting.option.client.invertSpellbookScrollDirection": "Invert Spellbook Scroll Direction", "text.autoconfig.hexcasting.option.client.invertAbacusScrollDirection": "Invert Abacus Scroll Direction", @@ -194,15 +197,15 @@ "text.autoconfig.hexcasting.option.client.invertSpellbookScrollDirection.@Tooltip": "Whether scrolling up (as opposed to down) will increase the page index of the spellbook, and vice versa", "text.autoconfig.hexcasting.option.client.invertAbacusScrollDirection.@Tooltip": "Whether scrolling up (as opposed to down) will increase the page index of the abacus, and vice versa", "text.autoconfig.hexcasting.option.client.gridSnapThreshold.@Tooltip": "When using a staff, the distance from one dot you have to go to snap to the next dot, where 0.5 means 50% of the way (0.5-1)", + "text.autoconfig.hexcasting.option.server.opBreakHarvestLevel": "Break Harvest Level", "text.autoconfig.hexcasting.option.server.maxRecurseDepth": "Max Recurse Depth", "text.autoconfig.hexcasting.option.server.maxSpellCircleLength": "Max Spell Circle Length", "text.autoconfig.hexcasting.option.server.actionDenyList": "Action Deny List", "text.autoconfig.hexcasting.option.server.circleActionDenyList": "Circle Action Deny List", "text.autoconfig.hexcasting.option.server.villagersOffendedByMindMurder": "Villagers Offended By Mind Murder", - "text.autoconfig.hexcasting.option.server.fewScrollTables": "Few Scroll Tables", - "text.autoconfig.hexcasting.option.server.someScrollTables": "Some Scroll Tables", - "text.autoconfig.hexcasting.option.server.manyScrollTables": "Many Scroll Tables", + "text.autoconfig.hexcasting.option.server.scrollInjectionsRaw": "Scroll Injection Weights", + "text.autoconfig.hexcasting.option.server.amethystShardModification": "Amethyst Shard Drop Rate Change", "text.autoconfig.hexcasting.option.server.opBreakHarvestLevel.@Tooltip": "The harvest level of the Break Block spell.\n0 = wood, 1 = stone, 2 = iron, 3 = diamond, 4 = netherite.", "text.autoconfig.hexcasting.option.server.maxRecurseDepth.@Tooltip": "How many times an action can recursively cast other actions", "text.autoconfig.hexcasting.option.server.maxSpellCircleLength.@Tooltip": "The maximum number of slates in a spell circle", @@ -212,6 +215,8 @@ "text.autoconfig.hexcasting.option.server.fewScrollTables.@Tooltip": "Loot tables that a small number of Ancient Scrolls are injected into", "text.autoconfig.hexcasting.option.server.someScrollTables.@Tooltip": "Loot tables that a decent number of Ancient Scrolls are injected into", "text.autoconfig.hexcasting.option.server.manyScrollTables.@Tooltip": "Loot tables that a huge number of Ancient Scrolls are injected into", + "text.autoconfig.hexcasting.option.server.scrollInjectionsRaw.@Tooltip": "Maps the names of loot tables to the amount of per-world patterns on scrolls should go in them. There's about a 50% chance to get any scrolls in a given chest marked here; once that is met, between 1 and that many scrolls are generated.", + "text.autoconfig.hexcasting.option.server.amethystShardModification.@Tooltip": "How much the number of amethyst shards dropped from clusters is increased/decreased.", "advancement.hexcasting:root": "Hexcasting Research", diff --git a/Common/src/main/resources/hexplat.mixins.json b/Common/src/main/resources/hexplat.mixins.json index 101e59bf..c10df093 100644 --- a/Common/src/main/resources/hexplat.mixins.json +++ b/Common/src/main/resources/hexplat.mixins.json @@ -8,7 +8,6 @@ "MixinAbstractVillager", "MixinMob", "MixinRaider", - "MixinReloadableServerResources", "MixinVillager", "MixinWitch", "accessor.AccessorEntity", diff --git a/Fabric/src/generated/resources/.cache/03e4de26f1265135874f8cdcaebc09d9c08eb42b b/Fabric/src/generated/resources/.cache/03e4de26f1265135874f8cdcaebc09d9c08eb42b index 692ef768..51ce2bb5 100644 --- a/Fabric/src/generated/resources/.cache/03e4de26f1265135874f8cdcaebc09d9c08eb42b +++ b/Fabric/src/generated/resources/.cache/03e4de26f1265135874f8cdcaebc09d9c08eb42b @@ -1,4 +1,4 @@ -// 1.19.2 2023-01-22T20:54:31.1145534 Tags for minecraft:item +// 1.19.2 2023-01-22T23:57:23.050599591 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 204a0914..e865bcdb 100644 --- a/Fabric/src/generated/resources/.cache/67cce32b1c3cbbcb1f646605f4914e3f196986c2 +++ b/Fabric/src/generated/resources/.cache/67cce32b1c3cbbcb1f646605f4914e3f196986c2 @@ -1,5 +1,4 @@ -// 1.19.2 2023-01-22T20:54:31.115936247 LootTables -01a50f557196c705c275722015cf893e0abe6425 data/hexcasting/loot_tables/inject/scroll_loot_many.json +// 1.19.2 2023-01-22T23:57:23.070700759 LootTables dec1d3592e82f99d9e059d9c771530f103b2bda5 data/hexcasting/loot_tables/blocks/empty_directrix.json 2c42fc5d8c74c98ad15b8bd50f56541fccbef750 data/hexcasting/loot_tables/blocks/edified_tile.json cfb39e2151725fe4f9a7269d9b5de8031ea54a44 data/hexcasting/loot_tables/blocks/directrix_redstone.json @@ -15,7 +14,6 @@ a3ca7f9427bd57a6033f241754d49425251cc091 data/hexcasting/loot_tables/blocks/scro 201bbf7adff979ff8cb087e1798da5a2a31eed09 data/hexcasting/loot_tables/blocks/akashic_connector.json ac9d01324ffe7c1ea963aa7def5c177db820067f data/hexcasting/loot_tables/blocks/amethyst_tiles.json e329c8ad61d61ad9be91d6ab4c36d57c05990e0c data/hexcasting/loot_tables/blocks/amethyst_dust_block.json -a7a08d76b8a1b1596a0d67d422d7a0d93f3a1d2f data/hexcasting/loot_tables/inject/scroll_loot_few.json 3b1e2f738c4906371a4cdecf24253ad94ae66320 data/hexcasting/loot_tables/blocks/akashic_bookshelf.json 5da5b504c400c052ee8b03cf88e78dc567456ef8 data/hexcasting/loot_tables/blocks/amethyst_sconce.json d21fdf6326f7a9958df22224e5e34489d63e013d data/hexcasting/loot_tables/blocks/edified_door.json @@ -36,4 +34,3 @@ b7f7af68760b51d0c438f5c6039f1cd7157fa452 data/hexcasting/loot_tables/blocks/anci 9ee4259b51cccd4582fb2e52ab9f64e92af857bb data/hexcasting/loot_tables/blocks/edified_log.json c089d3d230ae5354f2a9953f65bba77b6e26d976 data/hexcasting/loot_tables/blocks/edified_trapdoor.json 745b510161cfff804b115f566ad6b50e0cb492d1 data/hexcasting/loot_tables/blocks/slate.json -fd874549344d85ec2bb6edcb7fe7af62cafebba2 data/hexcasting/loot_tables/inject/scroll_loot_some.json diff --git a/Fabric/src/generated/resources/.cache/75bcd4dba6ca7d365462b0ec45e291d1056349c4 b/Fabric/src/generated/resources/.cache/75bcd4dba6ca7d365462b0ec45e291d1056349c4 index f8ddf8a8..9b43c7b5 100644 --- a/Fabric/src/generated/resources/.cache/75bcd4dba6ca7d365462b0ec45e291d1056349c4 +++ b/Fabric/src/generated/resources/.cache/75bcd4dba6ca7d365462b0ec45e291d1056349c4 @@ -1,4 +1,4 @@ -// 1.19.2 2023-01-22T20:54:31.115320251 Tags for minecraft:block +// 1.19.2 2023-01-22T23:57:23.071366626 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 e1bff53a..fa887791 100644 --- a/Fabric/src/generated/resources/.cache/844611d4af49e23072b8a888c8e73c6c5d8c0768 +++ b/Fabric/src/generated/resources/.cache/844611d4af49e23072b8a888c8e73c6c5d8c0768 @@ -1,4 +1,4 @@ -// 1.19.2 2023-01-22T20:54:31.092846061 Tags for hexcasting:action +// 1.19.2 2023-01-22T23:57:23.069878587 Tags for hexcasting:action e5afc567ea17f035e4eb1d1d48825100b7f6ad68 data/hexcasting/tags/action/per_world_pattern.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 08d9aa90..251c9838 100644 --- a/Fabric/src/generated/resources/.cache/9fb1092f32d4fcbf9e061ffd718d4ec689c6c95e +++ b/Fabric/src/generated/resources/.cache/9fb1092f32d4fcbf9e061ffd718d4ec689c6c95e @@ -1,4 +1,4 @@ -// 1.19.2 2023-01-22T20:54:31.094256565 Recipes +// 1.19.2 2023-01-22T23:57:23.052460583 Recipes 9f75d3e93ecbbbf3ed9a92b2943397e09dcae1a9 data/hexcasting/recipes/dye_colorizer_light_blue.json 04569ccadfd99f203b0485d0c3e877209290f2b3 data/hexcasting/advancements/recipes/hexcasting.creative_tab/dye_colorizer_pink.json 2a9d4a0f3618abf9e9b8699b318a984d2c836913 data/hexcasting/advancements/recipes/brainsweep/brainsweep/directrix_redstone.json diff --git a/Fabric/src/generated/resources/data/hexcasting/loot_tables/inject/scroll_loot_few.json b/Fabric/src/generated/resources/data/hexcasting/loot_tables/inject/scroll_loot_few.json deleted file mode 100644 index 318dfb59..00000000 --- a/Fabric/src/generated/resources/data/hexcasting/loot_tables/inject/scroll_loot_few.json +++ /dev/null @@ -1,23 +0,0 @@ -{ - "pools": [ - { - "bonus_rolls": 0.0, - "entries": [ - { - "type": "minecraft:item", - "name": "hexcasting:scroll" - } - ], - "functions": [ - { - "function": "hexcasting:pattern_scroll" - } - ], - "rolls": { - "type": "minecraft:uniform", - "max": 1.0, - "min": -1.0 - } - } - ] -} \ No newline at end of file diff --git a/Fabric/src/generated/resources/data/hexcasting/loot_tables/inject/scroll_loot_many.json b/Fabric/src/generated/resources/data/hexcasting/loot_tables/inject/scroll_loot_many.json deleted file mode 100644 index 938e982a..00000000 --- a/Fabric/src/generated/resources/data/hexcasting/loot_tables/inject/scroll_loot_many.json +++ /dev/null @@ -1,23 +0,0 @@ -{ - "pools": [ - { - "bonus_rolls": 0.0, - "entries": [ - { - "type": "minecraft:item", - "name": "hexcasting:scroll" - } - ], - "functions": [ - { - "function": "hexcasting:pattern_scroll" - } - ], - "rolls": { - "type": "minecraft:uniform", - "max": 3.0, - "min": -3.0 - } - } - ] -} \ No newline at end of file diff --git a/Fabric/src/generated/resources/data/hexcasting/loot_tables/inject/scroll_loot_some.json b/Fabric/src/generated/resources/data/hexcasting/loot_tables/inject/scroll_loot_some.json deleted file mode 100644 index 3f668b3f..00000000 --- a/Fabric/src/generated/resources/data/hexcasting/loot_tables/inject/scroll_loot_some.json +++ /dev/null @@ -1,23 +0,0 @@ -{ - "pools": [ - { - "bonus_rolls": 0.0, - "entries": [ - { - "type": "minecraft:item", - "name": "hexcasting:scroll" - } - ], - "functions": [ - { - "function": "hexcasting:pattern_scroll" - } - ], - "rolls": { - "type": "minecraft:uniform", - "max": 2.0, - "min": -2.0 - } - } - ] -} \ No newline at end of file diff --git a/Fabric/src/main/java/at/petrak/hexcasting/fabric/FabricHexConfig.java b/Fabric/src/main/java/at/petrak/hexcasting/fabric/FabricHexConfig.java index 92fe6ead..16824022 100644 --- a/Fabric/src/main/java/at/petrak/hexcasting/fabric/FabricHexConfig.java +++ b/Fabric/src/main/java/at/petrak/hexcasting/fabric/FabricHexConfig.java @@ -1,9 +1,11 @@ package at.petrak.hexcasting.fabric; import at.petrak.hexcasting.api.HexAPI; -import at.petrak.hexcasting.api.misc.ScrollQuantity; import at.petrak.hexcasting.api.mod.HexConfig; +import at.petrak.hexcasting.common.loot.HexLootHandler; import at.petrak.hexcasting.xplat.IXplatAbstractions; +import it.unimi.dsi.fastutil.objects.Object2IntMap; +import it.unimi.dsi.fastutil.objects.Object2IntOpenHashMap; import me.shedaniel.autoconfig.AutoConfig; import me.shedaniel.autoconfig.ConfigData; import me.shedaniel.autoconfig.annotation.Config; @@ -17,7 +19,6 @@ import net.minecraft.world.level.Level; import java.util.List; -import static at.petrak.hexcasting.api.mod.HexConfig.anyMatch; import static at.petrak.hexcasting.api.mod.HexConfig.noneMatch; @Config(name = HexAPI.MOD_ID) @@ -27,15 +28,15 @@ import static at.petrak.hexcasting.api.mod.HexConfig.noneMatch; public class FabricHexConfig extends PartitioningSerializer.GlobalData { @ConfigEntry.Category("common") @ConfigEntry.Gui.TransitiveObject - private final Common common = new Common(); + public final Common common = new Common(); @ConfigEntry.Category("client") @ConfigEntry.Gui.TransitiveObject - private final Client client = new Client(); + public final Client client = new Client(); @ConfigEntry.Category("server") @ConfigEntry.Gui.TransitiveObject - private final Server server = new Server(); + public final Server server = new Server(); - public static void setup() { + public static FabricHexConfig setup() { AutoConfig.register(FabricHexConfig.class, PartitioningSerializer.wrap(JanksonConfigSerializer::new)); var instance = AutoConfig.getConfigHolder(FabricHexConfig.class).getConfig(); @@ -47,10 +48,12 @@ public class FabricHexConfig extends PartitioningSerializer.GlobalData { // but we care about the server on the *logical* server // i believe this should Just Work without a guard? assuming we don't access it from the client ever HexConfig.setServer(instance.server); + + return instance; } @Config(name = "common") - private static final class Common implements HexConfig.CommonConfigAccess, ConfigData { + public static final class Common implements HexConfig.CommonConfigAccess, ConfigData { @ConfigEntry.Gui.Tooltip private int dustMediaAmount = DEFAULT_DUST_MEDIA_AMOUNT; @ConfigEntry.Gui.Tooltip @@ -90,7 +93,7 @@ public class FabricHexConfig extends PartitioningSerializer.GlobalData { } @Config(name = "client") - private static final class Client implements HexConfig.ClientConfigAccess, ConfigData { + public static final class Client implements HexConfig.ClientConfigAccess, ConfigData { @ConfigEntry.Gui.Tooltip private boolean ctrlTogglesOffStrokeOrder = DEFAULT_CTRL_TOGGLES_OFF_STROKE_ORDER; @ConfigEntry.Gui.Tooltip @@ -127,7 +130,7 @@ public class FabricHexConfig extends PartitioningSerializer.GlobalData { } @Config(name = "server") - private static final class Server implements HexConfig.ServerConfigAccess, ConfigData { + public static final class Server implements HexConfig.ServerConfigAccess, ConfigData { @ConfigEntry.BoundedDiscrete(min = 0, max = 4) @ConfigEntry.Gui.Tooltip private int opBreakHarvestLevel = DEFAULT_OP_BREAK_HARVEST_LEVEL; @@ -146,16 +149,22 @@ public class FabricHexConfig extends PartitioningSerializer.GlobalData { private List tpDimDenylist = DEFAULT_DIM_TP_DENYLIST; @ConfigEntry.Gui.Tooltip - private List fewScrollTables = DEFAULT_FEW_SCROLL_TABLES; - @ConfigEntry.Gui.Tooltip - private List someScrollTables = DEFAULT_SOME_SCROLL_TABLES; - @ConfigEntry.Gui.Tooltip - private List manyScrollTables = DEFAULT_MANY_SCROLL_TABLES; + private List scrollInjectionsRaw = HexLootHandler.DEFAULT_SCROLL_INJECTS + .stream() + .map(si -> new ScrollInjectionMirror(si.injectee(), si.countRange())) + .toList(); + @ConfigEntry.Gui.Excluded + private transient Object2IntMap scrollInjections; @Override public void validatePostLoad() throws ValidationException { this.maxRecurseDepth = Math.max(this.maxRecurseDepth, 0); this.maxSpellCircleLength = Math.max(this.maxSpellCircleLength, 4); + + this.scrollInjections = new Object2IntOpenHashMap<>(); + for (var mirror : this.scrollInjectionsRaw) { + this.scrollInjections.put(mirror.injectee(), mirror.countRange()); + } } @Override @@ -190,19 +199,17 @@ public class FabricHexConfig extends PartitioningSerializer.GlobalData { @Override public boolean canTeleportInThisDimension(ResourceKey dimension) { - return noneMatch(manyScrollTables, dimension.location()); + return noneMatch(tpDimDenylist, dimension.location()); } - @Override - public ScrollQuantity scrollsForLootTable(ResourceLocation lootTable) { - if (anyMatch(fewScrollTables, lootTable)) { - return ScrollQuantity.FEW; - } else if (anyMatch(someScrollTables, lootTable)) { - return ScrollQuantity.SOME; - } else if (anyMatch(manyScrollTables, lootTable)) { - return ScrollQuantity.MANY; - } - return ScrollQuantity.NONE; + /** + * Returns -1 if none is found + */ + public int scrollRangeForLootTable(ResourceLocation lootTable) { + return this.scrollInjections.getOrDefault(lootTable, -1); + } + + record ScrollInjectionMirror(ResourceLocation injectee, int countRange) { } } } diff --git a/Fabric/src/main/java/at/petrak/hexcasting/fabric/FabricHexInitializer.kt b/Fabric/src/main/java/at/petrak/hexcasting/fabric/FabricHexInitializer.kt index 8cd89640..0fbb07d9 100644 --- a/Fabric/src/main/java/at/petrak/hexcasting/fabric/FabricHexInitializer.kt +++ b/Fabric/src/main/java/at/petrak/hexcasting/fabric/FabricHexInitializer.kt @@ -19,7 +19,6 @@ import at.petrak.hexcasting.common.lib.hex.HexActions import at.petrak.hexcasting.common.lib.hex.HexEvalSounds import at.petrak.hexcasting.common.lib.hex.HexIotaTypes import at.petrak.hexcasting.common.lib.hex.HexSpecialHandlers -import at.petrak.hexcasting.common.loot.HexLootHandler import at.petrak.hexcasting.common.misc.AkashicTreeGrower import at.petrak.hexcasting.common.misc.BrainsweepingEvents import at.petrak.hexcasting.common.misc.PlayerPositionRecorder @@ -28,6 +27,7 @@ import at.petrak.hexcasting.fabric.event.VillagerConversionCallback import at.petrak.hexcasting.fabric.interop.gravity.GravityApiInterop import at.petrak.hexcasting.fabric.interop.gravity.OpChangeGravity import at.petrak.hexcasting.fabric.interop.gravity.OpGetGravity +import at.petrak.hexcasting.fabric.loot.FabricHexLootModJankery import at.petrak.hexcasting.fabric.network.FabricPacketHandler import at.petrak.hexcasting.fabric.recipe.FabricModConditionalIngredient import at.petrak.hexcasting.fabric.storage.FabricImpetusStorage @@ -50,8 +50,10 @@ import net.minecraft.world.InteractionResult import java.util.function.BiConsumer object FabricHexInitializer : ModInitializer { + public lateinit var CONFIG: FabricHexConfig + override fun onInitialize() { - FabricHexConfig.setup() + this.CONFIG = FabricHexConfig.setup() FabricPacketHandler.init() initListeners() @@ -96,10 +98,8 @@ object FabricHexInitializer : ModInitializer { CommandRegistrationCallback.EVENT.register { dp, _, _ -> HexCommands.register(dp) } LootTableEvents.MODIFY.register { _, _, id, supplier, _ -> - HexLootHandler.lootLoad(id, supplier::withPool) + FabricHexLootModJankery.lootLoad(id, supplier::withPool) } - - } private fun initRegistries() { diff --git a/Fabric/src/main/java/at/petrak/hexcasting/fabric/loot/FabricHexLootModJankery.java b/Fabric/src/main/java/at/petrak/hexcasting/fabric/loot/FabricHexLootModJankery.java new file mode 100644 index 00000000..0a14953d --- /dev/null +++ b/Fabric/src/main/java/at/petrak/hexcasting/fabric/loot/FabricHexLootModJankery.java @@ -0,0 +1,46 @@ +package at.petrak.hexcasting.fabric.loot; + +import at.petrak.hexcasting.common.lib.HexItems; +import at.petrak.hexcasting.common.loot.AddPerWorldPatternToScrollFunc; +import at.petrak.hexcasting.fabric.FabricHexInitializer; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.world.level.block.Blocks; +import net.minecraft.world.level.storage.loot.LootPool; +import net.minecraft.world.level.storage.loot.entries.LootItem; +import net.minecraft.world.level.storage.loot.entries.LootTableReference; +import net.minecraft.world.level.storage.loot.predicates.LootItemCondition; +import net.minecraft.world.level.storage.loot.providers.number.UniformGenerator; +import org.jetbrains.annotations.NotNull; + +import java.util.function.Consumer; + +import static at.petrak.hexcasting.api.HexAPI.modLoc; +import static at.petrak.hexcasting.common.loot.HexLootHandler.TABLE_INJECT_AMETHYST_CLUSTER; + +public class FabricHexLootModJankery { + public static final ResourceLocation FUNC_AMETHYST_SHARD_REDUCER = modLoc("amethyst_shard_reducer"); + + public static void lootLoad(ResourceLocation id, Consumer addPool) { + if (id.equals(Blocks.AMETHYST_CLUSTER.getLootTable())) { + addPool.accept(makeAmethystInjectPool()); + } else { + int countRange = FabricHexInitializer.CONFIG.server.scrollRangeForLootTable(id); + if (countRange != -1) { + addPool.accept(makeScrollAddPool(countRange)); + } + } + } + + @NotNull + private static LootPool.Builder makeAmethystInjectPool() { + return LootPool.lootPool() + .add(LootTableReference.lootTableReference(TABLE_INJECT_AMETHYST_CLUSTER)); + } + + private static LootPool.Builder makeScrollAddPool(int range) { + return LootPool.lootPool() + .setRolls(UniformGenerator.between(-range, range)) + .add(LootItem.lootTableItem(HexItems.SCROLL_LARGE)) + .apply(() -> new AddPerWorldPatternToScrollFunc(new LootItemCondition[0])); + } +} diff --git a/Common/src/main/java/at/petrak/hexcasting/mixin/MixinReloadableServerResources.java b/Fabric/src/main/java/at/petrak/hexcasting/fabric/mixin/FabricMixinReloadableServerResources.java similarity index 81% rename from Common/src/main/java/at/petrak/hexcasting/mixin/MixinReloadableServerResources.java rename to Fabric/src/main/java/at/petrak/hexcasting/fabric/mixin/FabricMixinReloadableServerResources.java index f8496c4c..244eb767 100644 --- a/Common/src/main/java/at/petrak/hexcasting/mixin/MixinReloadableServerResources.java +++ b/Fabric/src/main/java/at/petrak/hexcasting/fabric/mixin/FabricMixinReloadableServerResources.java @@ -1,7 +1,7 @@ -package at.petrak.hexcasting.mixin; +package at.petrak.hexcasting.fabric.mixin; import at.petrak.hexcasting.api.HexAPI; -import at.petrak.hexcasting.common.loot.HexLootHandler; +import at.petrak.hexcasting.fabric.loot.FabricHexLootModJankery; import at.petrak.hexcasting.mixin.accessor.AccessorLootTable; import net.minecraft.server.ReloadableServerResources; import net.minecraft.world.level.block.Blocks; @@ -15,7 +15,8 @@ import java.util.Arrays; import java.util.concurrent.CompletableFuture; @Mixin(ReloadableServerResources.class) -public class MixinReloadableServerResources { +public class FabricMixinReloadableServerResources { + // Add the amethyst shard @Inject(method = "loadResources", at = @At("RETURN"), cancellable = true) private static void onLoadResources(CallbackInfoReturnable> cir) { cir.setReturnValue(cir.getReturnValue().thenApply((rsr) -> { @@ -23,13 +24,13 @@ public class MixinReloadableServerResources { var theCoolerAmethystTable = (AccessorLootTable) amethystTable; var oldFuncs = theCoolerAmethystTable.hex$getFunctions(); var newFuncs = Arrays.copyOf(oldFuncs, oldFuncs.length + 1); - var shardReducer = rsr.getItemModifierManager().get(HexLootHandler.FUNC_AMETHYST_SHARD_REDUCER); + var shardReducer = rsr.getItemModifierManager().get(FabricHexLootModJankery.FUNC_AMETHYST_SHARD_REDUCER); if (shardReducer != null) { newFuncs[newFuncs.length - 1] = shardReducer; theCoolerAmethystTable.hex$setFunctions(newFuncs); theCoolerAmethystTable.hex$setCompositeFunction(LootItemFunctions.compose(newFuncs)); } else { - HexAPI.LOGGER.warn("{} was not found?", HexLootHandler.FUNC_AMETHYST_SHARD_REDUCER); + HexAPI.LOGGER.warn("{} was not found?", FabricHexLootModJankery.FUNC_AMETHYST_SHARD_REDUCER); } return rsr; })); diff --git a/Fabric/src/main/resources/fabricasting.mixins.json b/Fabric/src/main/resources/fabricasting.mixins.json index de84b8d2..1c715f2b 100644 --- a/Fabric/src/main/resources/fabricasting.mixins.json +++ b/Fabric/src/main/resources/fabricasting.mixins.json @@ -10,8 +10,9 @@ "FabricEnchantmentTableBlockMixin", "FabricItemEntityMixin", "FabricLivingEntityMixin", - "FabricVillagerTurnIntoWitchMixin", - "FabricMobMixin" + "FabricMixinReloadableServerResources", + "FabricMobMixin", + "FabricVillagerTurnIntoWitchMixin" ], "client": [ "client.FabricAbstractTextureMixin", diff --git a/Forge/src/generated/resources/.cache/67cce32b1c3cbbcb1f646605f4914e3f196986c2 b/Forge/src/generated/resources/.cache/67cce32b1c3cbbcb1f646605f4914e3f196986c2 index fd4dfd8e..08d5a62e 100644 --- a/Forge/src/generated/resources/.cache/67cce32b1c3cbbcb1f646605f4914e3f196986c2 +++ b/Forge/src/generated/resources/.cache/67cce32b1c3cbbcb1f646605f4914e3f196986c2 @@ -1,4 +1,4 @@ -// 1.19.2 2022-11-04T11:52:25.2422393 LootTables +// 1.19.2 2023-01-22T23:58:04.863036007 LootTables 3b1e2f738c4906371a4cdecf24253ad94ae66320 data/hexcasting/loot_tables/blocks/akashic_bookshelf.json 201bbf7adff979ff8cb087e1798da5a2a31eed09 data/hexcasting/loot_tables/blocks/akashic_connector.json 16498092b43c43a4a7617ba91bcfcc13b87d9a7e data/hexcasting/loot_tables/blocks/akashic_record.json @@ -34,6 +34,3 @@ a3ca7f9427bd57a6033f241754d49425251cc091 data/hexcasting/loot_tables/blocks/scro 457b355c6a5e1b2ee4ddda37a39084ceef3546d7 data/hexcasting/loot_tables/blocks/stripped_edified_log.json 6e4bc6364e7e1cc97f1ad1127608a0b95e4d156f data/hexcasting/loot_tables/blocks/stripped_edified_wood.json e17ca4b3e84c4fb6dadfee273e6040cf15724014 data/hexcasting/loot_tables/inject/amethyst_cluster.json -a7a08d76b8a1b1596a0d67d422d7a0d93f3a1d2f data/hexcasting/loot_tables/inject/scroll_loot_few.json -01a50f557196c705c275722015cf893e0abe6425 data/hexcasting/loot_tables/inject/scroll_loot_many.json -fd874549344d85ec2bb6edcb7fe7af62cafebba2 data/hexcasting/loot_tables/inject/scroll_loot_some.json diff --git a/Forge/src/generated/resources/.cache/d4b3e6634c30118e1127c02b727ea285752e5aac b/Forge/src/generated/resources/.cache/d4b3e6634c30118e1127c02b727ea285752e5aac new file mode 100644 index 00000000..a39086ad --- /dev/null +++ b/Forge/src/generated/resources/.cache/d4b3e6634c30118e1127c02b727ea285752e5aac @@ -0,0 +1,17 @@ +// 1.19.2 2023-01-22T23:58:04.861380072 Global Loot Modifiers : hexcasting +bdfa7329fd17b9128e2bc03c662682e434d74c29 data/forge/loot_modifiers/global_loot_modifiers.json +28ca895a27221312c2451f26646111a68aadbf6c data/hexcasting/loot_modifiers/amethyst_cluster.json +a89a9e3113b83c6eb978f101aad42a6b37e7c1d8 data/hexcasting/loot_modifiers/scroll/minecraft/chests/abandoned_mineshaft.json +bfac0ff9e84cd974ccfb47edc9dce78476470103 data/hexcasting/loot_modifiers/scroll/minecraft/chests/ancient_city.json +0fcb299789a1b0162ab81a025a06b1aab5eb504b data/hexcasting/loot_modifiers/scroll/minecraft/chests/bastion_other.json +11bcc55690e58fdf2268cbb47e343efe5b806900 data/hexcasting/loot_modifiers/scroll/minecraft/chests/bastion_treasure.json +664640cdc4aad746e95354812a23724452d00717 data/hexcasting/loot_modifiers/scroll/minecraft/chests/desert_pyramid.json +2d309086694294c3da3056391adc50624ac91ba7 data/hexcasting/loot_modifiers/scroll/minecraft/chests/end_city_treasure.json +83097d0aa55dbbd8a3c520445b555ce2d10d8635 data/hexcasting/loot_modifiers/scroll/minecraft/chests/jungle_temple.json +787b9439a8c66e76487b157b42722c17a9911502 data/hexcasting/loot_modifiers/scroll/minecraft/chests/nether_bridge.json +489e7f900012fd155416420ce0bb557e661dac61 data/hexcasting/loot_modifiers/scroll/minecraft/chests/pillager_outpost.json +688ceb7b895290d939701961ac8a8eeea4199e3a data/hexcasting/loot_modifiers/scroll/minecraft/chests/shipwreck_map.json +992bd485599c5ae83b89b2456beda648b8c463b5 data/hexcasting/loot_modifiers/scroll/minecraft/chests/simple_dungeon.json +22d2938c6e71e5aec42b4c0b98d5856255f362eb data/hexcasting/loot_modifiers/scroll/minecraft/chests/stronghold_library.json +30c828238be60878805070d8d9322672dfc2f1d9 data/hexcasting/loot_modifiers/scroll/minecraft/chests/village/village_cartographer.json +c8d296e8d470ac101c3a719b235ea9b09ce0b655 data/hexcasting/loot_modifiers/scroll/minecraft/chests/woodland_mansion.json diff --git a/Forge/src/generated/resources/data/forge/loot_modifiers/global_loot_modifiers.json b/Forge/src/generated/resources/data/forge/loot_modifiers/global_loot_modifiers.json new file mode 100644 index 00000000..17d2e1ca --- /dev/null +++ b/Forge/src/generated/resources/data/forge/loot_modifiers/global_loot_modifiers.json @@ -0,0 +1,20 @@ +{ + "entries": [ + "hexcasting:scroll/minecraft/chests/bastion_other", + "hexcasting:scroll/minecraft/chests/nether_bridge", + "hexcasting:scroll/minecraft/chests/village/village_cartographer", + "hexcasting:scroll/minecraft/chests/end_city_treasure", + "hexcasting:scroll/minecraft/chests/jungle_temple", + "hexcasting:scroll/minecraft/chests/bastion_treasure", + "hexcasting:scroll/minecraft/chests/pillager_outpost", + "hexcasting:scroll/minecraft/chests/desert_pyramid", + "hexcasting:scroll/minecraft/chests/shipwreck_map", + "hexcasting:scroll/minecraft/chests/abandoned_mineshaft", + "hexcasting:amethyst_cluster", + "hexcasting:scroll/minecraft/chests/ancient_city", + "hexcasting:scroll/minecraft/chests/stronghold_library", + "hexcasting:scroll/minecraft/chests/woodland_mansion", + "hexcasting:scroll/minecraft/chests/simple_dungeon" + ], + "replace": false +} \ No newline at end of file diff --git a/Forge/src/generated/resources/data/hexcasting/loot_modifiers/amethyst_cluster.json b/Forge/src/generated/resources/data/hexcasting/loot_modifiers/amethyst_cluster.json new file mode 100644 index 00000000..c01f47fd --- /dev/null +++ b/Forge/src/generated/resources/data/hexcasting/loot_modifiers/amethyst_cluster.json @@ -0,0 +1,10 @@ +{ + "type": "hexcasting:amethyst_cluster", + "conditions": [ + { + "condition": "forge:loot_table_id", + "loot_table_id": "minecraft:blocks/amethyst_cluster" + } + ], + "shardDelta": -0.5 +} \ No newline at end of file diff --git a/Forge/src/generated/resources/data/hexcasting/loot_modifiers/scroll/minecraft/chests/abandoned_mineshaft.json b/Forge/src/generated/resources/data/hexcasting/loot_modifiers/scroll/minecraft/chests/abandoned_mineshaft.json new file mode 100644 index 00000000..bfa7024e --- /dev/null +++ b/Forge/src/generated/resources/data/hexcasting/loot_modifiers/scroll/minecraft/chests/abandoned_mineshaft.json @@ -0,0 +1,10 @@ +{ + "type": "hexcasting:inject_scrolls", + "conditions": [ + { + "condition": "forge:loot_table_id", + "loot_table_id": "minecraft:chests/abandoned_mineshaft" + } + ], + "countRange": 1 +} \ No newline at end of file diff --git a/Forge/src/generated/resources/data/hexcasting/loot_modifiers/scroll/minecraft/chests/ancient_city.json b/Forge/src/generated/resources/data/hexcasting/loot_modifiers/scroll/minecraft/chests/ancient_city.json new file mode 100644 index 00000000..d95dc336 --- /dev/null +++ b/Forge/src/generated/resources/data/hexcasting/loot_modifiers/scroll/minecraft/chests/ancient_city.json @@ -0,0 +1,10 @@ +{ + "type": "hexcasting:inject_scrolls", + "conditions": [ + { + "condition": "forge:loot_table_id", + "loot_table_id": "minecraft:chests/ancient_city" + } + ], + "countRange": 4 +} \ No newline at end of file diff --git a/Forge/src/generated/resources/data/hexcasting/loot_modifiers/scroll/minecraft/chests/bastion_other.json b/Forge/src/generated/resources/data/hexcasting/loot_modifiers/scroll/minecraft/chests/bastion_other.json new file mode 100644 index 00000000..bbe250d8 --- /dev/null +++ b/Forge/src/generated/resources/data/hexcasting/loot_modifiers/scroll/minecraft/chests/bastion_other.json @@ -0,0 +1,10 @@ +{ + "type": "hexcasting:inject_scrolls", + "conditions": [ + { + "condition": "forge:loot_table_id", + "loot_table_id": "minecraft:chests/bastion_other" + } + ], + "countRange": 1 +} \ No newline at end of file diff --git a/Forge/src/generated/resources/data/hexcasting/loot_modifiers/scroll/minecraft/chests/bastion_treasure.json b/Forge/src/generated/resources/data/hexcasting/loot_modifiers/scroll/minecraft/chests/bastion_treasure.json new file mode 100644 index 00000000..2f53299e --- /dev/null +++ b/Forge/src/generated/resources/data/hexcasting/loot_modifiers/scroll/minecraft/chests/bastion_treasure.json @@ -0,0 +1,10 @@ +{ + "type": "hexcasting:inject_scrolls", + "conditions": [ + { + "condition": "forge:loot_table_id", + "loot_table_id": "minecraft:chests/bastion_treasure" + } + ], + "countRange": 3 +} \ No newline at end of file diff --git a/Forge/src/generated/resources/data/hexcasting/loot_modifiers/scroll/minecraft/chests/desert_pyramid.json b/Forge/src/generated/resources/data/hexcasting/loot_modifiers/scroll/minecraft/chests/desert_pyramid.json new file mode 100644 index 00000000..27e5832d --- /dev/null +++ b/Forge/src/generated/resources/data/hexcasting/loot_modifiers/scroll/minecraft/chests/desert_pyramid.json @@ -0,0 +1,10 @@ +{ + "type": "hexcasting:inject_scrolls", + "conditions": [ + { + "condition": "forge:loot_table_id", + "loot_table_id": "minecraft:chests/desert_pyramid" + } + ], + "countRange": 2 +} \ No newline at end of file diff --git a/Forge/src/generated/resources/data/hexcasting/loot_modifiers/scroll/minecraft/chests/end_city_treasure.json b/Forge/src/generated/resources/data/hexcasting/loot_modifiers/scroll/minecraft/chests/end_city_treasure.json new file mode 100644 index 00000000..00fce8ee --- /dev/null +++ b/Forge/src/generated/resources/data/hexcasting/loot_modifiers/scroll/minecraft/chests/end_city_treasure.json @@ -0,0 +1,10 @@ +{ + "type": "hexcasting:inject_scrolls", + "conditions": [ + { + "condition": "forge:loot_table_id", + "loot_table_id": "minecraft:chests/end_city_treasure" + } + ], + "countRange": 3 +} \ No newline at end of file diff --git a/Forge/src/generated/resources/data/hexcasting/loot_modifiers/scroll/minecraft/chests/jungle_temple.json b/Forge/src/generated/resources/data/hexcasting/loot_modifiers/scroll/minecraft/chests/jungle_temple.json new file mode 100644 index 00000000..bdad563e --- /dev/null +++ b/Forge/src/generated/resources/data/hexcasting/loot_modifiers/scroll/minecraft/chests/jungle_temple.json @@ -0,0 +1,10 @@ +{ + "type": "hexcasting:inject_scrolls", + "conditions": [ + { + "condition": "forge:loot_table_id", + "loot_table_id": "minecraft:chests/jungle_temple" + } + ], + "countRange": 2 +} \ No newline at end of file diff --git a/Forge/src/generated/resources/data/hexcasting/loot_modifiers/scroll/minecraft/chests/nether_bridge.json b/Forge/src/generated/resources/data/hexcasting/loot_modifiers/scroll/minecraft/chests/nether_bridge.json new file mode 100644 index 00000000..2a95ff88 --- /dev/null +++ b/Forge/src/generated/resources/data/hexcasting/loot_modifiers/scroll/minecraft/chests/nether_bridge.json @@ -0,0 +1,10 @@ +{ + "type": "hexcasting:inject_scrolls", + "conditions": [ + { + "condition": "forge:loot_table_id", + "loot_table_id": "minecraft:chests/nether_bridge" + } + ], + "countRange": 1 +} \ No newline at end of file diff --git a/Forge/src/generated/resources/data/hexcasting/loot_modifiers/scroll/minecraft/chests/pillager_outpost.json b/Forge/src/generated/resources/data/hexcasting/loot_modifiers/scroll/minecraft/chests/pillager_outpost.json new file mode 100644 index 00000000..76114fb3 --- /dev/null +++ b/Forge/src/generated/resources/data/hexcasting/loot_modifiers/scroll/minecraft/chests/pillager_outpost.json @@ -0,0 +1,10 @@ +{ + "type": "hexcasting:inject_scrolls", + "conditions": [ + { + "condition": "forge:loot_table_id", + "loot_table_id": "minecraft:chests/pillager_outpost" + } + ], + "countRange": 4 +} \ No newline at end of file diff --git a/Forge/src/generated/resources/data/hexcasting/loot_modifiers/scroll/minecraft/chests/shipwreck_map.json b/Forge/src/generated/resources/data/hexcasting/loot_modifiers/scroll/minecraft/chests/shipwreck_map.json new file mode 100644 index 00000000..23c9b247 --- /dev/null +++ b/Forge/src/generated/resources/data/hexcasting/loot_modifiers/scroll/minecraft/chests/shipwreck_map.json @@ -0,0 +1,10 @@ +{ + "type": "hexcasting:inject_scrolls", + "conditions": [ + { + "condition": "forge:loot_table_id", + "loot_table_id": "minecraft:chests/shipwreck_map" + } + ], + "countRange": 3 +} \ No newline at end of file diff --git a/Forge/src/generated/resources/data/hexcasting/loot_modifiers/scroll/minecraft/chests/simple_dungeon.json b/Forge/src/generated/resources/data/hexcasting/loot_modifiers/scroll/minecraft/chests/simple_dungeon.json new file mode 100644 index 00000000..1166f9ae --- /dev/null +++ b/Forge/src/generated/resources/data/hexcasting/loot_modifiers/scroll/minecraft/chests/simple_dungeon.json @@ -0,0 +1,10 @@ +{ + "type": "hexcasting:inject_scrolls", + "conditions": [ + { + "condition": "forge:loot_table_id", + "loot_table_id": "minecraft:chests/simple_dungeon" + } + ], + "countRange": 1 +} \ No newline at end of file diff --git a/Forge/src/generated/resources/data/hexcasting/loot_modifiers/scroll/minecraft/chests/stronghold_library.json b/Forge/src/generated/resources/data/hexcasting/loot_modifiers/scroll/minecraft/chests/stronghold_library.json new file mode 100644 index 00000000..d3766ee5 --- /dev/null +++ b/Forge/src/generated/resources/data/hexcasting/loot_modifiers/scroll/minecraft/chests/stronghold_library.json @@ -0,0 +1,10 @@ +{ + "type": "hexcasting:inject_scrolls", + "conditions": [ + { + "condition": "forge:loot_table_id", + "loot_table_id": "minecraft:chests/stronghold_library" + } + ], + "countRange": 5 +} \ No newline at end of file diff --git a/Forge/src/generated/resources/data/hexcasting/loot_modifiers/scroll/minecraft/chests/village/village_cartographer.json b/Forge/src/generated/resources/data/hexcasting/loot_modifiers/scroll/minecraft/chests/village/village_cartographer.json new file mode 100644 index 00000000..4da3988e --- /dev/null +++ b/Forge/src/generated/resources/data/hexcasting/loot_modifiers/scroll/minecraft/chests/village/village_cartographer.json @@ -0,0 +1,10 @@ +{ + "type": "hexcasting:inject_scrolls", + "conditions": [ + { + "condition": "forge:loot_table_id", + "loot_table_id": "minecraft:chests/village/village_cartographer" + } + ], + "countRange": 2 +} \ No newline at end of file diff --git a/Forge/src/generated/resources/data/hexcasting/loot_modifiers/scroll/minecraft/chests/woodland_mansion.json b/Forge/src/generated/resources/data/hexcasting/loot_modifiers/scroll/minecraft/chests/woodland_mansion.json new file mode 100644 index 00000000..bf19b951 --- /dev/null +++ b/Forge/src/generated/resources/data/hexcasting/loot_modifiers/scroll/minecraft/chests/woodland_mansion.json @@ -0,0 +1,10 @@ +{ + "type": "hexcasting:inject_scrolls", + "conditions": [ + { + "condition": "forge:loot_table_id", + "loot_table_id": "minecraft:chests/woodland_mansion" + } + ], + "countRange": 5 +} \ No newline at end of file diff --git a/Forge/src/generated/resources/data/hexcasting/loot_tables/inject/scroll_loot_few.json b/Forge/src/generated/resources/data/hexcasting/loot_tables/inject/scroll_loot_few.json deleted file mode 100644 index 318dfb59..00000000 --- a/Forge/src/generated/resources/data/hexcasting/loot_tables/inject/scroll_loot_few.json +++ /dev/null @@ -1,23 +0,0 @@ -{ - "pools": [ - { - "bonus_rolls": 0.0, - "entries": [ - { - "type": "minecraft:item", - "name": "hexcasting:scroll" - } - ], - "functions": [ - { - "function": "hexcasting:pattern_scroll" - } - ], - "rolls": { - "type": "minecraft:uniform", - "max": 1.0, - "min": -1.0 - } - } - ] -} \ No newline at end of file diff --git a/Forge/src/generated/resources/data/hexcasting/loot_tables/inject/scroll_loot_many.json b/Forge/src/generated/resources/data/hexcasting/loot_tables/inject/scroll_loot_many.json deleted file mode 100644 index 938e982a..00000000 --- a/Forge/src/generated/resources/data/hexcasting/loot_tables/inject/scroll_loot_many.json +++ /dev/null @@ -1,23 +0,0 @@ -{ - "pools": [ - { - "bonus_rolls": 0.0, - "entries": [ - { - "type": "minecraft:item", - "name": "hexcasting:scroll" - } - ], - "functions": [ - { - "function": "hexcasting:pattern_scroll" - } - ], - "rolls": { - "type": "minecraft:uniform", - "max": 3.0, - "min": -3.0 - } - } - ] -} \ No newline at end of file diff --git a/Forge/src/generated/resources/data/hexcasting/loot_tables/inject/scroll_loot_some.json b/Forge/src/generated/resources/data/hexcasting/loot_tables/inject/scroll_loot_some.json deleted file mode 100644 index 3f668b3f..00000000 --- a/Forge/src/generated/resources/data/hexcasting/loot_tables/inject/scroll_loot_some.json +++ /dev/null @@ -1,23 +0,0 @@ -{ - "pools": [ - { - "bonus_rolls": 0.0, - "entries": [ - { - "type": "minecraft:item", - "name": "hexcasting:scroll" - } - ], - "functions": [ - { - "function": "hexcasting:pattern_scroll" - } - ], - "rolls": { - "type": "minecraft:uniform", - "max": 2.0, - "min": -2.0 - } - } - ] -} \ No newline at end of file diff --git a/Forge/src/main/java/at/petrak/hexcasting/forge/ForgeHexConfig.java b/Forge/src/main/java/at/petrak/hexcasting/forge/ForgeHexConfig.java index a0dcd13c..2165c6c2 100644 --- a/Forge/src/main/java/at/petrak/hexcasting/forge/ForgeHexConfig.java +++ b/Forge/src/main/java/at/petrak/hexcasting/forge/ForgeHexConfig.java @@ -1,6 +1,5 @@ package at.petrak.hexcasting.forge; -import at.petrak.hexcasting.api.misc.ScrollQuantity; import at.petrak.hexcasting.api.mod.HexConfig; import net.minecraft.resources.ResourceKey; import net.minecraft.resources.ResourceLocation; @@ -9,7 +8,6 @@ import net.minecraftforge.common.ForgeConfigSpec; import java.util.List; -import static at.petrak.hexcasting.api.mod.HexConfig.anyMatch; import static at.petrak.hexcasting.api.mod.HexConfig.noneMatch; public class ForgeHexConfig implements HexConfig.CommonConfigAccess { @@ -143,18 +141,6 @@ public class ForgeHexConfig implements HexConfig.CommonConfigAccess { tpDimDenyList = builder.comment("Resource locations of dimensions you can't Blink or Greater Teleport in.") .defineList("tpDimDenyList", DEFAULT_DIM_TP_DENYLIST, Server::isValidReslocArg); - - builder.push("Scrolls in Loot"); - - fewScrollTables = builder.comment( - "Which loot tables should a small number of Ancient Scrolls be injected into?") - .defineList("fewScrollTables", DEFAULT_FEW_SCROLL_TABLES, Server::isValidReslocArg); - someScrollTables = builder.comment( - "Which loot tables should a decent number of Ancient Scrolls be injected into?") - .defineList("someScrollTables", DEFAULT_SOME_SCROLL_TABLES, Server::isValidReslocArg); - manyScrollTables = builder.comment( - "Which loot tables should a huge number of Ancient Scrolls be injected into?") - .defineList("manyScrollTables", DEFAULT_MANY_SCROLL_TABLES, Server::isValidReslocArg); } @Override @@ -192,32 +178,6 @@ public class ForgeHexConfig implements HexConfig.CommonConfigAccess { return noneMatch(tpDimDenyList.get(), dimension.location()); } - // TODO: on Forge, this value isn't loaded when creating a new world yet because config is per-world. - // For now I'm hardcoding this, but for correctness we should probably switch the table - // injects to be loaded from datapack instead of config. - // (Without hardcoding loading a new world is *incredibly* laggy because it throws every single time it tries to - // load *any* loot table) - @Override - public ScrollQuantity scrollsForLootTable(ResourceLocation lootTable) { - try { - if (anyMatch(HexConfig.ServerConfigAccess.DEFAULT_FEW_SCROLL_TABLES, lootTable)) { - return ScrollQuantity.FEW; - } else if (anyMatch(HexConfig.ServerConfigAccess.DEFAULT_SOME_SCROLL_TABLES, lootTable)) { - return ScrollQuantity.SOME; - } else if (anyMatch(HexConfig.ServerConfigAccess.DEFAULT_MANY_SCROLL_TABLES, lootTable)) { - return ScrollQuantity.MANY; - } - } catch (IllegalStateException ignored) { - // then we are in develop env AND this is being called in the new world screen (it loads datapacks for - // world generation options) - // config values don't exist yet because config is per-world on Forge, and in dev it throws an exn - // (in release it just silently returns default, which is expected behavior here, but the comment - // suggests - // it will start throwing at some point soon.) - } - return ScrollQuantity.NONE; - } - private static boolean isValidReslocArg(Object o) { return o instanceof String s && ResourceLocation.isValidResourceLocation(s); } diff --git a/Forge/src/main/java/at/petrak/hexcasting/forge/ForgeHexInitializer.java b/Forge/src/main/java/at/petrak/hexcasting/forge/ForgeHexInitializer.java index 8c7afea5..2a6bf4e8 100644 --- a/Forge/src/main/java/at/petrak/hexcasting/forge/ForgeHexInitializer.java +++ b/Forge/src/main/java/at/petrak/hexcasting/forge/ForgeHexInitializer.java @@ -16,14 +16,13 @@ import at.petrak.hexcasting.common.lib.hex.HexActions; import at.petrak.hexcasting.common.lib.hex.HexEvalSounds; import at.petrak.hexcasting.common.lib.hex.HexIotaTypes; import at.petrak.hexcasting.common.lib.hex.HexSpecialHandlers; -import at.petrak.hexcasting.common.loot.HexLootHandler; import at.petrak.hexcasting.common.misc.AkashicTreeGrower; import at.petrak.hexcasting.common.misc.BrainsweepingEvents; import at.petrak.hexcasting.common.misc.PlayerPositionRecorder; import at.petrak.hexcasting.common.recipe.HexRecipeStuffRegistry; import at.petrak.hexcasting.forge.cap.CapSyncers; import at.petrak.hexcasting.forge.cap.ForgeCapabilityHandler; -import at.petrak.hexcasting.forge.datagen.HexForgeDataGenerators; +import at.petrak.hexcasting.forge.datagen.ForgeHexDataGenerators; import at.petrak.hexcasting.forge.interop.curios.CuriosApiInterop; import at.petrak.hexcasting.forge.interop.curios.CuriosRenderers; import at.petrak.hexcasting.forge.lib.ForgeHexArgumentTypeRegistry; @@ -49,7 +48,6 @@ import net.minecraftforge.common.ForgeConfigSpec; import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.common.ToolActions; import net.minecraftforge.common.crafting.CraftingHelper; -import net.minecraftforge.event.LootTableLoadEvent; import net.minecraftforge.event.RegisterCommandsEvent; import net.minecraftforge.event.TickEvent; import net.minecraftforge.event.entity.living.LivingConversionEvent; @@ -201,10 +199,6 @@ public class ForgeHexInitializer { evt.setCanceled(ItemJewelerHammer.shouldFailToBreak(evt.getEntity(), evt.getState(), pos.get())); }); - evBus.addListener((LootTableLoadEvent evt) -> HexLootHandler.lootLoad( - evt.getName(), - builder -> evt.getTable().addPool(builder.build()))); - // === Events implemented in other ways on Fabric // On Fabric this should be auto-synced @@ -234,7 +228,7 @@ public class ForgeHexInitializer { evBus.addGenericListener(BlockEntity.class, ForgeCapabilityHandler::attachBlockEntityCaps); evBus.addGenericListener(Entity.class, ForgeCapabilityHandler::attachEntityCaps); - modBus.register(HexForgeDataGenerators.class); + modBus.register(ForgeHexDataGenerators.class); modBus.register(ForgeCapabilityHandler.class); evBus.register(CapSyncers.class); diff --git a/Forge/src/main/java/at/petrak/hexcasting/forge/datagen/HexForgeConditionsBuilder.java b/Forge/src/main/java/at/petrak/hexcasting/forge/datagen/ForgeHexConditionsBuilder.java similarity index 91% rename from Forge/src/main/java/at/petrak/hexcasting/forge/datagen/HexForgeConditionsBuilder.java rename to Forge/src/main/java/at/petrak/hexcasting/forge/datagen/ForgeHexConditionsBuilder.java index f92ebca5..93b1cfe5 100644 --- a/Forge/src/main/java/at/petrak/hexcasting/forge/datagen/HexForgeConditionsBuilder.java +++ b/Forge/src/main/java/at/petrak/hexcasting/forge/datagen/ForgeHexConditionsBuilder.java @@ -16,11 +16,11 @@ import java.util.ArrayList; import java.util.List; import java.util.function.Consumer; -public class HexForgeConditionsBuilder implements IXplatConditionsBuilder, IConditionBuilder { +public class ForgeHexConditionsBuilder implements IXplatConditionsBuilder, IConditionBuilder { private final List conditions = new ArrayList<>(); private final RecipeBuilder parent; - public HexForgeConditionsBuilder(RecipeBuilder parent) { + public ForgeHexConditionsBuilder(RecipeBuilder parent) { this.parent = parent; } @@ -37,7 +37,8 @@ public class HexForgeConditionsBuilder implements IXplatConditionsBuilder, ICond } @Override - public @NotNull RecipeBuilder unlockedBy(@NotNull String string, @NotNull CriterionTriggerInstance criterionTriggerInstance) { + public @NotNull RecipeBuilder unlockedBy(@NotNull String string, + @NotNull CriterionTriggerInstance criterionTriggerInstance) { return parent.unlockedBy(string, criterionTriggerInstance); } diff --git a/Forge/src/main/java/at/petrak/hexcasting/forge/datagen/HexForgeDataGenerators.java b/Forge/src/main/java/at/petrak/hexcasting/forge/datagen/ForgeHexDataGenerators.java similarity index 97% rename from Forge/src/main/java/at/petrak/hexcasting/forge/datagen/HexForgeDataGenerators.java rename to Forge/src/main/java/at/petrak/hexcasting/forge/datagen/ForgeHexDataGenerators.java index 1304019d..576cb87f 100644 --- a/Forge/src/main/java/at/petrak/hexcasting/forge/datagen/HexForgeDataGenerators.java +++ b/Forge/src/main/java/at/petrak/hexcasting/forge/datagen/ForgeHexDataGenerators.java @@ -31,7 +31,7 @@ import net.minecraftforge.eventbus.api.SubscribeEvent; import java.util.EnumMap; import java.util.stream.Stream; -public class HexForgeDataGenerators { +public class ForgeHexDataGenerators { @SubscribeEvent public static void generateData(GatherDataEvent ev) { if (System.getProperty("hexcasting.xplat_datagen") != null) { @@ -59,7 +59,7 @@ public class HexForgeDataGenerators { DataGenerator gen = ev.getGenerator(); ExistingFileHelper efh = ev.getExistingFileHelper(); gen.addProvider(ev.includeServer(), new HexLootTables(gen)); - gen.addProvider(ev.includeServer(), new HexplatRecipes(gen, INGREDIENTS, HexForgeConditionsBuilder::new)); + gen.addProvider(ev.includeServer(), new HexplatRecipes(gen, INGREDIENTS, ForgeHexConditionsBuilder::new)); var xtags = IXplatAbstractions.INSTANCE.tags(); var blockTagProvider = PaucalForgeDatagenWrappers.addEFHToTagProvider( @@ -70,6 +70,8 @@ public class HexForgeDataGenerators { gen.addProvider(ev.includeServer(), itemTagProvider); gen.addProvider(ev.includeServer(), PaucalForgeDatagenWrappers.addEFHToTagProvider(new HexActionTagProvider(gen), efh)); + + gen.addProvider(ev.includeServer(), new ForgeHexLootModGen(gen)); } private static final IXplatIngredients INGREDIENTS = new IXplatIngredients() { diff --git a/Forge/src/main/java/at/petrak/hexcasting/forge/datagen/ForgeHexLootModGen.java b/Forge/src/main/java/at/petrak/hexcasting/forge/datagen/ForgeHexLootModGen.java new file mode 100644 index 00000000..eee39bf4 --- /dev/null +++ b/Forge/src/main/java/at/petrak/hexcasting/forge/datagen/ForgeHexLootModGen.java @@ -0,0 +1,31 @@ +package at.petrak.hexcasting.forge.datagen; + +import at.petrak.hexcasting.api.HexAPI; +import at.petrak.hexcasting.common.loot.HexLootHandler; +import at.petrak.hexcasting.forge.loot.ForgeHexAmethystLootMod; +import at.petrak.hexcasting.forge.loot.ForgeHexScrollLootMod; +import net.minecraft.data.DataGenerator; +import net.minecraft.world.level.block.Blocks; +import net.minecraft.world.level.storage.loot.predicates.LootItemCondition; +import net.minecraftforge.common.data.GlobalLootModifierProvider; +import net.minecraftforge.common.loot.LootTableIdCondition; + +public class ForgeHexLootModGen extends GlobalLootModifierProvider { + public ForgeHexLootModGen(DataGenerator gen) { + super(gen, HexAPI.MOD_ID); + } + + @Override + protected void start() { + for (var injection : HexLootHandler.DEFAULT_SCROLL_INJECTS) { + var name = "scroll/%s/%s".formatted(injection.injectee().getNamespace(), injection.injectee().getPath()); + add(name, new ForgeHexScrollLootMod(new LootItemCondition[]{ + LootTableIdCondition.builder(injection.injectee()).build(), + }, injection.countRange())); + } + + add("amethyst_cluster", new ForgeHexAmethystLootMod(new LootItemCondition[]{ + LootTableIdCondition.builder(Blocks.AMETHYST_CLUSTER.getLootTable()).build() + }, HexLootHandler.DEFAULT_SHARD_MODIFICATION)); + } +} diff --git a/Forge/src/main/java/at/petrak/hexcasting/forge/lib/ForgeHexLootMods.java b/Forge/src/main/java/at/petrak/hexcasting/forge/lib/ForgeHexLootMods.java index c1180fbf..87a8f71a 100644 --- a/Forge/src/main/java/at/petrak/hexcasting/forge/lib/ForgeHexLootMods.java +++ b/Forge/src/main/java/at/petrak/hexcasting/forge/lib/ForgeHexLootMods.java @@ -1,6 +1,7 @@ package at.petrak.hexcasting.forge.lib; import at.petrak.hexcasting.api.HexAPI; +import at.petrak.hexcasting.forge.loot.ForgeHexAmethystLootMod; import at.petrak.hexcasting.forge.loot.ForgeHexScrollLootMod; import com.mojang.serialization.Codec; import net.minecraftforge.common.loot.IGlobalLootModifier; @@ -14,4 +15,6 @@ public class ForgeHexLootMods { public static final RegistryObject> INJECT_SCROLLS = REGISTRY.register( "inject_scrolls", ForgeHexScrollLootMod.CODEC); + public static final RegistryObject> AMETHYST = REGISTRY.register( + "amethyst_cluster", ForgeHexAmethystLootMod.CODEC); } diff --git a/Forge/src/main/java/at/petrak/hexcasting/forge/loot/ForgeHexAmethystLootMod.java b/Forge/src/main/java/at/petrak/hexcasting/forge/loot/ForgeHexAmethystLootMod.java new file mode 100644 index 00000000..d43b0abb --- /dev/null +++ b/Forge/src/main/java/at/petrak/hexcasting/forge/loot/ForgeHexAmethystLootMod.java @@ -0,0 +1,50 @@ +package at.petrak.hexcasting.forge.loot; + +import at.petrak.hexcasting.common.loot.AmethystReducerFunc; +import at.petrak.hexcasting.common.loot.HexLootHandler; +import at.petrak.hexcasting.forge.lib.ForgeHexLootMods; +import com.google.common.base.Suppliers; +import com.mojang.serialization.Codec; +import com.mojang.serialization.codecs.RecordCodecBuilder; +import it.unimi.dsi.fastutil.objects.ObjectArrayList; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.level.storage.loot.LootContext; +import net.minecraft.world.level.storage.loot.predicates.LootItemCondition; +import net.minecraftforge.common.loot.LootModifier; +import org.jetbrains.annotations.NotNull; + +import java.util.function.Supplier; + +public class ForgeHexAmethystLootMod extends LootModifier { + public static final Supplier> CODEC = + Suppliers.memoize(() -> RecordCodecBuilder.create( + inst -> codecStart(inst).and( + Codec.DOUBLE.fieldOf("shardDelta").forGetter(it -> it.shardDelta) + ).apply(inst, ForgeHexAmethystLootMod::new) + )); + + public final double shardDelta; + + public ForgeHexAmethystLootMod(LootItemCondition[] conditionsIn, double shardDelta) { + super(conditionsIn); + this.shardDelta = shardDelta; + } + + @Override + protected @NotNull ObjectArrayList doApply(ObjectArrayList generatedLoot, + LootContext context) { + var injectPool = context.getLootTable(HexLootHandler.TABLE_INJECT_AMETHYST_CLUSTER); + injectPool.getRandomItemsRaw(context, generatedLoot::add); + + for (var stack : generatedLoot) { + AmethystReducerFunc.doStatic(stack, context, this.shardDelta); + } + + return generatedLoot; + } + + @Override + public Codec codec() { + return ForgeHexLootMods.AMETHYST.get(); + } +} diff --git a/Forge/src/main/java/at/petrak/hexcasting/forge/loot/ForgeHexScrollLootMod.java b/Forge/src/main/java/at/petrak/hexcasting/forge/loot/ForgeHexScrollLootMod.java index 5164986d..ffae0a85 100644 --- a/Forge/src/main/java/at/petrak/hexcasting/forge/loot/ForgeHexScrollLootMod.java +++ b/Forge/src/main/java/at/petrak/hexcasting/forge/loot/ForgeHexScrollLootMod.java @@ -1,6 +1,9 @@ package at.petrak.hexcasting.forge.loot; -import at.petrak.hexcasting.api.misc.ScrollQuantity; +import at.petrak.hexcasting.common.lib.HexItems; +import at.petrak.hexcasting.common.loot.AddPerWorldPatternToScrollFunc; +import at.petrak.hexcasting.common.loot.HexLootHandler; +import at.petrak.hexcasting.forge.lib.ForgeHexLootMods; import com.google.common.base.Suppliers; import com.mojang.serialization.Codec; import com.mojang.serialization.codecs.RecordCodecBuilder; @@ -18,27 +21,31 @@ public class ForgeHexScrollLootMod extends LootModifier { public static final Supplier> CODEC = Suppliers.memoize(() -> RecordCodecBuilder.create( inst -> codecStart(inst).and( - Codec.INT.fieldOf("quantity").forGetter(it -> it.quantity.ordinal()) - ).apply(inst, (cond, quant) -> new ForgeHexScrollLootMod(cond, ScrollQuantity.values()[quant])) + Codec.INT.fieldOf("countRange").forGetter(it -> it.countRange) + ).apply(inst, ForgeHexScrollLootMod::new) )); - public final ScrollQuantity quantity; + public final int countRange; - public ForgeHexScrollLootMod(LootItemCondition[] conditionsIn, ScrollQuantity quantity) { + public ForgeHexScrollLootMod(LootItemCondition[] conditionsIn, int countRange) { super(conditionsIn); - this.quantity = quantity; + this.countRange = countRange; } @Override protected @NotNull ObjectArrayList doApply(ObjectArrayList generatedLoot, LootContext context) { - var injectedTable = context.getLootTable(this.quantity.getPool()); - injectedTable.getRandomItemsRaw(context, generatedLoot::add); + int count = HexLootHandler.getScrollCount(this.countRange, context.getRandom()); + for (int i = 0; i < count; i++) { + var newStack = new ItemStack(HexItems.SCROLL_LARGE); + AddPerWorldPatternToScrollFunc.doStatic(newStack, context); + generatedLoot.add(newStack); + } return generatedLoot; } @Override public Codec codec() { - return null; + return ForgeHexLootMods.INJECT_SCROLLS.get(); } } From abc2e7862b9a05d7945aa676fe0ebdd58e09ba13 Mon Sep 17 00:00:00 2001 From: "petrak@" Date: Mon, 23 Jan 2023 14:31:19 -0600 Subject: [PATCH 63/95] yatta! close #377 and make lore spawn lmao --- .../petrak/hexcasting/api/mod/HexConfig.java | 4 ++ .../common/loot/HexLootHandler.java | 19 +++++++- .../03e4de26f1265135874f8cdcaebc09d9c08eb42b | 2 +- .../67cce32b1c3cbbcb1f646605f4914e3f196986c2 | 2 +- .../75bcd4dba6ca7d365462b0ec45e291d1056349c4 | 2 +- .../844611d4af49e23072b8a888c8e73c6c5d8c0768 | 2 +- .../9fb1092f32d4fcbf9e061ffd718d4ec689c6c95e | 2 +- .../hexcasting/fabric/FabricHexConfig.java | 18 ++++++++ .../fabric/loot/FabricHexLootModJankery.java | 23 +++++++--- .../d4b3e6634c30118e1127c02b727ea285752e5aac | 14 +++++- .../loot_modifiers/global_loot_modifiers.json | 18 ++++++-- .../minecraft/chests/abandoned_mineshaft.json | 10 +++++ .../minecraft/chests/pillager_outpost.json | 10 +++++ .../lore/minecraft/chests/simple_dungeon.json | 10 +++++ .../minecraft/chests/stronghold_library.json | 10 +++++ .../chests/village/village_desert_house.json | 10 +++++ .../chests/village/village_plains_house.json | 10 +++++ .../chests/village/village_savanna_house.json | 10 +++++ .../chests/village/village_snowy_house.json | 10 +++++ .../chests/village/village_taiga_house.json | 10 +++++ .../minecraft/chests/woodland_mansion.json | 10 +++++ .../forge/datagen/ForgeHexLootModGen.java | 9 ++++ .../forge/lib/ForgeHexLootMods.java | 3 ++ .../forge/loot/ForgeHexLoreLootMod.java | 45 +++++++++++++++++++ 24 files changed, 245 insertions(+), 18 deletions(-) create mode 100644 Forge/src/generated/resources/data/hexcasting/loot_modifiers/lore/minecraft/chests/abandoned_mineshaft.json create mode 100644 Forge/src/generated/resources/data/hexcasting/loot_modifiers/lore/minecraft/chests/pillager_outpost.json create mode 100644 Forge/src/generated/resources/data/hexcasting/loot_modifiers/lore/minecraft/chests/simple_dungeon.json create mode 100644 Forge/src/generated/resources/data/hexcasting/loot_modifiers/lore/minecraft/chests/stronghold_library.json create mode 100644 Forge/src/generated/resources/data/hexcasting/loot_modifiers/lore/minecraft/chests/village/village_desert_house.json create mode 100644 Forge/src/generated/resources/data/hexcasting/loot_modifiers/lore/minecraft/chests/village/village_plains_house.json create mode 100644 Forge/src/generated/resources/data/hexcasting/loot_modifiers/lore/minecraft/chests/village/village_savanna_house.json create mode 100644 Forge/src/generated/resources/data/hexcasting/loot_modifiers/lore/minecraft/chests/village/village_snowy_house.json create mode 100644 Forge/src/generated/resources/data/hexcasting/loot_modifiers/lore/minecraft/chests/village/village_taiga_house.json create mode 100644 Forge/src/generated/resources/data/hexcasting/loot_modifiers/lore/minecraft/chests/woodland_mansion.json create mode 100644 Forge/src/main/java/at/petrak/hexcasting/forge/loot/ForgeHexLoreLootMod.java diff --git a/Common/src/main/java/at/petrak/hexcasting/api/mod/HexConfig.java b/Common/src/main/java/at/petrak/hexcasting/api/mod/HexConfig.java index baad530a..f0a5ba34 100644 --- a/Common/src/main/java/at/petrak/hexcasting/api/mod/HexConfig.java +++ b/Common/src/main/java/at/petrak/hexcasting/api/mod/HexConfig.java @@ -88,6 +88,10 @@ public class HexConfig { return keys.stream().map(ResourceLocation::new).noneMatch(key::equals); } + public static boolean anyMatchResLoc(List keys, ResourceLocation key) { + return keys.stream().anyMatch(key::equals); + } + // oh man this is aesthetically pleasing private static CommonConfigAccess common = null; private static ClientConfigAccess client = null; diff --git a/Common/src/main/java/at/petrak/hexcasting/common/loot/HexLootHandler.java b/Common/src/main/java/at/petrak/hexcasting/common/loot/HexLootHandler.java index b1f33449..e0788d54 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/loot/HexLootHandler.java +++ b/Common/src/main/java/at/petrak/hexcasting/common/loot/HexLootHandler.java @@ -9,11 +9,11 @@ import static at.petrak.hexcasting.api.HexAPI.modLoc; // https://github.com/VazkiiMods/Botania/blob/1.18.x/Xplat/src/main/java/vazkii/botania/common/loot/LootHandler.java // We need to inject dungeon loot (scrolls and lore), make amethyst drop fewer shards, and the extra dust stuff. // On forge: -// - Scrolls are done with a loot mod +// - Scrolls and lore are done with a loot mod // - Amethyst drop fiddling is done with another loot mod; the shard delta is in the loot mod data and the rest of // the stuff is loaded from TABLE_INJECT_AMETHYST_CLUSTER // On fabric: -// - Scrolls are done with a lootLoad listener and the amounts are loaded from config +// - Scrolls and lore are done with a lootLoad listener and the amounts are loaded from config // - Amethyst shard reduction is done with a loot function mixed in to always be on amethyst clusters, god, cause I // don't think it's facile to use the loot pool api to try to figure out which pool is for the amethyst and reduce it // - Amethyst dust and crystals are done by adding the loot table Forge uses in directly via listener @@ -47,11 +47,26 @@ public class HexLootHandler { new ScrollInjection(new ResourceLocation("minecraft", "chests/stronghold_library"), 5) ); + public static final ImmutableList DEFAULT_LORE_INJECTS = ImmutableList.of( + new ResourceLocation("minecraft", "chests/simple_dungeon"), + new ResourceLocation("minecraft", "chests/abandoned_mineshaft"), + new ResourceLocation("minecraft", "chests/pillager_outpost"), + new ResourceLocation("minecraft", "chests/woodland_mansion"), + new ResourceLocation("minecraft", "chests/stronghold_library"), + // >:) + new ResourceLocation("minecraft", "chests/village/village_desert_house"), + new ResourceLocation("minecraft", "chests/village/village_plains_house"), + new ResourceLocation("minecraft", "chests/village/village_savanna_house"), + new ResourceLocation("minecraft", "chests/village/village_snowy_house"), + new ResourceLocation("minecraft", "chests/village/village_taiga_house") + ); + public static int getScrollCount(int range, RandomSource random) { return Math.max(random.nextIntBetweenInclusive(-range, range), 0); } public static final double DEFAULT_SHARD_MODIFICATION = -0.5; + public static final double DEFAULT_LORE_CHANCE = 0.4; public static final ResourceLocation TABLE_INJECT_AMETHYST_CLUSTER = modLoc("inject/amethyst_cluster"); diff --git a/Fabric/src/generated/resources/.cache/03e4de26f1265135874f8cdcaebc09d9c08eb42b b/Fabric/src/generated/resources/.cache/03e4de26f1265135874f8cdcaebc09d9c08eb42b index 51ce2bb5..0b9b893d 100644 --- a/Fabric/src/generated/resources/.cache/03e4de26f1265135874f8cdcaebc09d9c08eb42b +++ b/Fabric/src/generated/resources/.cache/03e4de26f1265135874f8cdcaebc09d9c08eb42b @@ -1,4 +1,4 @@ -// 1.19.2 2023-01-22T23:57:23.050599591 Tags for minecraft:item +// 1.19.2 2023-01-23T14:22:44.2568588 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 e865bcdb..ff915e4f 100644 --- a/Fabric/src/generated/resources/.cache/67cce32b1c3cbbcb1f646605f4914e3f196986c2 +++ b/Fabric/src/generated/resources/.cache/67cce32b1c3cbbcb1f646605f4914e3f196986c2 @@ -1,4 +1,4 @@ -// 1.19.2 2023-01-22T23:57:23.070700759 LootTables +// 1.19.2 2023-01-23T14:22:44.219077975 LootTables dec1d3592e82f99d9e059d9c771530f103b2bda5 data/hexcasting/loot_tables/blocks/empty_directrix.json 2c42fc5d8c74c98ad15b8bd50f56541fccbef750 data/hexcasting/loot_tables/blocks/edified_tile.json cfb39e2151725fe4f9a7269d9b5de8031ea54a44 data/hexcasting/loot_tables/blocks/directrix_redstone.json diff --git a/Fabric/src/generated/resources/.cache/75bcd4dba6ca7d365462b0ec45e291d1056349c4 b/Fabric/src/generated/resources/.cache/75bcd4dba6ca7d365462b0ec45e291d1056349c4 index 9b43c7b5..9c3bfdaf 100644 --- a/Fabric/src/generated/resources/.cache/75bcd4dba6ca7d365462b0ec45e291d1056349c4 +++ b/Fabric/src/generated/resources/.cache/75bcd4dba6ca7d365462b0ec45e291d1056349c4 @@ -1,4 +1,4 @@ -// 1.19.2 2023-01-22T23:57:23.071366626 Tags for minecraft:block +// 1.19.2 2023-01-23T14:22:44.257772029 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 fa887791..9033a452 100644 --- a/Fabric/src/generated/resources/.cache/844611d4af49e23072b8a888c8e73c6c5d8c0768 +++ b/Fabric/src/generated/resources/.cache/844611d4af49e23072b8a888c8e73c6c5d8c0768 @@ -1,4 +1,4 @@ -// 1.19.2 2023-01-22T23:57:23.069878587 Tags for hexcasting:action +// 1.19.2 2023-01-23T14:22:44.223016397 Tags for hexcasting:action e5afc567ea17f035e4eb1d1d48825100b7f6ad68 data/hexcasting/tags/action/per_world_pattern.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 251c9838..92865607 100644 --- a/Fabric/src/generated/resources/.cache/9fb1092f32d4fcbf9e061ffd718d4ec689c6c95e +++ b/Fabric/src/generated/resources/.cache/9fb1092f32d4fcbf9e061ffd718d4ec689c6c95e @@ -1,4 +1,4 @@ -// 1.19.2 2023-01-22T23:57:23.052460583 Recipes +// 1.19.2 2023-01-23T14:22:44.22380957 Recipes 9f75d3e93ecbbbf3ed9a92b2943397e09dcae1a9 data/hexcasting/recipes/dye_colorizer_light_blue.json 04569ccadfd99f203b0485d0c3e877209290f2b3 data/hexcasting/advancements/recipes/hexcasting.creative_tab/dye_colorizer_pink.json 2a9d4a0f3618abf9e9b8699b318a984d2c836913 data/hexcasting/advancements/recipes/brainsweep/brainsweep/directrix_redstone.json diff --git a/Fabric/src/main/java/at/petrak/hexcasting/fabric/FabricHexConfig.java b/Fabric/src/main/java/at/petrak/hexcasting/fabric/FabricHexConfig.java index 16824022..2f207026 100644 --- a/Fabric/src/main/java/at/petrak/hexcasting/fabric/FabricHexConfig.java +++ b/Fabric/src/main/java/at/petrak/hexcasting/fabric/FabricHexConfig.java @@ -19,6 +19,7 @@ import net.minecraft.world.level.Level; import java.util.List; +import static at.petrak.hexcasting.api.mod.HexConfig.anyMatchResLoc; import static at.petrak.hexcasting.api.mod.HexConfig.noneMatch; @Config(name = HexAPI.MOD_ID) @@ -156,6 +157,13 @@ public class FabricHexConfig extends PartitioningSerializer.GlobalData { @ConfigEntry.Gui.Excluded private transient Object2IntMap scrollInjections; + // TODO: hook this up to the config, change Jankery, test, also test scroll injects on fabric + @ConfigEntry.Gui.Tooltip + private List loreInjections = HexLootHandler.DEFAULT_LORE_INJECTS; + @ConfigEntry.Gui.Tooltip + private double loreChance = HexLootHandler.DEFAULT_LORE_CHANCE; + + @Override public void validatePostLoad() throws ValidationException { this.maxRecurseDepth = Math.max(this.maxRecurseDepth, 0); @@ -165,6 +173,8 @@ public class FabricHexConfig extends PartitioningSerializer.GlobalData { for (var mirror : this.scrollInjectionsRaw) { this.scrollInjections.put(mirror.injectee(), mirror.countRange()); } + + this.loreChance = Mth.clamp(this.loreChance, 0.0, 1.0); } @Override @@ -209,6 +219,14 @@ public class FabricHexConfig extends PartitioningSerializer.GlobalData { return this.scrollInjections.getOrDefault(lootTable, -1); } + public boolean shouldInjectLore(ResourceLocation lootTable) { + return anyMatchResLoc(this.loreInjections, lootTable); + } + + public double getLoreChance() { + return loreChance; + } + record ScrollInjectionMirror(ResourceLocation injectee, int countRange) { } } diff --git a/Fabric/src/main/java/at/petrak/hexcasting/fabric/loot/FabricHexLootModJankery.java b/Fabric/src/main/java/at/petrak/hexcasting/fabric/loot/FabricHexLootModJankery.java index 0a14953d..5aadc8df 100644 --- a/Fabric/src/main/java/at/petrak/hexcasting/fabric/loot/FabricHexLootModJankery.java +++ b/Fabric/src/main/java/at/petrak/hexcasting/fabric/loot/FabricHexLootModJankery.java @@ -9,6 +9,8 @@ import net.minecraft.world.level.storage.loot.LootPool; import net.minecraft.world.level.storage.loot.entries.LootItem; import net.minecraft.world.level.storage.loot.entries.LootTableReference; import net.minecraft.world.level.storage.loot.predicates.LootItemCondition; +import net.minecraft.world.level.storage.loot.predicates.LootItemRandomChanceCondition; +import net.minecraft.world.level.storage.loot.providers.number.ConstantValue; import net.minecraft.world.level.storage.loot.providers.number.UniformGenerator; import org.jetbrains.annotations.NotNull; @@ -23,11 +25,15 @@ public class FabricHexLootModJankery { public static void lootLoad(ResourceLocation id, Consumer addPool) { if (id.equals(Blocks.AMETHYST_CLUSTER.getLootTable())) { addPool.accept(makeAmethystInjectPool()); - } else { - int countRange = FabricHexInitializer.CONFIG.server.scrollRangeForLootTable(id); - if (countRange != -1) { - addPool.accept(makeScrollAddPool(countRange)); - } + } + + int countRange = FabricHexInitializer.CONFIG.server.scrollRangeForLootTable(id); + if (countRange != -1) { + addPool.accept(makeScrollAddPool(countRange)); + } + + if (FabricHexInitializer.CONFIG.server.shouldInjectLore(id)) { + addPool.accept(makeLoreAddPool(FabricHexInitializer.CONFIG.server.getLoreChance())); } } @@ -43,4 +49,11 @@ public class FabricHexLootModJankery { .add(LootItem.lootTableItem(HexItems.SCROLL_LARGE)) .apply(() -> new AddPerWorldPatternToScrollFunc(new LootItemCondition[0])); } + + private static LootPool.Builder makeLoreAddPool(double chance) { + return LootPool.lootPool() + .when(LootItemRandomChanceCondition.randomChance((float) chance)) + .setRolls(ConstantValue.exactly(1)) + .add(LootItem.lootTableItem(HexItems.LORE_FRAGMENT)); + } } diff --git a/Forge/src/generated/resources/.cache/d4b3e6634c30118e1127c02b727ea285752e5aac b/Forge/src/generated/resources/.cache/d4b3e6634c30118e1127c02b727ea285752e5aac index a39086ad..cf3ddb09 100644 --- a/Forge/src/generated/resources/.cache/d4b3e6634c30118e1127c02b727ea285752e5aac +++ b/Forge/src/generated/resources/.cache/d4b3e6634c30118e1127c02b727ea285752e5aac @@ -1,6 +1,16 @@ -// 1.19.2 2023-01-22T23:58:04.861380072 Global Loot Modifiers : hexcasting -bdfa7329fd17b9128e2bc03c662682e434d74c29 data/forge/loot_modifiers/global_loot_modifiers.json +// 1.19.2 2023-01-23T14:20:40.916977642 Global Loot Modifiers : hexcasting +fcf77123631746f3ee4e815183c0731c3ec206c9 data/forge/loot_modifiers/global_loot_modifiers.json 28ca895a27221312c2451f26646111a68aadbf6c data/hexcasting/loot_modifiers/amethyst_cluster.json +f98707c91dc8712409833df1e5da245e9b14ebfa data/hexcasting/loot_modifiers/lore/minecraft/chests/abandoned_mineshaft.json +16b4bbb5358f2fcad31a8b796cdc3eef28caaf09 data/hexcasting/loot_modifiers/lore/minecraft/chests/pillager_outpost.json +6d6a9fd35a8f4e94c7ae64bf8c130b40d0d7d0e4 data/hexcasting/loot_modifiers/lore/minecraft/chests/simple_dungeon.json +d1b282c57a8f5d1a37f3b87fbdba408b2a1b1415 data/hexcasting/loot_modifiers/lore/minecraft/chests/stronghold_library.json +85e98d5aafc8f80415acf2a7e88acc09b6e17e45 data/hexcasting/loot_modifiers/lore/minecraft/chests/village/village_desert_house.json +4f23231622d1aa9d69511af2a783838f851888c4 data/hexcasting/loot_modifiers/lore/minecraft/chests/village/village_plains_house.json +1cf8de77951e07da409c5b11016f8ec513910723 data/hexcasting/loot_modifiers/lore/minecraft/chests/village/village_savanna_house.json +e52b9cba9d685a2ca7ea7db629c7c0990f12be26 data/hexcasting/loot_modifiers/lore/minecraft/chests/village/village_snowy_house.json +a59a9c55b02b76c0e3f6a2ee4fa7bcf3ab538595 data/hexcasting/loot_modifiers/lore/minecraft/chests/village/village_taiga_house.json +348688be7af2a3ea62c605428c958e62e449252d data/hexcasting/loot_modifiers/lore/minecraft/chests/woodland_mansion.json a89a9e3113b83c6eb978f101aad42a6b37e7c1d8 data/hexcasting/loot_modifiers/scroll/minecraft/chests/abandoned_mineshaft.json bfac0ff9e84cd974ccfb47edc9dce78476470103 data/hexcasting/loot_modifiers/scroll/minecraft/chests/ancient_city.json 0fcb299789a1b0162ab81a025a06b1aab5eb504b data/hexcasting/loot_modifiers/scroll/minecraft/chests/bastion_other.json diff --git a/Forge/src/generated/resources/data/forge/loot_modifiers/global_loot_modifiers.json b/Forge/src/generated/resources/data/forge/loot_modifiers/global_loot_modifiers.json index 17d2e1ca..978f1f8d 100644 --- a/Forge/src/generated/resources/data/forge/loot_modifiers/global_loot_modifiers.json +++ b/Forge/src/generated/resources/data/forge/loot_modifiers/global_loot_modifiers.json @@ -1,18 +1,28 @@ { "entries": [ - "hexcasting:scroll/minecraft/chests/bastion_other", "hexcasting:scroll/minecraft/chests/nether_bridge", "hexcasting:scroll/minecraft/chests/village/village_cartographer", + "hexcasting:lore/minecraft/chests/village/village_taiga_house", + "hexcasting:scroll/minecraft/chests/shipwreck_map", + "hexcasting:lore/minecraft/chests/village/village_snowy_house", + "hexcasting:scroll/minecraft/chests/abandoned_mineshaft", + "hexcasting:amethyst_cluster", + "hexcasting:lore/minecraft/chests/village/village_plains_house", + "hexcasting:lore/minecraft/chests/stronghold_library", + "hexcasting:scroll/minecraft/chests/bastion_other", + "hexcasting:lore/minecraft/chests/woodland_mansion", + "hexcasting:lore/minecraft/chests/village/village_desert_house", "hexcasting:scroll/minecraft/chests/end_city_treasure", "hexcasting:scroll/minecraft/chests/jungle_temple", "hexcasting:scroll/minecraft/chests/bastion_treasure", + "hexcasting:lore/minecraft/chests/village/village_savanna_house", "hexcasting:scroll/minecraft/chests/pillager_outpost", "hexcasting:scroll/minecraft/chests/desert_pyramid", - "hexcasting:scroll/minecraft/chests/shipwreck_map", - "hexcasting:scroll/minecraft/chests/abandoned_mineshaft", - "hexcasting:amethyst_cluster", + "hexcasting:lore/minecraft/chests/abandoned_mineshaft", + "hexcasting:lore/minecraft/chests/pillager_outpost", "hexcasting:scroll/minecraft/chests/ancient_city", "hexcasting:scroll/minecraft/chests/stronghold_library", + "hexcasting:lore/minecraft/chests/simple_dungeon", "hexcasting:scroll/minecraft/chests/woodland_mansion", "hexcasting:scroll/minecraft/chests/simple_dungeon" ], diff --git a/Forge/src/generated/resources/data/hexcasting/loot_modifiers/lore/minecraft/chests/abandoned_mineshaft.json b/Forge/src/generated/resources/data/hexcasting/loot_modifiers/lore/minecraft/chests/abandoned_mineshaft.json new file mode 100644 index 00000000..7f0b321f --- /dev/null +++ b/Forge/src/generated/resources/data/hexcasting/loot_modifiers/lore/minecraft/chests/abandoned_mineshaft.json @@ -0,0 +1,10 @@ +{ + "type": "hexcasting:inject_lore", + "chance": 0.4, + "conditions": [ + { + "condition": "forge:loot_table_id", + "loot_table_id": "minecraft:chests/abandoned_mineshaft" + } + ] +} \ No newline at end of file diff --git a/Forge/src/generated/resources/data/hexcasting/loot_modifiers/lore/minecraft/chests/pillager_outpost.json b/Forge/src/generated/resources/data/hexcasting/loot_modifiers/lore/minecraft/chests/pillager_outpost.json new file mode 100644 index 00000000..a530f7c5 --- /dev/null +++ b/Forge/src/generated/resources/data/hexcasting/loot_modifiers/lore/minecraft/chests/pillager_outpost.json @@ -0,0 +1,10 @@ +{ + "type": "hexcasting:inject_lore", + "chance": 0.4, + "conditions": [ + { + "condition": "forge:loot_table_id", + "loot_table_id": "minecraft:chests/pillager_outpost" + } + ] +} \ No newline at end of file diff --git a/Forge/src/generated/resources/data/hexcasting/loot_modifiers/lore/minecraft/chests/simple_dungeon.json b/Forge/src/generated/resources/data/hexcasting/loot_modifiers/lore/minecraft/chests/simple_dungeon.json new file mode 100644 index 00000000..43b7514f --- /dev/null +++ b/Forge/src/generated/resources/data/hexcasting/loot_modifiers/lore/minecraft/chests/simple_dungeon.json @@ -0,0 +1,10 @@ +{ + "type": "hexcasting:inject_lore", + "chance": 0.4, + "conditions": [ + { + "condition": "forge:loot_table_id", + "loot_table_id": "minecraft:chests/simple_dungeon" + } + ] +} \ No newline at end of file diff --git a/Forge/src/generated/resources/data/hexcasting/loot_modifiers/lore/minecraft/chests/stronghold_library.json b/Forge/src/generated/resources/data/hexcasting/loot_modifiers/lore/minecraft/chests/stronghold_library.json new file mode 100644 index 00000000..30166b92 --- /dev/null +++ b/Forge/src/generated/resources/data/hexcasting/loot_modifiers/lore/minecraft/chests/stronghold_library.json @@ -0,0 +1,10 @@ +{ + "type": "hexcasting:inject_lore", + "chance": 0.4, + "conditions": [ + { + "condition": "forge:loot_table_id", + "loot_table_id": "minecraft:chests/stronghold_library" + } + ] +} \ No newline at end of file diff --git a/Forge/src/generated/resources/data/hexcasting/loot_modifiers/lore/minecraft/chests/village/village_desert_house.json b/Forge/src/generated/resources/data/hexcasting/loot_modifiers/lore/minecraft/chests/village/village_desert_house.json new file mode 100644 index 00000000..4e522bf6 --- /dev/null +++ b/Forge/src/generated/resources/data/hexcasting/loot_modifiers/lore/minecraft/chests/village/village_desert_house.json @@ -0,0 +1,10 @@ +{ + "type": "hexcasting:inject_lore", + "chance": 0.4, + "conditions": [ + { + "condition": "forge:loot_table_id", + "loot_table_id": "minecraft:chests/village/village_desert_house" + } + ] +} \ No newline at end of file diff --git a/Forge/src/generated/resources/data/hexcasting/loot_modifiers/lore/minecraft/chests/village/village_plains_house.json b/Forge/src/generated/resources/data/hexcasting/loot_modifiers/lore/minecraft/chests/village/village_plains_house.json new file mode 100644 index 00000000..f6c23445 --- /dev/null +++ b/Forge/src/generated/resources/data/hexcasting/loot_modifiers/lore/minecraft/chests/village/village_plains_house.json @@ -0,0 +1,10 @@ +{ + "type": "hexcasting:inject_lore", + "chance": 0.4, + "conditions": [ + { + "condition": "forge:loot_table_id", + "loot_table_id": "minecraft:chests/village/village_plains_house" + } + ] +} \ No newline at end of file diff --git a/Forge/src/generated/resources/data/hexcasting/loot_modifiers/lore/minecraft/chests/village/village_savanna_house.json b/Forge/src/generated/resources/data/hexcasting/loot_modifiers/lore/minecraft/chests/village/village_savanna_house.json new file mode 100644 index 00000000..db64af9f --- /dev/null +++ b/Forge/src/generated/resources/data/hexcasting/loot_modifiers/lore/minecraft/chests/village/village_savanna_house.json @@ -0,0 +1,10 @@ +{ + "type": "hexcasting:inject_lore", + "chance": 0.4, + "conditions": [ + { + "condition": "forge:loot_table_id", + "loot_table_id": "minecraft:chests/village/village_savanna_house" + } + ] +} \ No newline at end of file diff --git a/Forge/src/generated/resources/data/hexcasting/loot_modifiers/lore/minecraft/chests/village/village_snowy_house.json b/Forge/src/generated/resources/data/hexcasting/loot_modifiers/lore/minecraft/chests/village/village_snowy_house.json new file mode 100644 index 00000000..331b30dd --- /dev/null +++ b/Forge/src/generated/resources/data/hexcasting/loot_modifiers/lore/minecraft/chests/village/village_snowy_house.json @@ -0,0 +1,10 @@ +{ + "type": "hexcasting:inject_lore", + "chance": 0.4, + "conditions": [ + { + "condition": "forge:loot_table_id", + "loot_table_id": "minecraft:chests/village/village_snowy_house" + } + ] +} \ No newline at end of file diff --git a/Forge/src/generated/resources/data/hexcasting/loot_modifiers/lore/minecraft/chests/village/village_taiga_house.json b/Forge/src/generated/resources/data/hexcasting/loot_modifiers/lore/minecraft/chests/village/village_taiga_house.json new file mode 100644 index 00000000..5111cc73 --- /dev/null +++ b/Forge/src/generated/resources/data/hexcasting/loot_modifiers/lore/minecraft/chests/village/village_taiga_house.json @@ -0,0 +1,10 @@ +{ + "type": "hexcasting:inject_lore", + "chance": 0.4, + "conditions": [ + { + "condition": "forge:loot_table_id", + "loot_table_id": "minecraft:chests/village/village_taiga_house" + } + ] +} \ No newline at end of file diff --git a/Forge/src/generated/resources/data/hexcasting/loot_modifiers/lore/minecraft/chests/woodland_mansion.json b/Forge/src/generated/resources/data/hexcasting/loot_modifiers/lore/minecraft/chests/woodland_mansion.json new file mode 100644 index 00000000..60d574a0 --- /dev/null +++ b/Forge/src/generated/resources/data/hexcasting/loot_modifiers/lore/minecraft/chests/woodland_mansion.json @@ -0,0 +1,10 @@ +{ + "type": "hexcasting:inject_lore", + "chance": 0.4, + "conditions": [ + { + "condition": "forge:loot_table_id", + "loot_table_id": "minecraft:chests/woodland_mansion" + } + ] +} \ No newline at end of file diff --git a/Forge/src/main/java/at/petrak/hexcasting/forge/datagen/ForgeHexLootModGen.java b/Forge/src/main/java/at/petrak/hexcasting/forge/datagen/ForgeHexLootModGen.java index eee39bf4..48976f15 100644 --- a/Forge/src/main/java/at/petrak/hexcasting/forge/datagen/ForgeHexLootModGen.java +++ b/Forge/src/main/java/at/petrak/hexcasting/forge/datagen/ForgeHexLootModGen.java @@ -3,6 +3,7 @@ package at.petrak.hexcasting.forge.datagen; import at.petrak.hexcasting.api.HexAPI; import at.petrak.hexcasting.common.loot.HexLootHandler; import at.petrak.hexcasting.forge.loot.ForgeHexAmethystLootMod; +import at.petrak.hexcasting.forge.loot.ForgeHexLoreLootMod; import at.petrak.hexcasting.forge.loot.ForgeHexScrollLootMod; import net.minecraft.data.DataGenerator; import net.minecraft.world.level.block.Blocks; @@ -24,8 +25,16 @@ public class ForgeHexLootModGen extends GlobalLootModifierProvider { }, injection.countRange())); } + for (var injection : HexLootHandler.DEFAULT_LORE_INJECTS) { + var name = "lore/%s/%s".formatted(injection.getNamespace(), injection.getPath()); + add(name, new ForgeHexLoreLootMod(new LootItemCondition[]{ + LootTableIdCondition.builder(injection).build(), + }, HexLootHandler.DEFAULT_LORE_CHANCE)); + } + add("amethyst_cluster", new ForgeHexAmethystLootMod(new LootItemCondition[]{ LootTableIdCondition.builder(Blocks.AMETHYST_CLUSTER.getLootTable()).build() }, HexLootHandler.DEFAULT_SHARD_MODIFICATION)); + } } diff --git a/Forge/src/main/java/at/petrak/hexcasting/forge/lib/ForgeHexLootMods.java b/Forge/src/main/java/at/petrak/hexcasting/forge/lib/ForgeHexLootMods.java index 87a8f71a..a967358d 100644 --- a/Forge/src/main/java/at/petrak/hexcasting/forge/lib/ForgeHexLootMods.java +++ b/Forge/src/main/java/at/petrak/hexcasting/forge/lib/ForgeHexLootMods.java @@ -2,6 +2,7 @@ package at.petrak.hexcasting.forge.lib; import at.petrak.hexcasting.api.HexAPI; import at.petrak.hexcasting.forge.loot.ForgeHexAmethystLootMod; +import at.petrak.hexcasting.forge.loot.ForgeHexLoreLootMod; import at.petrak.hexcasting.forge.loot.ForgeHexScrollLootMod; import com.mojang.serialization.Codec; import net.minecraftforge.common.loot.IGlobalLootModifier; @@ -15,6 +16,8 @@ public class ForgeHexLootMods { public static final RegistryObject> INJECT_SCROLLS = REGISTRY.register( "inject_scrolls", ForgeHexScrollLootMod.CODEC); + public static final RegistryObject> INJECT_LORE = REGISTRY.register( + "inject_lore", ForgeHexLoreLootMod.CODEC); public static final RegistryObject> AMETHYST = REGISTRY.register( "amethyst_cluster", ForgeHexAmethystLootMod.CODEC); } diff --git a/Forge/src/main/java/at/petrak/hexcasting/forge/loot/ForgeHexLoreLootMod.java b/Forge/src/main/java/at/petrak/hexcasting/forge/loot/ForgeHexLoreLootMod.java new file mode 100644 index 00000000..e5de13a2 --- /dev/null +++ b/Forge/src/main/java/at/petrak/hexcasting/forge/loot/ForgeHexLoreLootMod.java @@ -0,0 +1,45 @@ +package at.petrak.hexcasting.forge.loot; + +import at.petrak.hexcasting.common.lib.HexItems; +import at.petrak.hexcasting.forge.lib.ForgeHexLootMods; +import com.google.common.base.Suppliers; +import com.mojang.serialization.Codec; +import com.mojang.serialization.codecs.RecordCodecBuilder; +import it.unimi.dsi.fastutil.objects.ObjectArrayList; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.level.storage.loot.LootContext; +import net.minecraft.world.level.storage.loot.predicates.LootItemCondition; +import net.minecraftforge.common.loot.LootModifier; +import org.jetbrains.annotations.NotNull; + +import java.util.function.Supplier; + +public class ForgeHexLoreLootMod extends LootModifier { + public static final Supplier> CODEC = + Suppliers.memoize(() -> RecordCodecBuilder.create( + inst -> codecStart(inst).and( + Codec.DOUBLE.fieldOf("chance").forGetter(it -> it.chance) + ).apply(inst, ForgeHexLoreLootMod::new) + )); + + public final double chance; + + public ForgeHexLoreLootMod(LootItemCondition[] conditionsIn, double chance) { + super(conditionsIn); + this.chance = chance; + } + + @Override + protected @NotNull ObjectArrayList doApply(ObjectArrayList generatedLoot, + LootContext context) { + if (context.getRandom().nextDouble() < this.chance) { + generatedLoot.add(new ItemStack(HexItems.LORE_FRAGMENT)); + } + return generatedLoot; + } + + @Override + public Codec codec() { + return ForgeHexLootMods.INJECT_LORE.get(); + } +} From d1640d956a762332b13d1791724e416f6394cc17 Mon Sep 17 00:00:00 2001 From: "petrak@" Date: Mon, 30 Jan 2023 13:36:52 -0600 Subject: [PATCH 64/95] close #370 --- .../java/at/petrak/hexcasting/api/HexAPI.java | 24 ++++++++++++++++ .../casting/operators/OpEntityVelocity.kt | 13 +++------ .../hexcasting/common/impl/HexAPIImpl.java | 24 ++++++++++++++++ .../common/misc/VelocityFudging.java | 28 +++++++++++++++++++ .../mixin/accessor/AccessorAbstractArrow.java | 11 ++++++++ Common/src/main/resources/hexplat.mixins.json | 1 + .../hexcasting/fabric/FabricHexInitializer.kt | 2 ++ .../hexcasting/forge/ForgeHexInitializer.java | 3 ++ 8 files changed, 97 insertions(+), 9 deletions(-) create mode 100644 Common/src/main/java/at/petrak/hexcasting/common/misc/VelocityFudging.java create mode 100644 Common/src/main/java/at/petrak/hexcasting/mixin/accessor/AccessorAbstractArrow.java diff --git a/Common/src/main/java/at/petrak/hexcasting/api/HexAPI.java b/Common/src/main/java/at/petrak/hexcasting/api/HexAPI.java index 9a4884fc..0d277a3a 100644 --- a/Common/src/main/java/at/petrak/hexcasting/api/HexAPI.java +++ b/Common/src/main/java/at/petrak/hexcasting/api/HexAPI.java @@ -7,6 +7,9 @@ import net.minecraft.ChatFormatting; import net.minecraft.network.chat.Component; import net.minecraft.resources.ResourceKey; import net.minecraft.resources.ResourceLocation; +import net.minecraft.world.entity.Entity; +import net.minecraft.world.entity.EntityType; +import net.minecraft.world.phys.Vec3; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; @@ -63,6 +66,27 @@ public interface HexAPI { return Component.translatable(getRawHookI18nKey(name)).withStyle(ChatFormatting.LIGHT_PURPLE); } + /** + * Register an entity with the given ID to have its velocity as perceived by OpEntityVelocity be different + * than it's "normal" velocity + */ + // Should be OK to use the type directly as the key as they're singleton identity objects + default void registerSpecialVelocityGetter(EntityType key, EntityVelocityGetter getter) { + } + + /** + * If the entity has had a special getter registered with {@link HexAPI#registerSpecialVelocityGetter} then + * return that, otherwise return its normal delta movement + */ + default Vec3 getEntityVelocitySpecial(Entity entity) { + return entity.getDeltaMovement(); + } + + @FunctionalInterface + interface EntityVelocityGetter { + Vec3 getVelocity(T entity); + } + static HexAPI instance() { return INSTANCE.get(); } diff --git a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/OpEntityVelocity.kt b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/OpEntityVelocity.kt index 5430e154..c5152d4e 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/OpEntityVelocity.kt +++ b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/OpEntityVelocity.kt @@ -1,12 +1,11 @@ package at.petrak.hexcasting.common.casting.operators -import at.petrak.hexcasting.api.casting.castables.ConstMediaAction +import at.petrak.hexcasting.api.HexAPI import at.petrak.hexcasting.api.casting.asActionResult +import at.petrak.hexcasting.api.casting.castables.ConstMediaAction import at.petrak.hexcasting.api.casting.eval.CastingEnvironment import at.petrak.hexcasting.api.casting.getEntity import at.petrak.hexcasting.api.casting.iota.Iota -import at.petrak.hexcasting.common.misc.PlayerPositionRecorder -import net.minecraft.server.level.ServerPlayer object OpEntityVelocity : ConstMediaAction { override val argc = 1 @@ -15,11 +14,7 @@ object OpEntityVelocity : ConstMediaAction { val e = args.getEntity(0, argc) ctx.assertEntityInRange(e) - // Player velocity is jank. Really jank. This is the best we can do. - if (e is ServerPlayer) { - return PlayerPositionRecorder.getMotion(e).asActionResult - } - - return e.deltaMovement.asActionResult + val vel = HexAPI.instance().getEntityVelocitySpecial(e) + return vel.asActionResult } } diff --git a/Common/src/main/java/at/petrak/hexcasting/common/impl/HexAPIImpl.java b/Common/src/main/java/at/petrak/hexcasting/common/impl/HexAPIImpl.java index 4e60c933..35a627d9 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/impl/HexAPIImpl.java +++ b/Common/src/main/java/at/petrak/hexcasting/common/impl/HexAPIImpl.java @@ -1,6 +1,30 @@ package at.petrak.hexcasting.common.impl; import at.petrak.hexcasting.api.HexAPI; +import net.minecraft.world.entity.Entity; +import net.minecraft.world.entity.EntityType; +import net.minecraft.world.phys.Vec3; + +import java.util.concurrent.ConcurrentHashMap; +import java.util.concurrent.ConcurrentMap; public class HexAPIImpl implements HexAPI { + private static final ConcurrentMap, EntityVelocityGetter> SPECIAL_VELOCITIES + = new ConcurrentHashMap<>(); + + public void registerSpecialVelocityGetter(EntityType key, + EntityVelocityGetter getter) { + SPECIAL_VELOCITIES.put(key, getter); + } + + @Override + public Vec3 getEntityVelocitySpecial(Entity entity) { + EntityType type = entity.getType(); + if (SPECIAL_VELOCITIES.containsKey(type)) { + var velGetter = SPECIAL_VELOCITIES.get(type); + var erasedGetter = (EntityVelocityGetter) velGetter; + return erasedGetter.getVelocity(entity); + } + return entity.getDeltaMovement(); + } } diff --git a/Common/src/main/java/at/petrak/hexcasting/common/misc/VelocityFudging.java b/Common/src/main/java/at/petrak/hexcasting/common/misc/VelocityFudging.java new file mode 100644 index 00000000..5a3fd722 --- /dev/null +++ b/Common/src/main/java/at/petrak/hexcasting/common/misc/VelocityFudging.java @@ -0,0 +1,28 @@ +package at.petrak.hexcasting.common.misc; + +import at.petrak.hexcasting.api.HexAPI; +import at.petrak.hexcasting.mixin.accessor.AccessorAbstractArrow; +import net.minecraft.server.level.ServerPlayer; +import net.minecraft.world.entity.EntityType; +import net.minecraft.world.phys.Vec3; + +public class VelocityFudging { + public static void register() { + HexAPI.instance().registerSpecialVelocityGetter(EntityType.PLAYER, player -> { + if (player instanceof ServerPlayer splayer) { + return PlayerPositionRecorder.getMotion(splayer); + } else { + // bruh + throw new IllegalStateException("Call this only on the server side, silly"); + } + }); + + HexAPI.instance().registerSpecialVelocityGetter(EntityType.ARROW, arrow -> { + if (((AccessorAbstractArrow) arrow).hex$isInGround()) { + return Vec3.ZERO; + } else { + return arrow.getDeltaMovement(); + } + }); + } +} diff --git a/Common/src/main/java/at/petrak/hexcasting/mixin/accessor/AccessorAbstractArrow.java b/Common/src/main/java/at/petrak/hexcasting/mixin/accessor/AccessorAbstractArrow.java new file mode 100644 index 00000000..b956033d --- /dev/null +++ b/Common/src/main/java/at/petrak/hexcasting/mixin/accessor/AccessorAbstractArrow.java @@ -0,0 +1,11 @@ +package at.petrak.hexcasting.mixin.accessor; + +import net.minecraft.world.entity.projectile.AbstractArrow; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.gen.Accessor; + +@Mixin(AbstractArrow.class) +public interface AccessorAbstractArrow { + @Accessor("inGround") + boolean hex$isInGround(); +} diff --git a/Common/src/main/resources/hexplat.mixins.json b/Common/src/main/resources/hexplat.mixins.json index c10df093..24fa76d1 100644 --- a/Common/src/main/resources/hexplat.mixins.json +++ b/Common/src/main/resources/hexplat.mixins.json @@ -10,6 +10,7 @@ "MixinRaider", "MixinVillager", "MixinWitch", + "accessor.AccessorAbstractArrow", "accessor.AccessorEntity", "accessor.AccessorLivingEntity", "accessor.AccessorLootTable", diff --git a/Fabric/src/main/java/at/petrak/hexcasting/fabric/FabricHexInitializer.kt b/Fabric/src/main/java/at/petrak/hexcasting/fabric/FabricHexInitializer.kt index 0fbb07d9..4c93ca41 100644 --- a/Fabric/src/main/java/at/petrak/hexcasting/fabric/FabricHexInitializer.kt +++ b/Fabric/src/main/java/at/petrak/hexcasting/fabric/FabricHexInitializer.kt @@ -22,6 +22,7 @@ import at.petrak.hexcasting.common.lib.hex.HexSpecialHandlers import at.petrak.hexcasting.common.misc.AkashicTreeGrower import at.petrak.hexcasting.common.misc.BrainsweepingEvents import at.petrak.hexcasting.common.misc.PlayerPositionRecorder +import at.petrak.hexcasting.common.misc.VelocityFudging import at.petrak.hexcasting.common.recipe.HexRecipeStuffRegistry import at.petrak.hexcasting.fabric.event.VillagerConversionCallback import at.petrak.hexcasting.fabric.interop.gravity.GravityApiInterop @@ -71,6 +72,7 @@ object FabricHexInitializer : ModInitializer { FabricImpetusStorage.registerStorage() HexInterop.init() + VelocityFudging.register() } fun initListeners() { diff --git a/Forge/src/main/java/at/petrak/hexcasting/forge/ForgeHexInitializer.java b/Forge/src/main/java/at/petrak/hexcasting/forge/ForgeHexInitializer.java index 2a6bf4e8..643f63c8 100644 --- a/Forge/src/main/java/at/petrak/hexcasting/forge/ForgeHexInitializer.java +++ b/Forge/src/main/java/at/petrak/hexcasting/forge/ForgeHexInitializer.java @@ -19,6 +19,7 @@ import at.petrak.hexcasting.common.lib.hex.HexSpecialHandlers; import at.petrak.hexcasting.common.misc.AkashicTreeGrower; import at.petrak.hexcasting.common.misc.BrainsweepingEvents; import at.petrak.hexcasting.common.misc.PlayerPositionRecorder; +import at.petrak.hexcasting.common.misc.VelocityFudging; import at.petrak.hexcasting.common.recipe.HexRecipeStuffRegistry; import at.petrak.hexcasting.forge.cap.CapSyncers; import at.petrak.hexcasting.forge.cap.ForgeCapabilityHandler; @@ -114,6 +115,8 @@ public class ForgeHexInitializer { ForgeHexLootMods.REGISTRY.register(getModEventBus()); HexAdvancementTriggers.registerTriggers(); + + VelocityFudging.register(); } // https://github.com/VazkiiMods/Botania/blob/1.18.x/Forge/src/main/java/vazkii/botania/forge/ForgeCommonInitializer.java From 42c1dc0e6110050c481d24b064a8f644f7ebc230 Mon Sep 17 00:00:00 2001 From: "petrak@" Date: Mon, 30 Jan 2023 13:49:27 -0600 Subject: [PATCH 65/95] arrow vel fix also works for spectral arrows --- .../common/misc/VelocityFudging.java | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/Common/src/main/java/at/petrak/hexcasting/common/misc/VelocityFudging.java b/Common/src/main/java/at/petrak/hexcasting/common/misc/VelocityFudging.java index 5a3fd722..0afa1c67 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/misc/VelocityFudging.java +++ b/Common/src/main/java/at/petrak/hexcasting/common/misc/VelocityFudging.java @@ -4,6 +4,7 @@ import at.petrak.hexcasting.api.HexAPI; import at.petrak.hexcasting.mixin.accessor.AccessorAbstractArrow; import net.minecraft.server.level.ServerPlayer; import net.minecraft.world.entity.EntityType; +import net.minecraft.world.entity.projectile.AbstractArrow; import net.minecraft.world.phys.Vec3; public class VelocityFudging { @@ -17,12 +18,15 @@ public class VelocityFudging { } }); - HexAPI.instance().registerSpecialVelocityGetter(EntityType.ARROW, arrow -> { - if (((AccessorAbstractArrow) arrow).hex$isInGround()) { - return Vec3.ZERO; - } else { - return arrow.getDeltaMovement(); - } - }); + HexAPI.instance().registerSpecialVelocityGetter(EntityType.ARROW, VelocityFudging::arrowVelocitizer); + HexAPI.instance().registerSpecialVelocityGetter(EntityType.SPECTRAL_ARROW, VelocityFudging::arrowVelocitizer); + } + + private static Vec3 arrowVelocitizer(AbstractArrow arrow) { + if (((AccessorAbstractArrow) arrow).hex$isInGround()) { + return Vec3.ZERO; + } else { + return arrow.getDeltaMovement(); + } } } From ca36dfa484e8b2f3527ab69721012227939a4e73 Mon Sep 17 00:00:00 2001 From: "petrak@" Date: Mon, 30 Jan 2023 13:53:36 -0600 Subject: [PATCH 66/95] corporate needs you to tell the difference between [an arrow] and [a trident] --- .../java/at/petrak/hexcasting/common/misc/VelocityFudging.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Common/src/main/java/at/petrak/hexcasting/common/misc/VelocityFudging.java b/Common/src/main/java/at/petrak/hexcasting/common/misc/VelocityFudging.java index 0afa1c67..084681c8 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/misc/VelocityFudging.java +++ b/Common/src/main/java/at/petrak/hexcasting/common/misc/VelocityFudging.java @@ -20,6 +20,8 @@ public class VelocityFudging { HexAPI.instance().registerSpecialVelocityGetter(EntityType.ARROW, VelocityFudging::arrowVelocitizer); HexAPI.instance().registerSpecialVelocityGetter(EntityType.SPECTRAL_ARROW, VelocityFudging::arrowVelocitizer); + // this is an arrow apparently + HexAPI.instance().registerSpecialVelocityGetter(EntityType.TRIDENT, VelocityFudging::arrowVelocitizer); } private static Vec3 arrowVelocitizer(AbstractArrow arrow) { From f6cf4af59b72ff741b41137d893e7743d0f46230 Mon Sep 17 00:00:00 2001 From: "petrak@" Date: Tue, 31 Jan 2023 18:51:05 -0600 Subject: [PATCH 67/95] telepig works now, close #402 --- .../operators/spells/great/OpTeleport.kt | 29 ++++++++++--------- .../tags/entity_types/sticky_teleporters.json | 16 ---------- 2 files changed, 16 insertions(+), 29 deletions(-) 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 dcaad7e3..8d32ff2c 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,8 +1,11 @@ package at.petrak.hexcasting.common.casting.operators.spells.great -import at.petrak.hexcasting.api.casting.* +import at.petrak.hexcasting.api.casting.ParticleSpray +import at.petrak.hexcasting.api.casting.RenderedSpell import at.petrak.hexcasting.api.casting.castables.SpellAction import at.petrak.hexcasting.api.casting.eval.CastingEnvironment +import at.petrak.hexcasting.api.casting.getEntity +import at.petrak.hexcasting.api.casting.getVec3 import at.petrak.hexcasting.api.casting.iota.Iota import at.petrak.hexcasting.api.casting.mishaps.MishapImmuneEntity import at.petrak.hexcasting.api.casting.mishaps.MishapLocationTooFarAway @@ -102,25 +105,25 @@ object OpTeleport : SpellAction { return } - val base = teleportee.rootVehicle - val target = base.position().add(delta) - val playersToUpdate = mutableListOf() - val indirect = base.indirectPassengers + val target = teleportee.position().add(delta) - val sticky = indirect.any { it.type.`is`(HexTags.Entities.STICKY_TELEPORTERS) } - val cannotSticky = indirect.none { it.type.`is`(HexTags.Entities.CANNOT_TELEPORT) } - if (sticky && cannotSticky) + val cannotTeleport = teleportee.passengers.any { it.type.`is`(HexTags.Entities.CANNOT_TELEPORT) } + if (cannotTeleport) return + // A "sticky" entity teleports itself and its riders + val sticky = teleportee.type.`is`(HexTags.Entities.STICKY_TELEPORTERS) + + // TODO: this probably does funky things with stacks of passengers. I doubt this will come up in practice + // though if (sticky) { + teleportee.stopRiding() + teleportee.indirectPassengers.filterIsInstance().forEach(playersToUpdate::add) // this handles teleporting the passengers - base.teleportTo(target.x, target.y, target.z) - indirect - .filterIsInstance() - .forEach(playersToUpdate::add) + teleportee.teleportTo(target.x, target.y, target.z) } else { - // Break it into two stacks + // Snap everyone off the stacks teleportee.stopRiding() teleportee.passengers.forEach(Entity::stopRiding) if (teleportee is ServerPlayer) { diff --git a/Common/src/main/resources/data/hexcasting/tags/entity_types/sticky_teleporters.json b/Common/src/main/resources/data/hexcasting/tags/entity_types/sticky_teleporters.json index cb61bbd5..4f5ca150 100644 --- a/Common/src/main/resources/data/hexcasting/tags/entity_types/sticky_teleporters.json +++ b/Common/src/main/resources/data/hexcasting/tags/entity_types/sticky_teleporters.json @@ -1,22 +1,6 @@ { "replace": false, "values": [ - { - "id": "create:contraption", - "required": false - }, - { - "id": "create:stationary_contraption", - "required": false - }, - { - "id": "create:gantry_contraption", - "required": false - }, - { - "id": "create:carriage_contraption", - "required": false - }, "minecraft:pig", "minecraft:strider", "minecraft:horse", From cf79af662bfc412abda895717b42583731b50a81 Mon Sep 17 00:00:00 2001 From: "petrak@" Date: Tue, 31 Jan 2023 18:56:48 -0600 Subject: [PATCH 68/95] fix #400 --- .../java/at/petrak/hexcasting/api/mod/HexConfig.java | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/Common/src/main/java/at/petrak/hexcasting/api/mod/HexConfig.java b/Common/src/main/java/at/petrak/hexcasting/api/mod/HexConfig.java index f0a5ba34..abfb66d4 100644 --- a/Common/src/main/java/at/petrak/hexcasting/api/mod/HexConfig.java +++ b/Common/src/main/java/at/petrak/hexcasting/api/mod/HexConfig.java @@ -81,11 +81,19 @@ public class HexConfig { // Simple extensions for resource location configs public static boolean anyMatch(List keys, ResourceLocation key) { - return keys.stream().map(ResourceLocation::new).anyMatch(key::equals); + for (String s : keys) { + if (ResourceLocation.isValidResourceLocation(s)) { + var rl = new ResourceLocation(s); + if (rl.equals(key)) { + return true; + } + } + } + return false; } public static boolean noneMatch(List keys, ResourceLocation key) { - return keys.stream().map(ResourceLocation::new).noneMatch(key::equals); + return !anyMatch(keys, key); } public static boolean anyMatchResLoc(List keys, ResourceLocation key) { From 4f5cbb12fcafde2f06f3138d0b8f2359709ffda4 Mon Sep 17 00:00:00 2001 From: "petrak@" Date: Tue, 31 Jan 2023 19:04:15 -0600 Subject: [PATCH 69/95] fix #364 (good catch) --- .../petrak/hexcasting/datagen/tag/HexBlockTagProvider.java | 6 +++++- .../.cache/03e4de26f1265135874f8cdcaebc09d9c08eb42b | 2 +- .../.cache/67cce32b1c3cbbcb1f646605f4914e3f196986c2 | 2 +- .../.cache/75bcd4dba6ca7d365462b0ec45e291d1056349c4 | 6 ++++-- .../.cache/844611d4af49e23072b8a888c8e73c6c5d8c0768 | 2 +- .../.cache/9fb1092f32d4fcbf9e061ffd718d4ec689c6c95e | 2 +- .../resources/data/minecraft/tags/blocks/mineable/axe.json | 3 ++- .../resources/data/minecraft/tags/blocks/stairs.json | 6 ++++++ .../resources/data/minecraft/tags/blocks/wooden_stairs.json | 6 ++++++ .../.cache/75bcd4dba6ca7d365462b0ec45e291d1056349c4 | 6 ++++-- .../resources/data/minecraft/tags/blocks/mineable/axe.json | 3 ++- .../resources/data/minecraft/tags/blocks/stairs.json | 5 +++++ .../resources/data/minecraft/tags/blocks/wooden_stairs.json | 5 +++++ 13 files changed, 43 insertions(+), 11 deletions(-) create mode 100644 Fabric/src/generated/resources/data/minecraft/tags/blocks/stairs.json create mode 100644 Fabric/src/generated/resources/data/minecraft/tags/blocks/wooden_stairs.json create mode 100644 Forge/src/generated/resources/data/minecraft/tags/blocks/stairs.json create mode 100644 Forge/src/generated/resources/data/minecraft/tags/blocks/wooden_stairs.json diff --git a/Common/src/main/java/at/petrak/hexcasting/datagen/tag/HexBlockTagProvider.java b/Common/src/main/java/at/petrak/hexcasting/datagen/tag/HexBlockTagProvider.java index 0894f1cd..73363708 100644 --- a/Common/src/main/java/at/petrak/hexcasting/datagen/tag/HexBlockTagProvider.java +++ b/Common/src/main/java/at/petrak/hexcasting/datagen/tag/HexBlockTagProvider.java @@ -33,7 +33,7 @@ public class HexBlockTagProvider extends PaucalBlockTagProvider { HexBlocks.EDIFIED_WOOD, HexBlocks.STRIPPED_EDIFIED_WOOD, HexBlocks.EDIFIED_PLANKS, HexBlocks.EDIFIED_PANEL, HexBlocks.EDIFIED_TILE, HexBlocks.EDIFIED_DOOR, HexBlocks.EDIFIED_TRAPDOOR, HexBlocks.EDIFIED_SLAB, - HexBlocks.EDIFIED_BUTTON); + HexBlocks.EDIFIED_BUTTON, HexBlocks.EDIFIED_STAIRS); tag(BlockTags.MINEABLE_WITH_HOE) .add(HexBlocks.AMETHYST_EDIFIED_LEAVES, HexBlocks.AVENTURINE_EDIFIED_LEAVES, @@ -64,6 +64,10 @@ public class HexBlockTagProvider extends PaucalBlockTagProvider { .add(HexBlocks.EDIFIED_SLAB); tag(BlockTags.WOODEN_SLABS) .add(HexBlocks.EDIFIED_SLAB); + tag(BlockTags.STAIRS) + .add(HexBlocks.EDIFIED_STAIRS); + tag(BlockTags.WOODEN_STAIRS) + .add(HexBlocks.EDIFIED_STAIRS); tag(BlockTags.DOORS) .add(HexBlocks.EDIFIED_DOOR); tag(BlockTags.WOODEN_DOORS) diff --git a/Fabric/src/generated/resources/.cache/03e4de26f1265135874f8cdcaebc09d9c08eb42b b/Fabric/src/generated/resources/.cache/03e4de26f1265135874f8cdcaebc09d9c08eb42b index 0b9b893d..6c4f4c97 100644 --- a/Fabric/src/generated/resources/.cache/03e4de26f1265135874f8cdcaebc09d9c08eb42b +++ b/Fabric/src/generated/resources/.cache/03e4de26f1265135874f8cdcaebc09d9c08eb42b @@ -1,4 +1,4 @@ -// 1.19.2 2023-01-23T14:22:44.2568588 Tags for minecraft:item +// 1.19.2 2023-01-31T19:01:22.797440382 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 ff915e4f..d9b94060 100644 --- a/Fabric/src/generated/resources/.cache/67cce32b1c3cbbcb1f646605f4914e3f196986c2 +++ b/Fabric/src/generated/resources/.cache/67cce32b1c3cbbcb1f646605f4914e3f196986c2 @@ -1,4 +1,4 @@ -// 1.19.2 2023-01-23T14:22:44.219077975 LootTables +// 1.19.2 2023-01-31T19:01:22.799226001 LootTables dec1d3592e82f99d9e059d9c771530f103b2bda5 data/hexcasting/loot_tables/blocks/empty_directrix.json 2c42fc5d8c74c98ad15b8bd50f56541fccbef750 data/hexcasting/loot_tables/blocks/edified_tile.json cfb39e2151725fe4f9a7269d9b5de8031ea54a44 data/hexcasting/loot_tables/blocks/directrix_redstone.json diff --git a/Fabric/src/generated/resources/.cache/75bcd4dba6ca7d365462b0ec45e291d1056349c4 b/Fabric/src/generated/resources/.cache/75bcd4dba6ca7d365462b0ec45e291d1056349c4 index 9c3bfdaf..50c7e562 100644 --- a/Fabric/src/generated/resources/.cache/75bcd4dba6ca7d365462b0ec45e291d1056349c4 +++ b/Fabric/src/generated/resources/.cache/75bcd4dba6ca7d365462b0ec45e291d1056349c4 @@ -1,10 +1,10 @@ -// 1.19.2 2023-01-23T14:22:44.257772029 Tags for minecraft:block +// 1.19.2 2023-01-31T19:01:22.794241549 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 20183cd61968ff6548df2dde1100b6378d68d64b data/minecraft/tags/blocks/buttons.json 5853312830fdd8ee85e2c5b1be3dd4a6357a4971 data/minecraft/tags/blocks/mineable/pickaxe.json -f38c2a2a896388b3b87f53887609b417930abdf7 data/minecraft/tags/blocks/mineable/axe.json +d5a3405be832907cb12fd9d1f423e297fe8e3e66 data/minecraft/tags/blocks/mineable/axe.json 5f3b600b4fd98744bd08c993ce7bcb9c2f195cd2 data/minecraft/tags/blocks/mineable/hoe.json fdb48f194d7937ab6b423fa4b90a4d438bf6dd90 data/minecraft/tags/blocks/wooden_doors.json 684c3206f38cc9cc494d5875c5e56aad004486af data/minecraft/tags/blocks/logs.json @@ -13,6 +13,8 @@ fdb48f194d7937ab6b423fa4b90a4d438bf6dd90 data/minecraft/tags/blocks/wooden_doors 684c3206f38cc9cc494d5875c5e56aad004486af data/minecraft/tags/blocks/logs_that_burn.json e5df19a1dc6eadf14cd9b0f0fe45a74330b745e9 data/minecraft/tags/blocks/planks.json 5f3b600b4fd98744bd08c993ce7bcb9c2f195cd2 data/minecraft/tags/blocks/leaves.json +281cb08b9b68ef049820c4f3f36b40820044681e data/minecraft/tags/blocks/stairs.json +281cb08b9b68ef049820c4f3f36b40820044681e data/minecraft/tags/blocks/wooden_stairs.json 37cff4ce449b8069b59b2327d78e073fc026d348 data/minecraft/tags/blocks/pressure_plates.json 36b54a86d2ed41c8a503f7a61817a7a9d7a94536 data/minecraft/tags/blocks/crystal_sound_blocks.json fdb48f194d7937ab6b423fa4b90a4d438bf6dd90 data/minecraft/tags/blocks/doors.json diff --git a/Fabric/src/generated/resources/.cache/844611d4af49e23072b8a888c8e73c6c5d8c0768 b/Fabric/src/generated/resources/.cache/844611d4af49e23072b8a888c8e73c6c5d8c0768 index 9033a452..88edd941 100644 --- a/Fabric/src/generated/resources/.cache/844611d4af49e23072b8a888c8e73c6c5d8c0768 +++ b/Fabric/src/generated/resources/.cache/844611d4af49e23072b8a888c8e73c6c5d8c0768 @@ -1,4 +1,4 @@ -// 1.19.2 2023-01-23T14:22:44.223016397 Tags for hexcasting:action +// 1.19.2 2023-01-31T19:01:22.804380382 Tags for hexcasting:action e5afc567ea17f035e4eb1d1d48825100b7f6ad68 data/hexcasting/tags/action/per_world_pattern.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 92865607..2492ade0 100644 --- a/Fabric/src/generated/resources/.cache/9fb1092f32d4fcbf9e061ffd718d4ec689c6c95e +++ b/Fabric/src/generated/resources/.cache/9fb1092f32d4fcbf9e061ffd718d4ec689c6c95e @@ -1,4 +1,4 @@ -// 1.19.2 2023-01-23T14:22:44.22380957 Recipes +// 1.19.2 2023-01-31T19:01:22.800310741 Recipes 9f75d3e93ecbbbf3ed9a92b2943397e09dcae1a9 data/hexcasting/recipes/dye_colorizer_light_blue.json 04569ccadfd99f203b0485d0c3e877209290f2b3 data/hexcasting/advancements/recipes/hexcasting.creative_tab/dye_colorizer_pink.json 2a9d4a0f3618abf9e9b8699b318a984d2c836913 data/hexcasting/advancements/recipes/brainsweep/brainsweep/directrix_redstone.json diff --git a/Fabric/src/generated/resources/data/minecraft/tags/blocks/mineable/axe.json b/Fabric/src/generated/resources/data/minecraft/tags/blocks/mineable/axe.json index 20824c2c..a608202c 100644 --- a/Fabric/src/generated/resources/data/minecraft/tags/blocks/mineable/axe.json +++ b/Fabric/src/generated/resources/data/minecraft/tags/blocks/mineable/axe.json @@ -14,6 +14,7 @@ "hexcasting:edified_door", "hexcasting:edified_trapdoor", "hexcasting:edified_slab", - "hexcasting:edified_button" + "hexcasting:edified_button", + "hexcasting:edified_stairs" ] } \ No newline at end of file diff --git a/Fabric/src/generated/resources/data/minecraft/tags/blocks/stairs.json b/Fabric/src/generated/resources/data/minecraft/tags/blocks/stairs.json new file mode 100644 index 00000000..f91ba79b --- /dev/null +++ b/Fabric/src/generated/resources/data/minecraft/tags/blocks/stairs.json @@ -0,0 +1,6 @@ +{ + "replace": false, + "values": [ + "hexcasting:edified_stairs" + ] +} \ No newline at end of file diff --git a/Fabric/src/generated/resources/data/minecraft/tags/blocks/wooden_stairs.json b/Fabric/src/generated/resources/data/minecraft/tags/blocks/wooden_stairs.json new file mode 100644 index 00000000..f91ba79b --- /dev/null +++ b/Fabric/src/generated/resources/data/minecraft/tags/blocks/wooden_stairs.json @@ -0,0 +1,6 @@ +{ + "replace": false, + "values": [ + "hexcasting:edified_stairs" + ] +} \ No newline at end of file diff --git a/Forge/src/generated/resources/.cache/75bcd4dba6ca7d365462b0ec45e291d1056349c4 b/Forge/src/generated/resources/.cache/75bcd4dba6ca7d365462b0ec45e291d1056349c4 index e8fbb239..5eca0a5f 100644 --- a/Forge/src/generated/resources/.cache/75bcd4dba6ca7d365462b0ec45e291d1056349c4 +++ b/Forge/src/generated/resources/.cache/75bcd4dba6ca7d365462b0ec45e291d1056349c4 @@ -1,4 +1,4 @@ -// 1.19.2 2022-11-04T11:52:25.2482457 Tags for minecraft:block +// 1.19.2 2023-01-31T18:59:34.290485155 Tags for minecraft:block 42c76a43081acfb0194e2cee6de18104fb0ba5ad data/hexcasting/tags/blocks/edified_logs.json 86828f8056bfdfdd2aff10d7a9dbc6c269c25b8a data/hexcasting/tags/blocks/edified_planks.json 841dfbe4970e9167b205e5aa2b0f0936c6b9af60 data/minecraft/tags/blocks/buttons.json @@ -7,16 +7,18 @@ cba96d2ff28087e7fd9807e5e80104f3befc2512 data/minecraft/tags/blocks/doors.json 6312e44ef31d2401dddbd46c4d3eda03da6e2db3 data/minecraft/tags/blocks/leaves.json 42c76a43081acfb0194e2cee6de18104fb0ba5ad data/minecraft/tags/blocks/logs.json 42c76a43081acfb0194e2cee6de18104fb0ba5ad data/minecraft/tags/blocks/logs_that_burn.json -23aa8ac278af40fddb089155d77149735f87b6cd data/minecraft/tags/blocks/mineable/axe.json +102621940be9f729e9b0e14ae08e784efac89381 data/minecraft/tags/blocks/mineable/axe.json 6312e44ef31d2401dddbd46c4d3eda03da6e2db3 data/minecraft/tags/blocks/mineable/hoe.json 7037bf368d7951eddf3c324a0ce9e6a64403843d data/minecraft/tags/blocks/mineable/pickaxe.json abfa06b8189660656acf8f7cdccc3844fb40600f data/minecraft/tags/blocks/mineable/shovel.json 86828f8056bfdfdd2aff10d7a9dbc6c269c25b8a data/minecraft/tags/blocks/planks.json ee24953b8f5d4742f03c57842a3588618bbc5a0a data/minecraft/tags/blocks/pressure_plates.json 087e6cf0dce47d3a4918566058019139b32e1dfa data/minecraft/tags/blocks/slabs.json +cffccd1a1dbc20521cccdc6826a6eed3d8e1cf6b data/minecraft/tags/blocks/stairs.json 5c3c820c9b6e18b7916d8a862828707f28ce1f59 data/minecraft/tags/blocks/trapdoors.json 841dfbe4970e9167b205e5aa2b0f0936c6b9af60 data/minecraft/tags/blocks/wooden_buttons.json cba96d2ff28087e7fd9807e5e80104f3befc2512 data/minecraft/tags/blocks/wooden_doors.json ee24953b8f5d4742f03c57842a3588618bbc5a0a data/minecraft/tags/blocks/wooden_pressure_plates.json 087e6cf0dce47d3a4918566058019139b32e1dfa data/minecraft/tags/blocks/wooden_slabs.json +cffccd1a1dbc20521cccdc6826a6eed3d8e1cf6b data/minecraft/tags/blocks/wooden_stairs.json 5c3c820c9b6e18b7916d8a862828707f28ce1f59 data/minecraft/tags/blocks/wooden_trapdoors.json diff --git a/Forge/src/generated/resources/data/minecraft/tags/blocks/mineable/axe.json b/Forge/src/generated/resources/data/minecraft/tags/blocks/mineable/axe.json index 01b50217..7ed520cd 100644 --- a/Forge/src/generated/resources/data/minecraft/tags/blocks/mineable/axe.json +++ b/Forge/src/generated/resources/data/minecraft/tags/blocks/mineable/axe.json @@ -13,6 +13,7 @@ "hexcasting:edified_door", "hexcasting:edified_trapdoor", "hexcasting:edified_slab", - "hexcasting:edified_button" + "hexcasting:edified_button", + "hexcasting:edified_stairs" ] } \ No newline at end of file diff --git a/Forge/src/generated/resources/data/minecraft/tags/blocks/stairs.json b/Forge/src/generated/resources/data/minecraft/tags/blocks/stairs.json new file mode 100644 index 00000000..c2e7fad7 --- /dev/null +++ b/Forge/src/generated/resources/data/minecraft/tags/blocks/stairs.json @@ -0,0 +1,5 @@ +{ + "values": [ + "hexcasting:edified_stairs" + ] +} \ No newline at end of file diff --git a/Forge/src/generated/resources/data/minecraft/tags/blocks/wooden_stairs.json b/Forge/src/generated/resources/data/minecraft/tags/blocks/wooden_stairs.json new file mode 100644 index 00000000..c2e7fad7 --- /dev/null +++ b/Forge/src/generated/resources/data/minecraft/tags/blocks/wooden_stairs.json @@ -0,0 +1,5 @@ +{ + "values": [ + "hexcasting:edified_stairs" + ] +} \ No newline at end of file From af03b8c32197b1c6161820b99586e6de34fcf258 Mon Sep 17 00:00:00 2001 From: "petrak@" Date: Wed, 1 Feb 2023 09:59:45 -0600 Subject: [PATCH 70/95] close #401 --- .../casting/operators/{ => raycast}/OpBlockAxisRaycast.kt | 6 +++--- .../casting/operators/{ => raycast}/OpBlockRaycast.kt | 6 +++--- .../casting/operators/{ => raycast}/OpEntityRaycast.kt | 6 +++--- .../at/petrak/hexcasting/common/lib/hex/HexActions.java | 8 +++++++- .../src/main/resources/assets/hexcasting/lang/en_us.json | 2 +- .../java/at/petrak/hexcasting/forge/ForgeHexConfig.java | 2 +- 6 files changed, 18 insertions(+), 12 deletions(-) rename Common/src/main/java/at/petrak/hexcasting/common/casting/operators/{ => raycast}/OpBlockAxisRaycast.kt (95%) rename Common/src/main/java/at/petrak/hexcasting/common/casting/operators/{ => raycast}/OpBlockRaycast.kt (96%) rename Common/src/main/java/at/petrak/hexcasting/common/casting/operators/{ => raycast}/OpEntityRaycast.kt (95%) diff --git a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/OpBlockAxisRaycast.kt b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/raycast/OpBlockAxisRaycast.kt similarity index 95% rename from Common/src/main/java/at/petrak/hexcasting/common/casting/operators/OpBlockAxisRaycast.kt rename to Common/src/main/java/at/petrak/hexcasting/common/casting/operators/raycast/OpBlockAxisRaycast.kt index 0c66f9f0..f50bfa7e 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/OpBlockAxisRaycast.kt +++ b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/raycast/OpBlockAxisRaycast.kt @@ -1,13 +1,13 @@ -package at.petrak.hexcasting.common.casting.operators +package at.petrak.hexcasting.common.casting.operators.raycast -import at.petrak.hexcasting.api.misc.MediaConstants +import at.petrak.hexcasting.api.casting.asActionResult import at.petrak.hexcasting.api.casting.castables.Action import at.petrak.hexcasting.api.casting.castables.ConstMediaAction -import at.petrak.hexcasting.api.casting.asActionResult import at.petrak.hexcasting.api.casting.eval.CastingEnvironment import at.petrak.hexcasting.api.casting.getVec3 import at.petrak.hexcasting.api.casting.iota.Iota import at.petrak.hexcasting.api.casting.iota.NullIota +import at.petrak.hexcasting.api.misc.MediaConstants import net.minecraft.world.level.ClipContext import net.minecraft.world.phys.HitResult import net.minecraft.world.phys.Vec3 diff --git a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/OpBlockRaycast.kt b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/raycast/OpBlockRaycast.kt similarity index 96% rename from Common/src/main/java/at/petrak/hexcasting/common/casting/operators/OpBlockRaycast.kt rename to Common/src/main/java/at/petrak/hexcasting/common/casting/operators/raycast/OpBlockRaycast.kt index 2fe8b621..e3b6b442 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/OpBlockRaycast.kt +++ b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/raycast/OpBlockRaycast.kt @@ -1,13 +1,13 @@ -package at.petrak.hexcasting.common.casting.operators +package at.petrak.hexcasting.common.casting.operators.raycast -import at.petrak.hexcasting.api.misc.MediaConstants +import at.petrak.hexcasting.api.casting.asActionResult import at.petrak.hexcasting.api.casting.castables.Action import at.petrak.hexcasting.api.casting.castables.ConstMediaAction -import at.petrak.hexcasting.api.casting.asActionResult import at.petrak.hexcasting.api.casting.eval.CastingEnvironment import at.petrak.hexcasting.api.casting.getVec3 import at.petrak.hexcasting.api.casting.iota.Iota import at.petrak.hexcasting.api.casting.iota.NullIota +import at.petrak.hexcasting.api.misc.MediaConstants import net.minecraft.world.level.ClipContext import net.minecraft.world.phys.HitResult import net.minecraft.world.phys.Vec3 diff --git a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/OpEntityRaycast.kt b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/raycast/OpEntityRaycast.kt similarity index 95% rename from Common/src/main/java/at/petrak/hexcasting/common/casting/operators/OpEntityRaycast.kt rename to Common/src/main/java/at/petrak/hexcasting/common/casting/operators/raycast/OpEntityRaycast.kt index b5744a25..31b00e1c 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/OpEntityRaycast.kt +++ b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/raycast/OpEntityRaycast.kt @@ -1,13 +1,13 @@ -package at.petrak.hexcasting.common.casting.operators +package at.petrak.hexcasting.common.casting.operators.raycast -import at.petrak.hexcasting.api.misc.MediaConstants +import at.petrak.hexcasting.api.casting.asActionResult import at.petrak.hexcasting.api.casting.castables.Action import at.petrak.hexcasting.api.casting.castables.ConstMediaAction -import at.petrak.hexcasting.api.casting.asActionResult import at.petrak.hexcasting.api.casting.eval.CastingEnvironment import at.petrak.hexcasting.api.casting.getVec3 import at.petrak.hexcasting.api.casting.iota.Iota import at.petrak.hexcasting.api.casting.iota.NullIota +import at.petrak.hexcasting.api.misc.MediaConstants import net.minecraft.world.entity.projectile.ProjectileUtil import net.minecraft.world.phys.AABB 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 51b024f6..0804cbd9 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 @@ -10,7 +10,10 @@ import at.petrak.hexcasting.api.casting.math.HexDir; import at.petrak.hexcasting.api.casting.math.HexPattern; import at.petrak.hexcasting.api.misc.MediaConstants; import at.petrak.hexcasting.api.utils.HexUtils; -import at.petrak.hexcasting.common.casting.operators.*; +import at.petrak.hexcasting.common.casting.operators.OpEntityHeight; +import at.petrak.hexcasting.common.casting.operators.OpEntityLook; +import at.petrak.hexcasting.common.casting.operators.OpEntityPos; +import at.petrak.hexcasting.common.casting.operators.OpEntityVelocity; import at.petrak.hexcasting.common.casting.operators.akashic.OpAkashicRead; import at.petrak.hexcasting.common.casting.operators.akashic.OpAkashicWrite; import at.petrak.hexcasting.common.casting.operators.circles.OpCircleBounds; @@ -26,6 +29,9 @@ import at.petrak.hexcasting.common.casting.operators.math.*; import at.petrak.hexcasting.common.casting.operators.math.bit.*; import at.petrak.hexcasting.common.casting.operators.math.logic.*; import at.petrak.hexcasting.common.casting.operators.math.trig.*; +import at.petrak.hexcasting.common.casting.operators.raycast.OpBlockAxisRaycast; +import at.petrak.hexcasting.common.casting.operators.raycast.OpBlockRaycast; +import at.petrak.hexcasting.common.casting.operators.raycast.OpEntityRaycast; import at.petrak.hexcasting.common.casting.operators.rw.*; import at.petrak.hexcasting.common.casting.operators.selectors.OpGetCaster; import at.petrak.hexcasting.common.casting.operators.selectors.OpGetEntitiesBy; diff --git a/Common/src/main/resources/assets/hexcasting/lang/en_us.json b/Common/src/main/resources/assets/hexcasting/lang/en_us.json index 30917c3e..2e9880fa 100644 --- a/Common/src/main/resources/assets/hexcasting/lang/en_us.json +++ b/Common/src/main/resources/assets/hexcasting/lang/en_us.json @@ -209,7 +209,7 @@ "text.autoconfig.hexcasting.option.server.opBreakHarvestLevel.@Tooltip": "The harvest level of the Break Block spell.\n0 = wood, 1 = stone, 2 = iron, 3 = diamond, 4 = netherite.", "text.autoconfig.hexcasting.option.server.maxRecurseDepth.@Tooltip": "How many times an action can recursively cast other actions", "text.autoconfig.hexcasting.option.server.maxSpellCircleLength.@Tooltip": "The maximum number of slates in a spell circle", - "text.autoconfig.hexcasting.option.server.actionDenyList.@Tooltip": "Resource locations of disallowed actions. Trying to cast one of these will result in a mishap.", + "text.autoconfig.hexcasting.option.server.actionDenyList.@Tooltip": "Resource locations of disallowed actions. Trying to cast one of these will result in a mishap. For example, hexcasting:get_caster will prevent Mind's Reflection", "text.autoconfig.hexcasting.option.server.circleActionDenyList.@Tooltip": "Resource locations of disallowed actions within circles. Trying to cast one of these from a circle will result in a mishap.", "text.autoconfig.hexcasting.option.server.villagersOffendedByMindMurder.@Tooltip": "Whether villagers should be angry at the player when other villagers are mindflayed", "text.autoconfig.hexcasting.option.server.fewScrollTables.@Tooltip": "Loot tables that a small number of Ancient Scrolls are injected into", diff --git a/Forge/src/main/java/at/petrak/hexcasting/forge/ForgeHexConfig.java b/Forge/src/main/java/at/petrak/hexcasting/forge/ForgeHexConfig.java index 2165c6c2..9ba6a747 100644 --- a/Forge/src/main/java/at/petrak/hexcasting/forge/ForgeHexConfig.java +++ b/Forge/src/main/java/at/petrak/hexcasting/forge/ForgeHexConfig.java @@ -127,7 +127,7 @@ public class ForgeHexConfig implements HexConfig.CommonConfigAccess { circleActionDenyList = builder.comment( "Resource locations of disallowed actions within circles. Trying to cast one of these in a circle" + - " will result in a mishap.") + " will result in a mishap. For example: hexcasting:get_caster will prevent Mind's Reflection.") .defineList("circleActionDenyList", List.of(), Server::isValidReslocArg); builder.pop(); From d5e65b51621e8375fbac4bb740d7cfbfe7932b07 Mon Sep 17 00:00:00 2001 From: "petrak@" Date: Sat, 4 Feb 2023 18:52:00 -0600 Subject: [PATCH 71/95] for kirin: cheapen break block and reduce packaged hex cooldowns --- .../petrak/hexcasting/api/mod/HexConfig.java | 10 +++++++ .../casting/operators/spells/OpBreakBlock.kt | 6 ++-- .../common/items/magic/ItemArtifact.java | 6 ++++ .../common/items/magic/ItemCypher.java | 6 ++++ .../common/items/magic/ItemPackagedHex.java | 6 ++-- .../common/items/magic/ItemTrinket.java | 6 ++++ .../assets/hexcasting/lang/en_us.json | 8 +++++- .../hexcasting/fabric/FabricHexConfig.java | 23 +++++++++++++++ .../hexcasting/forge/ForgeHexConfig.java | 28 +++++++++++++++++++ 9 files changed, 93 insertions(+), 6 deletions(-) diff --git a/Common/src/main/java/at/petrak/hexcasting/api/mod/HexConfig.java b/Common/src/main/java/at/petrak/hexcasting/api/mod/HexConfig.java index abfb66d4..e1b181da 100644 --- a/Common/src/main/java/at/petrak/hexcasting/api/mod/HexConfig.java +++ b/Common/src/main/java/at/petrak/hexcasting/api/mod/HexConfig.java @@ -21,11 +21,21 @@ public class HexConfig { double mediaToHealthRate(); + int cypherCooldown(); + + int trinketCooldown(); + + int artifactCooldown(); + int DEFAULT_DUST_MEDIA_AMOUNT = MediaConstants.DUST_UNIT; int DEFAULT_SHARD_MEDIA_AMOUNT = MediaConstants.SHARD_UNIT; int DEFAULT_CHARGED_MEDIA_AMOUNT = MediaConstants.CRYSTAL_UNIT; double DEFAULT_MEDIA_TO_HEALTH_RATE = 2 * MediaConstants.CRYSTAL_UNIT / 20.0; + int DEFAULT_CYPHER_COOLDOWN = 8; + int DEFAULT_TRINKET_COOLDOWN = 5; + int DEFAULT_ARTIFACT_COOLDOWN = 3; + } public interface ClientConfigAccess { diff --git a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/spells/OpBreakBlock.kt b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/spells/OpBreakBlock.kt index 3b3906e8..3d241f64 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/spells/OpBreakBlock.kt +++ b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/spells/OpBreakBlock.kt @@ -1,13 +1,13 @@ package at.petrak.hexcasting.common.casting.operators.spells -import at.petrak.hexcasting.api.misc.MediaConstants -import at.petrak.hexcasting.api.mod.HexConfig import at.petrak.hexcasting.api.casting.ParticleSpray import at.petrak.hexcasting.api.casting.RenderedSpell import at.petrak.hexcasting.api.casting.castables.SpellAction import at.petrak.hexcasting.api.casting.eval.CastingEnvironment import at.petrak.hexcasting.api.casting.getBlockPos import at.petrak.hexcasting.api.casting.iota.Iota +import at.petrak.hexcasting.api.misc.MediaConstants +import at.petrak.hexcasting.api.mod.HexConfig import at.petrak.hexcasting.xplat.IXplatAbstractions import net.minecraft.core.BlockPos import net.minecraft.world.phys.Vec3 @@ -25,7 +25,7 @@ object OpBreakBlock : SpellAction { return Triple( Spell(pos), - (MediaConstants.DUST_UNIT * 1.125).toInt(), + MediaConstants.DUST_UNIT / 8, listOf(ParticleSpray.burst(Vec3.atCenterOf(pos), 1.0)) ) } diff --git a/Common/src/main/java/at/petrak/hexcasting/common/items/magic/ItemArtifact.java b/Common/src/main/java/at/petrak/hexcasting/common/items/magic/ItemArtifact.java index 4fd0f654..3fed34e1 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/items/magic/ItemArtifact.java +++ b/Common/src/main/java/at/petrak/hexcasting/common/items/magic/ItemArtifact.java @@ -1,5 +1,6 @@ package at.petrak.hexcasting.common.items.magic; +import at.petrak.hexcasting.api.mod.HexConfig; import net.minecraft.world.item.ItemStack; public class ItemArtifact extends ItemPackagedHex { @@ -16,4 +17,9 @@ public class ItemArtifact extends ItemPackagedHex { public boolean breakAfterDepletion() { return false; } + + @Override + public int cooldown() { + return HexConfig.common().artifactCooldown(); + } } diff --git a/Common/src/main/java/at/petrak/hexcasting/common/items/magic/ItemCypher.java b/Common/src/main/java/at/petrak/hexcasting/common/items/magic/ItemCypher.java index c2c786cb..9d9016cc 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/items/magic/ItemCypher.java +++ b/Common/src/main/java/at/petrak/hexcasting/common/items/magic/ItemCypher.java @@ -1,5 +1,6 @@ package at.petrak.hexcasting.common.items.magic; +import at.petrak.hexcasting.api.mod.HexConfig; import net.minecraft.world.item.ItemStack; public class ItemCypher extends ItemPackagedHex { @@ -16,4 +17,9 @@ public class ItemCypher extends ItemPackagedHex { public boolean breakAfterDepletion() { return true; } + + @Override + public int cooldown() { + return HexConfig.common().cypherCooldown(); + } } diff --git a/Common/src/main/java/at/petrak/hexcasting/common/items/magic/ItemPackagedHex.java b/Common/src/main/java/at/petrak/hexcasting/common/items/magic/ItemPackagedHex.java index 50d463c0..4bbaeded 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/items/magic/ItemPackagedHex.java +++ b/Common/src/main/java/at/petrak/hexcasting/common/items/magic/ItemPackagedHex.java @@ -1,9 +1,9 @@ package at.petrak.hexcasting.common.items.magic; -import at.petrak.hexcasting.api.item.HexHolderItem; import at.petrak.hexcasting.api.casting.eval.CastingEnvironment; import at.petrak.hexcasting.api.casting.eval.CastingHarness; import at.petrak.hexcasting.api.casting.iota.Iota; +import at.petrak.hexcasting.api.item.HexHolderItem; import at.petrak.hexcasting.api.utils.NBTHelper; import at.petrak.hexcasting.common.lib.hex.HexIotaTypes; import net.minecraft.nbt.CompoundTag; @@ -40,6 +40,8 @@ public abstract class ItemPackagedHex extends ItemMediaHolder implements HexHold public abstract boolean breakAfterDepletion(); + public abstract int cooldown(); + @Override public boolean canRecharge(ItemStack stack) { return !breakAfterDepletion(); @@ -120,7 +122,7 @@ public abstract class ItemPackagedHex extends ItemMediaHolder implements HexHold } player.awardStat(stat); - sPlayer.getCooldowns().addCooldown(this, 5); + sPlayer.getCooldowns().addCooldown(this, this.cooldown()); if (broken) { stack.shrink(1); diff --git a/Common/src/main/java/at/petrak/hexcasting/common/items/magic/ItemTrinket.java b/Common/src/main/java/at/petrak/hexcasting/common/items/magic/ItemTrinket.java index 4eb24e6a..38396297 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/items/magic/ItemTrinket.java +++ b/Common/src/main/java/at/petrak/hexcasting/common/items/magic/ItemTrinket.java @@ -1,5 +1,6 @@ package at.petrak.hexcasting.common.items.magic; +import at.petrak.hexcasting.api.mod.HexConfig; import net.minecraft.world.item.ItemStack; public class ItemTrinket extends ItemPackagedHex { @@ -16,4 +17,9 @@ public class ItemTrinket extends ItemPackagedHex { public boolean breakAfterDepletion() { return false; } + + @Override + public int cooldown() { + return HexConfig.common().trinketCooldown(); + } } diff --git a/Common/src/main/resources/assets/hexcasting/lang/en_us.json b/Common/src/main/resources/assets/hexcasting/lang/en_us.json index 2e9880fa..d6fda312 100644 --- a/Common/src/main/resources/assets/hexcasting/lang/en_us.json +++ b/Common/src/main/resources/assets/hexcasting/lang/en_us.json @@ -184,10 +184,16 @@ "text.autoconfig.hexcasting.option.common.shardMediaAmount": "Shard Media Amount", "text.autoconfig.hexcasting.option.common.chargedCrystalMediaAmount": "Charged Crystal Media Amount", "text.autoconfig.hexcasting.option.common.mediaToHealthRate": "Media To Health Rate", + "text.autoconfig.hexcasting.option.common.cypherCooldown": "Cypher Cooldown", + "text.autoconfig.hexcasting.option.common.trinketCooldown": "Trinket Cooldown", + "text.autoconfig.hexcasting.option.common.artifactCooldown": "Artifact Cooldown", "text.autoconfig.hexcasting.option.common.dustMediaAmount.@Tooltip": "How much media a single Amethyst Dust item is worth", "text.autoconfig.hexcasting.option.common.shardMediaAmount.@Tooltip": "How much media a single Amethyst Shard item is worth", "text.autoconfig.hexcasting.option.common.chargedCrystalMediaAmount.@Tooltip": "How much media a single Charged Amethyst Crystal item is worth", "text.autoconfig.hexcasting.option.common.mediaToHealthRate.@Tooltip": "How many points of media a half-heart is worth when casting from HP", + "text.autoconfig.hexcasting.option.common.cypherCooldown.@Tooltip": "Cooldown of a cypher in ticks", + "text.autoconfig.hexcasting.option.common.trinketCooldown.@Tooltip": "Cooldown of a trinket in ticks", + "text.autoconfig.hexcasting.option.common.artifactCooldown.@Tooltip": "Cooldown of an artifact in ticks", "text.autoconfig.hexcasting.option.client.ctrlTogglesOffStrokeOrder": "Ctrl Toggles Off Stroke Order", "text.autoconfig.hexcasting.option.client.invertSpellbookScrollDirection": "Invert Spellbook Scroll Direction", @@ -1079,7 +1085,7 @@ "hexcasting.entry.blockworks": "Blockworks", "hexcasting.page.blockworks.place_block": "Remove a location from the stack, then pick a block item and place it at the given location.$(br)Costs a negligible amount of _media.", - "hexcasting.page.blockworks.break_block": "Remove a location from the stack, then break the block at the given location. This spell can break nearly anything a Diamond Pickaxe can break.$(br)Costs a bit more than one $(l:items/amethyst)$(item)Amethyst Dust/$.", + "hexcasting.page.blockworks.break_block": "Remove a location from the stack, then break the block at the given location. This spell can break nearly anything a Diamond Pickaxe can break.$(br)Costs about an eighth of one $(l:items/amethyst)$(item)Amethyst Dust/$.", "hexcasting.page.blockworks.create_water": "Summon a block of water (or insert up to a bucket's worth) into a block at the given position. Costs about one $(l:items/amethyst)$(item)Amethyst Dust/$.", "hexcasting.page.blockworks.destroy_water": "Drains either a liquid container at, or a body of liquid around, the given position. Costs about two $(l:items/amethyst)$(item)Charged Amethyst/$.", "hexcasting.page.blockworks.conjure_block": "Conjure an ethereal, but solid, block that sparkles with my pigment at the given position. Costs about one $(l:items/amethyst)$(item)Amethyst Dust/$.", diff --git a/Fabric/src/main/java/at/petrak/hexcasting/fabric/FabricHexConfig.java b/Fabric/src/main/java/at/petrak/hexcasting/fabric/FabricHexConfig.java index 2f207026..54a4a1a2 100644 --- a/Fabric/src/main/java/at/petrak/hexcasting/fabric/FabricHexConfig.java +++ b/Fabric/src/main/java/at/petrak/hexcasting/fabric/FabricHexConfig.java @@ -64,6 +64,14 @@ public class FabricHexConfig extends PartitioningSerializer.GlobalData { @ConfigEntry.Gui.Tooltip private double mediaToHealthRate = DEFAULT_MEDIA_TO_HEALTH_RATE; + @ConfigEntry.Gui.Tooltip + private int cypherCooldown = DEFAULT_CYPHER_COOLDOWN; + @ConfigEntry.Gui.Tooltip + private int trinketCooldown = DEFAULT_TRINKET_COOLDOWN; + @ConfigEntry.Gui.Tooltip + private int artifactCooldown = DEFAULT_ARTIFACT_COOLDOWN; + + @Override public void validatePostLoad() throws ValidationException { this.dustMediaAmount = Math.max(this.dustMediaAmount, 0); @@ -91,6 +99,21 @@ public class FabricHexConfig extends PartitioningSerializer.GlobalData { public double mediaToHealthRate() { return mediaToHealthRate; } + + @Override + public int cypherCooldown() { + return cypherCooldown; + } + + @Override + public int trinketCooldown() { + return trinketCooldown; + } + + @Override + public int artifactCooldown() { + return artifactCooldown; + } } @Config(name = "client") diff --git a/Forge/src/main/java/at/petrak/hexcasting/forge/ForgeHexConfig.java b/Forge/src/main/java/at/petrak/hexcasting/forge/ForgeHexConfig.java index 9ba6a747..f8cfca9f 100644 --- a/Forge/src/main/java/at/petrak/hexcasting/forge/ForgeHexConfig.java +++ b/Forge/src/main/java/at/petrak/hexcasting/forge/ForgeHexConfig.java @@ -16,6 +16,10 @@ public class ForgeHexConfig implements HexConfig.CommonConfigAccess { private static ForgeConfigSpec.IntValue chargedCrystalMediaAmount; private static ForgeConfigSpec.DoubleValue mediaToHealthRate; + private static ForgeConfigSpec.IntValue cypherCooldown; + private static ForgeConfigSpec.IntValue trinketCooldown; + private static ForgeConfigSpec.IntValue artifactCooldown; + public ForgeHexConfig(ForgeConfigSpec.Builder builder) { builder.push("Media Amounts"); dustMediaAmount = builder.comment("How much media a single Amethyst Dust item is worth") @@ -27,6 +31,15 @@ public class ForgeHexConfig implements HexConfig.CommonConfigAccess { mediaToHealthRate = builder.comment("How many points of media a half-heart is worth when casting from HP") .defineInRange("mediaToHealthRate", DEFAULT_MEDIA_TO_HEALTH_RATE, 0.0, Double.POSITIVE_INFINITY); builder.pop(); + + builder.push("Cooldowns"); + cypherCooldown = builder.comment("Cooldown in ticks of a cypher") + .defineInRange("cypherCooldown", DEFAULT_CYPHER_COOLDOWN, 0, Integer.MAX_VALUE); + trinketCooldown = builder.comment("Cooldown in ticks of a trinket") + .defineInRange("trinketCooldown", DEFAULT_TRINKET_COOLDOWN, 0, Integer.MAX_VALUE); + artifactCooldown = builder.comment("Cooldown in ticks of a artifact") + .defineInRange("artifactCooldown", DEFAULT_ARTIFACT_COOLDOWN, 0, Integer.MAX_VALUE); + builder.pop(); } @Override @@ -49,6 +62,21 @@ public class ForgeHexConfig implements HexConfig.CommonConfigAccess { return mediaToHealthRate.get(); } + @Override + public int cypherCooldown() { + return cypherCooldown.get(); + } + + @Override + public int trinketCooldown() { + return trinketCooldown.get(); + } + + @Override + public int artifactCooldown() { + return artifactCooldown.get(); + } + public static class Client implements HexConfig.ClientConfigAccess { private static ForgeConfigSpec.BooleanValue ctrlTogglesOffStrokeOrder; private static ForgeConfigSpec.BooleanValue invertSpellbookScrollDirection; From 1dc3c88856fd48dc896c11c02ace2fcf562f4371 Mon Sep 17 00:00:00 2001 From: "petrak@" Date: Wed, 15 Feb 2023 01:37:09 -0600 Subject: [PATCH 72/95] it thinks, therefore you aren't --- .../8f7cd5c924d3264b7777ef1696459761f9a70902 | 4 +- .../hexcasting/models/item/thought_knot.json | 20 +++++++ .../models/item/thought_knot_written.json | 7 +++ .../client/RegisterClientStuff.java | 18 ++++-- .../blocks/akashic/BlockAkashicBookshelf.java | 2 +- .../common/command/ListPatternsCommand.java | 2 +- .../common/entities/EntityWallScroll.java | 8 +-- .../items/{ => storage}/ItemAbacus.java | 8 +-- .../common/items/{ => storage}/ItemFocus.java | 2 +- .../items/{ => storage}/ItemScroll.java | 2 +- .../common/items/{ => storage}/ItemSlate.java | 2 +- .../items/{ => storage}/ItemSpellbook.java | 6 +- .../common/items/storage/ItemThoughtKnot.java | 52 ++++++++++++++++++ .../hexcasting/common/lib/HexItems.java | 7 ++- .../loot/AddPerWorldPatternToScrollFunc.java | 2 +- .../common/network/MsgShiftScrollSyn.java | 6 +- .../common/recipe/SealSpellbookRecipe.java | 2 +- .../common/recipe/SealThingsRecipe.java | 4 +- .../assets/hexcasting/lang/en_us.json | 1 + .../hexcasting/textures/item/thought_knot.png | Bin 0 -> 232 bytes .../textures/item/thought_knot_overlay.png | Bin 0 -> 189 bytes .../03e4de26f1265135874f8cdcaebc09d9c08eb42b | 2 +- .../67cce32b1c3cbbcb1f646605f4914e3f196986c2 | 2 +- .../75bcd4dba6ca7d365462b0ec45e291d1056349c4 | 2 +- .../844611d4af49e23072b8a888c8e73c6c5d8c0768 | 2 +- .../9fb1092f32d4fcbf9e061ffd718d4ec689c6c95e | 2 +- .../forge/datagen/xplat/HexItemModels.java | 21 ++++++- 27 files changed, 149 insertions(+), 37 deletions(-) create mode 100644 Common/src/generated/resources/assets/hexcasting/models/item/thought_knot.json create mode 100644 Common/src/generated/resources/assets/hexcasting/models/item/thought_knot_written.json rename Common/src/main/java/at/petrak/hexcasting/common/items/{ => storage}/ItemAbacus.java (95%) rename Common/src/main/java/at/petrak/hexcasting/common/items/{ => storage}/ItemFocus.java (97%) rename Common/src/main/java/at/petrak/hexcasting/common/items/{ => storage}/ItemScroll.java (99%) rename Common/src/main/java/at/petrak/hexcasting/common/items/{ => storage}/ItemSlate.java (98%) rename Common/src/main/java/at/petrak/hexcasting/common/items/{ => storage}/ItemSpellbook.java (98%) create mode 100644 Common/src/main/java/at/petrak/hexcasting/common/items/storage/ItemThoughtKnot.java create mode 100644 Common/src/main/resources/assets/hexcasting/textures/item/thought_knot.png create mode 100644 Common/src/main/resources/assets/hexcasting/textures/item/thought_knot_overlay.png diff --git a/Common/src/generated/resources/.cache/8f7cd5c924d3264b7777ef1696459761f9a70902 b/Common/src/generated/resources/.cache/8f7cd5c924d3264b7777ef1696459761f9a70902 index 113ecb7a..d6ff03e6 100644 --- a/Common/src/generated/resources/.cache/8f7cd5c924d3264b7777ef1696459761f9a70902 +++ b/Common/src/generated/resources/.cache/8f7cd5c924d3264b7777ef1696459761f9a70902 @@ -1,4 +1,4 @@ -// 1.19.2 2023-01-22T12:41:02.49644171 Item Models: hexcasting +// 1.19.2 2023-02-15T01:34:30.703213817 Item Models: hexcasting f2156b3a7041cf99891b528393db64c6b9ca1a4f assets/hexcasting/models/item/abacus.json 933059cd7c2dbaff0e643c644c14af0c0e77aa29 assets/hexcasting/models/item/acacia_staff.json 19730853397b109cfedd0c3bbda83d5de6cd15b9 assets/hexcasting/models/item/akashic_record.json @@ -101,6 +101,8 @@ c29e6e7b2168eeeb13b1fc3e93ffc3e0c9bd11ce assets/hexcasting/models/item/spellbook d6ebc87cb0fa6f86bee3a4eade7329ebb0cf2d38 assets/hexcasting/models/item/stripped_edified_log.json ea3f18f75776022127f3a108119e3f7a5c211c0f assets/hexcasting/models/item/stripped_edified_wood.json 0a100b64e77394606018320bbc5752a546fe0af4 assets/hexcasting/models/item/sub_sandwich.json +6a7f5af82cf8ec72c3457ef4c1ae11a76717bf88 assets/hexcasting/models/item/thought_knot.json +93b2191ffab47003f661b75a85cd833ec64f0c15 assets/hexcasting/models/item/thought_knot_written.json 5f4831d11d8f45b037a6f48e12d2e794ada7b961 assets/hexcasting/models/item/trinket.json 946970e74b8d3c76c15191f494bc1f3d7e36aa43 assets/hexcasting/models/item/trinket_filled.json c6523de66cbfae3a1e6361c635cc693a0a089bb3 assets/hexcasting/models/item/uuid_colorizer.json diff --git a/Common/src/generated/resources/assets/hexcasting/models/item/thought_knot.json b/Common/src/generated/resources/assets/hexcasting/models/item/thought_knot.json new file mode 100644 index 00000000..4a991722 --- /dev/null +++ b/Common/src/generated/resources/assets/hexcasting/models/item/thought_knot.json @@ -0,0 +1,20 @@ +{ + "parent": "minecraft:item/generated", + "overrides": [ + { + "model": "hexcasting:item/thought_knot", + "predicate": { + "hexcasting:written": 0.0 + } + }, + { + "model": "hexcasting:item/thought_knot_written", + "predicate": { + "hexcasting:written": 1.0 + } + } + ], + "textures": { + "layer0": "hexcasting:item/thought_knot" + } +} \ No newline at end of file diff --git a/Common/src/generated/resources/assets/hexcasting/models/item/thought_knot_written.json b/Common/src/generated/resources/assets/hexcasting/models/item/thought_knot_written.json new file mode 100644 index 00000000..f5b12c99 --- /dev/null +++ b/Common/src/generated/resources/assets/hexcasting/models/item/thought_knot_written.json @@ -0,0 +1,7 @@ +{ + "parent": "minecraft:item/generated", + "textures": { + "layer0": "hexcasting:item/thought_knot", + "layer1": "hexcasting:item/thought_knot_overlay" + } +} \ No newline at end of file diff --git a/Common/src/main/java/at/petrak/hexcasting/client/RegisterClientStuff.java b/Common/src/main/java/at/petrak/hexcasting/client/RegisterClientStuff.java index 991d16b9..dd17f541 100644 --- a/Common/src/main/java/at/petrak/hexcasting/client/RegisterClientStuff.java +++ b/Common/src/main/java/at/petrak/hexcasting/client/RegisterClientStuff.java @@ -13,9 +13,10 @@ import at.petrak.hexcasting.client.entity.WallScrollRenderer; import at.petrak.hexcasting.common.blocks.akashic.BlockAkashicBookshelf; import at.petrak.hexcasting.common.blocks.akashic.BlockEntityAkashicBookshelf; import at.petrak.hexcasting.common.entities.HexEntities; -import at.petrak.hexcasting.common.items.*; +import at.petrak.hexcasting.common.items.ItemStaff; import at.petrak.hexcasting.common.items.magic.ItemMediaBattery; import at.petrak.hexcasting.common.items.magic.ItemPackagedHex; +import at.petrak.hexcasting.common.items.storage.*; import at.petrak.hexcasting.common.lib.HexBlockEntities; import at.petrak.hexcasting.common.lib.HexBlocks; import at.petrak.hexcasting.common.lib.HexItems; @@ -55,12 +56,20 @@ import java.util.function.UnaryOperator; public class RegisterClientStuff { public static void init() { - registerDataHolderOverrides(HexItems.FOCUS, + registerSealableDataHolderOverrides(HexItems.FOCUS, stack -> HexItems.FOCUS.readIotaTag(stack) != null, ItemFocus::isSealed); - registerDataHolderOverrides(HexItems.SPELLBOOK, + registerSealableDataHolderOverrides(HexItems.SPELLBOOK, stack -> HexItems.SPELLBOOK.readIotaTag(stack) != null, ItemSpellbook::isSealed); + IClientXplatAbstractions.INSTANCE.registerItemProperty(HexItems.THOUGHT_KNOT, ItemThoughtKnot.WRITTEN_PRED, + (stack, level, holder, holderID) -> { + if (NBTHelper.contains(stack, ItemThoughtKnot.TAG_DATA)) { + return 1; + } else { + return 0; + } + }); registerPackagedSpellOverrides(HexItems.CYPHER); registerPackagedSpellOverrides(HexItems.TRINKET); @@ -124,6 +133,7 @@ public class RegisterClientStuff { BiConsumer blockColorRegistry) { itemColorRegistry.accept(makeIotaStorageColorizer(HexItems.FOCUS::getColor), HexItems.FOCUS); itemColorRegistry.accept(makeIotaStorageColorizer(HexItems.SPELLBOOK::getColor), HexItems.SPELLBOOK); + itemColorRegistry.accept(makeIotaStorageColorizer(HexItems.THOUGHT_KNOT::getColor), HexItems.THOUGHT_KNOT); blockColorRegistry.accept((bs, level, pos, idx) -> { if (!bs.getValue(BlockAkashicBookshelf.HAS_BOOKS) || level == null || pos == null) { @@ -302,7 +312,7 @@ public class RegisterClientStuff { }; } - private static void registerDataHolderOverrides(IotaHolderItem item, Predicate hasIota, + private static void registerSealableDataHolderOverrides(IotaHolderItem item, Predicate hasIota, Predicate isSealed) { IClientXplatAbstractions.INSTANCE.registerItemProperty((Item) item, ItemFocus.OVERLAY_PRED, (stack, level, holder, holderID) -> { diff --git a/Common/src/main/java/at/petrak/hexcasting/common/blocks/akashic/BlockAkashicBookshelf.java b/Common/src/main/java/at/petrak/hexcasting/common/blocks/akashic/BlockAkashicBookshelf.java index 233773f8..39545fd9 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/blocks/akashic/BlockAkashicBookshelf.java +++ b/Common/src/main/java/at/petrak/hexcasting/common/blocks/akashic/BlockAkashicBookshelf.java @@ -2,7 +2,7 @@ package at.petrak.hexcasting.common.blocks.akashic; import at.petrak.hexcasting.annotations.SoftImplement; import at.petrak.hexcasting.api.casting.iota.PatternIota; -import at.petrak.hexcasting.common.items.ItemScroll; +import at.petrak.hexcasting.common.items.storage.ItemScroll; import at.petrak.hexcasting.common.lib.HexSounds; import at.petrak.hexcasting.xplat.IForgeLikeBlock; import net.minecraft.core.BlockPos; diff --git a/Common/src/main/java/at/petrak/hexcasting/common/command/ListPatternsCommand.java b/Common/src/main/java/at/petrak/hexcasting/common/command/ListPatternsCommand.java index 8e414e49..4a53d4d2 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/command/ListPatternsCommand.java +++ b/Common/src/main/java/at/petrak/hexcasting/common/command/ListPatternsCommand.java @@ -3,7 +3,7 @@ package at.petrak.hexcasting.common.command; import at.petrak.hexcasting.api.casting.iota.PatternIota; import at.petrak.hexcasting.api.casting.math.HexPattern; import at.petrak.hexcasting.common.casting.PatternRegistryManifest; -import at.petrak.hexcasting.common.items.ItemScroll; +import at.petrak.hexcasting.common.items.storage.ItemScroll; import at.petrak.hexcasting.common.lib.HexItems; import com.mojang.brigadier.builder.LiteralArgumentBuilder; import net.minecraft.commands.CommandSourceStack; diff --git a/Common/src/main/java/at/petrak/hexcasting/common/entities/EntityWallScroll.java b/Common/src/main/java/at/petrak/hexcasting/common/entities/EntityWallScroll.java index 116247cc..aa78c9b0 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/entities/EntityWallScroll.java +++ b/Common/src/main/java/at/petrak/hexcasting/common/entities/EntityWallScroll.java @@ -4,7 +4,7 @@ import at.petrak.hexcasting.api.casting.math.HexPattern; import at.petrak.hexcasting.api.utils.HexUtils; import at.petrak.hexcasting.api.utils.NBTHelper; import at.petrak.hexcasting.client.RenderLib; -import at.petrak.hexcasting.common.items.ItemScroll; +import at.petrak.hexcasting.common.items.storage.ItemScroll; import at.petrak.hexcasting.common.lib.HexItems; import at.petrak.hexcasting.common.lib.HexSounds; import at.petrak.hexcasting.common.network.MsgNewWallScrollAck; @@ -53,7 +53,7 @@ public class EntityWallScroll extends HangingEntity { } public EntityWallScroll(Level world, BlockPos pos, Direction dir, ItemStack scroll, boolean showStrokeOrder, - int blockSize) { + int blockSize) { super(HexEntities.WALL_SCROLL, world, pos); this.setDirection(dir); this.blockSize = blockSize; @@ -160,7 +160,7 @@ public class EntityWallScroll extends HangingEntity { } public void readSpawnData(BlockPos pos, Direction dir, ItemStack scrollItem, - boolean showsStrokeOrder, int blockSize) { + boolean showsStrokeOrder, int blockSize) { this.pos = pos; this.scroll = scrollItem; this.blockSize = blockSize; @@ -203,7 +203,7 @@ public class EntityWallScroll extends HangingEntity { @Override public void lerpTo(double pX, double pY, double pZ, float pYaw, float pPitch, int pPosRotationIncrements, - boolean pTeleport) { + boolean pTeleport) { BlockPos blockpos = this.pos.offset(pX - this.getX(), pY - this.getY(), pZ - this.getZ()); this.setPos(blockpos.getX(), blockpos.getY(), blockpos.getZ()); } diff --git a/Common/src/main/java/at/petrak/hexcasting/common/items/ItemAbacus.java b/Common/src/main/java/at/petrak/hexcasting/common/items/storage/ItemAbacus.java similarity index 95% rename from Common/src/main/java/at/petrak/hexcasting/common/items/ItemAbacus.java rename to Common/src/main/java/at/petrak/hexcasting/common/items/storage/ItemAbacus.java index 8c933e68..c9d6ca85 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/items/ItemAbacus.java +++ b/Common/src/main/java/at/petrak/hexcasting/common/items/storage/ItemAbacus.java @@ -1,11 +1,11 @@ -package at.petrak.hexcasting.common.items; +package at.petrak.hexcasting.common.items.storage; -import at.petrak.hexcasting.api.item.IotaHolderItem; import at.petrak.hexcasting.api.casting.iota.DoubleIota; import at.petrak.hexcasting.api.casting.iota.Iota; +import at.petrak.hexcasting.api.item.IotaHolderItem; import at.petrak.hexcasting.api.utils.NBTHelper; -import at.petrak.hexcasting.common.lib.hex.HexIotaTypes; import at.petrak.hexcasting.common.lib.HexSounds; +import at.petrak.hexcasting.common.lib.hex.HexIotaTypes; import net.minecraft.nbt.CompoundTag; import net.minecraft.network.chat.Component; import net.minecraft.world.InteractionHand; @@ -66,7 +66,7 @@ public class ItemAbacus extends Item implements IotaHolderItem { @Override public void appendHoverText(ItemStack pStack, @Nullable Level pLevel, List pTooltipComponents, - TooltipFlag pIsAdvanced) { + TooltipFlag pIsAdvanced) { IotaHolderItem.appendHoverText(this, pStack, pTooltipComponents, pIsAdvanced); } } diff --git a/Common/src/main/java/at/petrak/hexcasting/common/items/ItemFocus.java b/Common/src/main/java/at/petrak/hexcasting/common/items/storage/ItemFocus.java similarity index 97% rename from Common/src/main/java/at/petrak/hexcasting/common/items/ItemFocus.java rename to Common/src/main/java/at/petrak/hexcasting/common/items/storage/ItemFocus.java index 48ea9b5e..24864975 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/items/ItemFocus.java +++ b/Common/src/main/java/at/petrak/hexcasting/common/items/storage/ItemFocus.java @@ -1,4 +1,4 @@ -package at.petrak.hexcasting.common.items; +package at.petrak.hexcasting.common.items.storage; import at.petrak.hexcasting.api.casting.iota.Iota; import at.petrak.hexcasting.api.casting.iota.NullIota; diff --git a/Common/src/main/java/at/petrak/hexcasting/common/items/ItemScroll.java b/Common/src/main/java/at/petrak/hexcasting/common/items/storage/ItemScroll.java similarity index 99% rename from Common/src/main/java/at/petrak/hexcasting/common/items/ItemScroll.java rename to Common/src/main/java/at/petrak/hexcasting/common/items/storage/ItemScroll.java index c0fa5de2..4ed6093a 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/items/ItemScroll.java +++ b/Common/src/main/java/at/petrak/hexcasting/common/items/storage/ItemScroll.java @@ -1,4 +1,4 @@ -package at.petrak.hexcasting.common.items; +package at.petrak.hexcasting.common.items.storage; import at.petrak.hexcasting.api.casting.iota.Iota; import at.petrak.hexcasting.api.casting.iota.PatternIota; diff --git a/Common/src/main/java/at/petrak/hexcasting/common/items/ItemSlate.java b/Common/src/main/java/at/petrak/hexcasting/common/items/storage/ItemSlate.java similarity index 98% rename from Common/src/main/java/at/petrak/hexcasting/common/items/ItemSlate.java rename to Common/src/main/java/at/petrak/hexcasting/common/items/storage/ItemSlate.java index db576751..3821a83e 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/items/ItemSlate.java +++ b/Common/src/main/java/at/petrak/hexcasting/common/items/storage/ItemSlate.java @@ -1,4 +1,4 @@ -package at.petrak.hexcasting.common.items; +package at.petrak.hexcasting.common.items.storage; import at.petrak.hexcasting.annotations.SoftImplement; import at.petrak.hexcasting.api.HexAPI; diff --git a/Common/src/main/java/at/petrak/hexcasting/common/items/ItemSpellbook.java b/Common/src/main/java/at/petrak/hexcasting/common/items/storage/ItemSpellbook.java similarity index 98% rename from Common/src/main/java/at/petrak/hexcasting/common/items/ItemSpellbook.java rename to Common/src/main/java/at/petrak/hexcasting/common/items/storage/ItemSpellbook.java index f05bcc4b..79b327a4 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/items/ItemSpellbook.java +++ b/Common/src/main/java/at/petrak/hexcasting/common/items/storage/ItemSpellbook.java @@ -1,8 +1,8 @@ -package at.petrak.hexcasting.common.items; +package at.petrak.hexcasting.common.items.storage; -import at.petrak.hexcasting.api.item.IotaHolderItem; import at.petrak.hexcasting.api.casting.iota.Iota; import at.petrak.hexcasting.api.casting.iota.NullIota; +import at.petrak.hexcasting.api.item.IotaHolderItem; import at.petrak.hexcasting.api.utils.NBTHelper; import at.petrak.hexcasting.common.lib.hex.HexIotaTypes; import net.minecraft.ChatFormatting; @@ -42,7 +42,7 @@ public class ItemSpellbook extends Item implements IotaHolderItem { @Override public void appendHoverText(ItemStack stack, @Nullable Level level, List tooltip, - TooltipFlag isAdvanced) { + TooltipFlag isAdvanced) { boolean sealed = isSealed(stack); boolean empty = false; if (NBTHelper.hasNumber(stack, TAG_SELECTED_PAGE)) { diff --git a/Common/src/main/java/at/petrak/hexcasting/common/items/storage/ItemThoughtKnot.java b/Common/src/main/java/at/petrak/hexcasting/common/items/storage/ItemThoughtKnot.java new file mode 100644 index 00000000..8f189716 --- /dev/null +++ b/Common/src/main/java/at/petrak/hexcasting/common/items/storage/ItemThoughtKnot.java @@ -0,0 +1,52 @@ +package at.petrak.hexcasting.common.items.storage; + +import at.petrak.hexcasting.api.casting.iota.Iota; +import at.petrak.hexcasting.api.item.IotaHolderItem; +import at.petrak.hexcasting.api.utils.NBTHelper; +import at.petrak.hexcasting.common.lib.hex.HexIotaTypes; +import net.minecraft.nbt.CompoundTag; +import net.minecraft.network.chat.Component; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.world.item.Item; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.item.TooltipFlag; +import net.minecraft.world.level.Level; +import org.jetbrains.annotations.Nullable; + +import java.util.List; + +import static at.petrak.hexcasting.api.HexAPI.modLoc; + +// Would love to be able to just write to a piece of string but the api requires it to be the same item +public class ItemThoughtKnot extends Item implements IotaHolderItem { + public static final ResourceLocation WRITTEN_PRED = modLoc("written"); + + public static final String TAG_DATA = "data"; + + public ItemThoughtKnot(Properties properties) { + super(properties); + } + + @Override + public @Nullable CompoundTag readIotaTag(ItemStack stack) { + return NBTHelper.getCompound(stack, TAG_DATA); + } + + @Override + public boolean canWrite(ItemStack stack, @Nullable Iota iota) { + return iota != null && !NBTHelper.contains(stack, TAG_DATA); + } + + @Override + public void writeDatum(ItemStack stack, @Nullable Iota iota) { + if (iota != null) { + NBTHelper.putCompound(stack, TAG_DATA, HexIotaTypes.serialize(iota)); + } + } + + @Override + public void appendHoverText(ItemStack pStack, @Nullable Level pLevel, + List pTooltipComponents, TooltipFlag pIsAdvanced) { + IotaHolderItem.appendHoverText(this, pStack, pTooltipComponents, pIsAdvanced); + } +} diff --git a/Common/src/main/java/at/petrak/hexcasting/common/lib/HexItems.java b/Common/src/main/java/at/petrak/hexcasting/common/lib/HexItems.java index 0dd1878b..d80e3a21 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/lib/HexItems.java +++ b/Common/src/main/java/at/petrak/hexcasting/common/lib/HexItems.java @@ -1,10 +1,14 @@ package at.petrak.hexcasting.common.lib; -import at.petrak.hexcasting.common.items.*; +import at.petrak.hexcasting.common.items.ItemJewelerHammer; +import at.petrak.hexcasting.common.items.ItemLens; +import at.petrak.hexcasting.common.items.ItemLoreFragment; +import at.petrak.hexcasting.common.items.ItemStaff; import at.petrak.hexcasting.common.items.colorizer.ItemDyeColorizer; import at.petrak.hexcasting.common.items.colorizer.ItemPrideColorizer; import at.petrak.hexcasting.common.items.colorizer.ItemUUIDColorizer; import at.petrak.hexcasting.common.items.magic.*; +import at.petrak.hexcasting.common.items.storage.*; import at.petrak.hexcasting.xplat.IXplatAbstractions; import net.minecraft.Util; import net.minecraft.resources.ResourceLocation; @@ -49,6 +53,7 @@ public class HexItems { .tab(IXplatAbstractions.INSTANCE.getTab()))); public static final ItemAbacus ABACUS = make("abacus", new ItemAbacus(unstackable())); + public static final ItemThoughtKnot THOUGHT_KNOT = make("thought_knot", new ItemThoughtKnot(unstackable())); public static final ItemFocus FOCUS = make("focus", new ItemFocus(unstackable())); public static final ItemSpellbook SPELLBOOK = make("spellbook", new ItemSpellbook(unstackable())); diff --git a/Common/src/main/java/at/petrak/hexcasting/common/loot/AddPerWorldPatternToScrollFunc.java b/Common/src/main/java/at/petrak/hexcasting/common/loot/AddPerWorldPatternToScrollFunc.java index 5ed1ad4e..beb88a4b 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/loot/AddPerWorldPatternToScrollFunc.java +++ b/Common/src/main/java/at/petrak/hexcasting/common/loot/AddPerWorldPatternToScrollFunc.java @@ -1,7 +1,7 @@ package at.petrak.hexcasting.common.loot; import at.petrak.hexcasting.common.casting.PatternRegistryManifest; -import at.petrak.hexcasting.common.items.ItemScroll; +import at.petrak.hexcasting.common.items.storage.ItemScroll; import at.petrak.hexcasting.common.lib.HexLootFunctions; import com.google.gson.JsonDeserializationContext; import com.google.gson.JsonObject; diff --git a/Common/src/main/java/at/petrak/hexcasting/common/network/MsgShiftScrollSyn.java b/Common/src/main/java/at/petrak/hexcasting/common/network/MsgShiftScrollSyn.java index 985491af..8b64955d 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/network/MsgShiftScrollSyn.java +++ b/Common/src/main/java/at/petrak/hexcasting/common/network/MsgShiftScrollSyn.java @@ -1,11 +1,11 @@ package at.petrak.hexcasting.common.network; import at.petrak.hexcasting.api.utils.NBTHelper; -import at.petrak.hexcasting.common.items.ItemAbacus; -import at.petrak.hexcasting.common.items.ItemSpellbook; -import at.petrak.hexcasting.common.lib.hex.HexIotaTypes; +import at.petrak.hexcasting.common.items.storage.ItemAbacus; +import at.petrak.hexcasting.common.items.storage.ItemSpellbook; import at.petrak.hexcasting.common.lib.HexItems; import at.petrak.hexcasting.common.lib.HexSounds; +import at.petrak.hexcasting.common.lib.hex.HexIotaTypes; import io.netty.buffer.ByteBuf; import net.minecraft.ChatFormatting; import net.minecraft.network.FriendlyByteBuf; diff --git a/Common/src/main/java/at/petrak/hexcasting/common/recipe/SealSpellbookRecipe.java b/Common/src/main/java/at/petrak/hexcasting/common/recipe/SealSpellbookRecipe.java index 49156f35..b8130095 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/recipe/SealSpellbookRecipe.java +++ b/Common/src/main/java/at/petrak/hexcasting/common/recipe/SealSpellbookRecipe.java @@ -2,7 +2,7 @@ package at.petrak.hexcasting.common.recipe; import at.petrak.hexcasting.api.item.IotaHolderItem; import at.petrak.hexcasting.api.utils.NBTHelper; -import at.petrak.hexcasting.common.items.ItemSpellbook; +import at.petrak.hexcasting.common.items.storage.ItemSpellbook; import at.petrak.hexcasting.common.lib.HexItems; import at.petrak.hexcasting.xplat.IXplatAbstractions; import net.minecraft.core.NonNullList; diff --git a/Common/src/main/java/at/petrak/hexcasting/common/recipe/SealThingsRecipe.java b/Common/src/main/java/at/petrak/hexcasting/common/recipe/SealThingsRecipe.java index 99941f1f..45cd78c3 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/recipe/SealThingsRecipe.java +++ b/Common/src/main/java/at/petrak/hexcasting/common/recipe/SealThingsRecipe.java @@ -1,8 +1,8 @@ package at.petrak.hexcasting.common.recipe; import at.petrak.hexcasting.api.mod.HexTags; -import at.petrak.hexcasting.common.items.ItemFocus; -import at.petrak.hexcasting.common.items.ItemSpellbook; +import at.petrak.hexcasting.common.items.storage.ItemFocus; +import at.petrak.hexcasting.common.items.storage.ItemSpellbook; import at.petrak.hexcasting.common.lib.HexItems; import net.minecraft.resources.ResourceLocation; import net.minecraft.util.StringRepresentable; diff --git a/Common/src/main/resources/assets/hexcasting/lang/en_us.json b/Common/src/main/resources/assets/hexcasting/lang/en_us.json index d6fda312..eb047bbc 100644 --- a/Common/src/main/resources/assets/hexcasting/lang/en_us.json +++ b/Common/src/main/resources/assets/hexcasting/lang/en_us.json @@ -10,6 +10,7 @@ "item.hexcasting.warped_staff": "Warped Staff", "item.hexcasting.mangrove_staff": "Mangrove Staff", "item.hexcasting.edified_staff": "Edified Staff", + "item.hexcasting.thought_knot": "Thought-Knot", "item.hexcasting.focus": "Focus", "item.hexcasting.focus.sealed": "Sealed Focus", "item.hexcasting.spellbook": "Spellbook", diff --git a/Common/src/main/resources/assets/hexcasting/textures/item/thought_knot.png b/Common/src/main/resources/assets/hexcasting/textures/item/thought_knot.png new file mode 100644 index 0000000000000000000000000000000000000000..db2a0191aa760d388670eeb415361108bca2680c GIT binary patch literal 232 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`jKx9jP7LeL$-D$|7J0fjhFJ7& z4KfruY`{_c&g#hekGJ@L?0NdB-d2(SgNJ&RQG&YcsYxyhiVB*4m8;$}In2AVPlv(b z-tnKJr!4dB%flB2%`Pr{?KfF4($zb6QE$weNjkeq7PelW*QVb8P{!_V&5qeObFR-* zdG#(tc|zx(xGZ6Y$Mc*fIDP)}_E?95_pEt+oG~e$IxmiVF}e1x=ZW62Z(BFpO1{_n g6+AZ~B;_Ojw#)a{UfMgW5a?P4Pgg&ebxsLQ0GcskNdN!< literal 0 HcmV?d00001 diff --git a/Common/src/main/resources/assets/hexcasting/textures/item/thought_knot_overlay.png b/Common/src/main/resources/assets/hexcasting/textures/item/thought_knot_overlay.png new file mode 100644 index 0000000000000000000000000000000000000000..abc0d17e106199d52ee225f825194cff95f8da9e GIT binary patch literal 189 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`jKx9jP7LeL$-D$|$~|2iLo9mV zPEh1yHsoPh9?JZuE#SXN|4C*i-%tF(`xO-yq)zpl?lv{5!g=rJC`rA#XWOj5-J74r z*04J`+xDrvb!4cZ;4z6Ezm3Z8pVU+>I=6e`YbIl5r5VLSf*l;Ie$_G-%(xr1c*>?f m*FUkp`!_B0>*AV^>T$e|MoTWe=1~MXfx*+&&t;ucLK6T@Z$>Qu literal 0 HcmV?d00001 diff --git a/Fabric/src/generated/resources/.cache/03e4de26f1265135874f8cdcaebc09d9c08eb42b b/Fabric/src/generated/resources/.cache/03e4de26f1265135874f8cdcaebc09d9c08eb42b index 6c4f4c97..e84eed21 100644 --- a/Fabric/src/generated/resources/.cache/03e4de26f1265135874f8cdcaebc09d9c08eb42b +++ b/Fabric/src/generated/resources/.cache/03e4de26f1265135874f8cdcaebc09d9c08eb42b @@ -1,4 +1,4 @@ -// 1.19.2 2023-01-31T19:01:22.797440382 Tags for minecraft:item +// 1.19.2 2023-02-15T01:14:56.227341815 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 d9b94060..64515b52 100644 --- a/Fabric/src/generated/resources/.cache/67cce32b1c3cbbcb1f646605f4914e3f196986c2 +++ b/Fabric/src/generated/resources/.cache/67cce32b1c3cbbcb1f646605f4914e3f196986c2 @@ -1,4 +1,4 @@ -// 1.19.2 2023-01-31T19:01:22.799226001 LootTables +// 1.19.2 2023-02-15T01:14:56.222862371 LootTables dec1d3592e82f99d9e059d9c771530f103b2bda5 data/hexcasting/loot_tables/blocks/empty_directrix.json 2c42fc5d8c74c98ad15b8bd50f56541fccbef750 data/hexcasting/loot_tables/blocks/edified_tile.json cfb39e2151725fe4f9a7269d9b5de8031ea54a44 data/hexcasting/loot_tables/blocks/directrix_redstone.json diff --git a/Fabric/src/generated/resources/.cache/75bcd4dba6ca7d365462b0ec45e291d1056349c4 b/Fabric/src/generated/resources/.cache/75bcd4dba6ca7d365462b0ec45e291d1056349c4 index 50c7e562..e6647fcd 100644 --- a/Fabric/src/generated/resources/.cache/75bcd4dba6ca7d365462b0ec45e291d1056349c4 +++ b/Fabric/src/generated/resources/.cache/75bcd4dba6ca7d365462b0ec45e291d1056349c4 @@ -1,4 +1,4 @@ -// 1.19.2 2023-01-31T19:01:22.794241549 Tags for minecraft:block +// 1.19.2 2023-02-15T01:14:56.244629488 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 88edd941..ba4d8790 100644 --- a/Fabric/src/generated/resources/.cache/844611d4af49e23072b8a888c8e73c6c5d8c0768 +++ b/Fabric/src/generated/resources/.cache/844611d4af49e23072b8a888c8e73c6c5d8c0768 @@ -1,4 +1,4 @@ -// 1.19.2 2023-01-31T19:01:22.804380382 Tags for hexcasting:action +// 1.19.2 2023-02-15T01:14:56.245457869 Tags for hexcasting:action e5afc567ea17f035e4eb1d1d48825100b7f6ad68 data/hexcasting/tags/action/per_world_pattern.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 2492ade0..9d9a65a8 100644 --- a/Fabric/src/generated/resources/.cache/9fb1092f32d4fcbf9e061ffd718d4ec689c6c95e +++ b/Fabric/src/generated/resources/.cache/9fb1092f32d4fcbf9e061ffd718d4ec689c6c95e @@ -1,4 +1,4 @@ -// 1.19.2 2023-01-31T19:01:22.800310741 Recipes +// 1.19.2 2023-02-15T01:14:56.228330969 Recipes 9f75d3e93ecbbbf3ed9a92b2943397e09dcae1a9 data/hexcasting/recipes/dye_colorizer_light_blue.json 04569ccadfd99f203b0485d0c3e877209290f2b3 data/hexcasting/advancements/recipes/hexcasting.creative_tab/dye_colorizer_pink.json 2a9d4a0f3618abf9e9b8699b318a984d2c836913 data/hexcasting/advancements/recipes/brainsweep/brainsweep/directrix_redstone.json diff --git a/Forge/src/main/java/at/petrak/hexcasting/forge/datagen/xplat/HexItemModels.java b/Forge/src/main/java/at/petrak/hexcasting/forge/datagen/xplat/HexItemModels.java index a4dd87da..554533e7 100644 --- a/Forge/src/main/java/at/petrak/hexcasting/forge/datagen/xplat/HexItemModels.java +++ b/Forge/src/main/java/at/petrak/hexcasting/forge/datagen/xplat/HexItemModels.java @@ -1,13 +1,14 @@ package at.petrak.hexcasting.forge.datagen.xplat; import at.petrak.hexcasting.api.HexAPI; -import at.petrak.hexcasting.common.items.ItemFocus; -import at.petrak.hexcasting.common.items.ItemScroll; -import at.petrak.hexcasting.common.items.ItemSlate; import at.petrak.hexcasting.common.items.ItemStaff; import at.petrak.hexcasting.common.items.colorizer.ItemPrideColorizer; import at.petrak.hexcasting.common.items.magic.ItemMediaBattery; import at.petrak.hexcasting.common.items.magic.ItemPackagedHex; +import at.petrak.hexcasting.common.items.storage.ItemFocus; +import at.petrak.hexcasting.common.items.storage.ItemScroll; +import at.petrak.hexcasting.common.items.storage.ItemSlate; +import at.petrak.hexcasting.common.items.storage.ItemThoughtKnot; import at.petrak.hexcasting.common.lib.HexBlocks; import at.petrak.hexcasting.common.lib.HexItems; import at.petrak.paucal.api.forge.datagen.PaucalItemModelProvider; @@ -88,6 +89,7 @@ public class HexItemModels extends PaucalItemModelProvider { simpleItem(modLoc("patchouli_book")); + buildThoughtKnot(); buildSealableIotaHolder(HexItems.FOCUS, "focus"); buildSealableIotaHolder(HexItems.SPELLBOOK, "spellbook"); @@ -161,6 +163,19 @@ public class HexItemModels extends PaucalItemModelProvider { .parent(new ModelFile.UncheckedModelFile(modLoc("block/edified_pressure_plate"))); } + private void buildThoughtKnot() { + var unwritten = singleTexture("thought_knot", new ResourceLocation("item/generated"), + "layer0", modLoc("item/thought_knot")); + var written = withExistingParent("thought_knot_written", new ResourceLocation("item/generated")) + .texture("layer0", modLoc("item/thought_knot")) + .texture("layer1", modLoc("item/thought_knot_overlay")); + getBuilder("thought_knot") + .override().predicate(ItemThoughtKnot.WRITTEN_PRED, 0f) + .model(unwritten).end() + .override().predicate(ItemThoughtKnot.WRITTEN_PRED, 1f) + .model(written).end(); + } + private void buildSealableIotaHolder(Item item, String stub) { var name = getPath(item); var plain = singleTexture(name, new ResourceLocation("item/generated"), From 588a554efa436138ba067f9f608b1a10e2ca7c63 Mon Sep 17 00:00:00 2001 From: "petrak@" Date: Wed, 15 Feb 2023 02:21:48 -0600 Subject: [PATCH 73/95] document and add recipe for thought knots --- .../datagen/recipe/HexplatRecipes.java | 5 +++ .../assets/hexcasting/lang/en_us.json | 16 +++++++--- .../thehexbook/en_us/entries/items/lens.json | 3 +- .../en_us/entries/items/thought_knot.json | 27 ++++++++++++++++ .../03e4de26f1265135874f8cdcaebc09d9c08eb42b | 2 +- .../67cce32b1c3cbbcb1f646605f4914e3f196986c2 | 2 +- .../75bcd4dba6ca7d365462b0ec45e291d1056349c4 | 2 +- .../844611d4af49e23072b8a888c8e73c6c5d8c0768 | 2 +- .../9fb1092f32d4fcbf9e061ffd718d4ec689c6c95e | 4 ++- .../hexcasting.creative_tab/thought_knot.json | 32 +++++++++++++++++++ .../data/hexcasting/recipes/thought_knot.json | 14 ++++++++ .../9fb1092f32d4fcbf9e061ffd718d4ec689c6c95e | 4 ++- .../recipes/hexcasting/thought_knot.json | 32 +++++++++++++++++++ .../data/hexcasting/recipes/thought_knot.json | 14 ++++++++ 14 files changed, 147 insertions(+), 12 deletions(-) create mode 100644 Common/src/main/resources/data/hexcasting/patchouli_books/thehexbook/en_us/entries/items/thought_knot.json create mode 100644 Fabric/src/generated/resources/data/hexcasting/advancements/recipes/hexcasting.creative_tab/thought_knot.json create mode 100644 Fabric/src/generated/resources/data/hexcasting/recipes/thought_knot.json create mode 100644 Forge/src/generated/resources/data/hexcasting/advancements/recipes/hexcasting/thought_knot.json create mode 100644 Forge/src/generated/resources/data/hexcasting/recipes/thought_knot.json diff --git a/Common/src/main/java/at/petrak/hexcasting/datagen/recipe/HexplatRecipes.java b/Common/src/main/java/at/petrak/hexcasting/datagen/recipe/HexplatRecipes.java index fdab8d4c..6fb213a3 100644 --- a/Common/src/main/java/at/petrak/hexcasting/datagen/recipe/HexplatRecipes.java +++ b/Common/src/main/java/at/petrak/hexcasting/datagen/recipe/HexplatRecipes.java @@ -71,6 +71,11 @@ public class HexplatRecipes extends PaucalRecipeProvider { staffRecipe(recipes, HexItems.STAFF_MANGROVE, Items.MANGROVE_PLANKS); staffRecipe(recipes, HexItems.STAFF_EDIFIED, HexBlocks.EDIFIED_PLANKS.asItem()); + ShapelessRecipeBuilder.shapeless(HexItems.THOUGHT_KNOT) + .requires(HexItems.AMETHYST_DUST) + .requires(Items.STRING) + .unlockedBy("has_item", hasItem(HexTags.Items.STAVES)) + .save(recipes); ShapedRecipeBuilder.shaped(HexItems.FOCUS) .define('G', ingredients.glowstoneDust()) .define('L', ingredients.leather()) diff --git a/Common/src/main/resources/assets/hexcasting/lang/en_us.json b/Common/src/main/resources/assets/hexcasting/lang/en_us.json index eb047bbc..1c2e71a0 100644 --- a/Common/src/main/resources/assets/hexcasting/lang/en_us.json +++ b/Common/src/main/resources/assets/hexcasting/lang/en_us.json @@ -752,17 +752,23 @@ "hexcasting.entry.lens": "Scrying Lens", "hexcasting.page.lens.1": "_Media can have peculiar effects on any type of information, in specific circumstances. Coating a glass in a thin film of it can lead to ... elucidating insights.$(br2)By holding a $(l:items/lens)$(item)Scrying Lens/$ in my hand, certain blocks will display additional information when I look at them.", - "hexcasting.page.lens.2": "For example, looking at a piece of $(item)Redstone/$ will display its signal strength. I suspect I will discover other blocks with additional insight as my studies into my art progress.$(br2)In addition, holding it while casting using a $(l:items/staff)$(item)Staff/$ will shrink the spacing between dots, allowing me to draw more on my grid.$(br2)I can also wear it on my head as a strange sort of monocle. This reveals information, but won't shrink my grid. No matter. There must be a way to have both...", + "hexcasting.page.lens.2": "For example, looking at a piece of $(item)Redstone/$ will display its signal strength. I suspect I will discover other blocks with additional insight as my studies into my art progress.$(br2)In addition, holding it while casting using a $(l:items/staff)$(item)Staff/$ will shrink the spacing between dots, allowing me to draw more on my grid.$(br2)I can also wear it on my head as a strange sort of monocle.", "hexcasting.page.lens.crafting.desc": "$(italic)You must learn... to see what you are looking at./$", + "hexcasting.entry.thought_knot": "Thought-Knot", + "hexcasting.page.thought_knot.1": "The forgetful often tie a piece of string about their finger to help them remember something important. I believe this idea might be of use in my art. A specially knotted piece of string should be able to hold a single iota stably, irregardless of my stack.$(br2)I will call my invention a $(item)Thought-Knot/$.", + "hexcasting.page.thought_knot.2": "When I craft it, it stores no iota. Using $(l:patterns/readwrite#hexcasting:write)$(action)Scribe's Gambit/$ while holding a $(item)Thought-Knot/$ in my other hand will remove the top of the stack and save it into the $(item)Thought-Knot/$. Using $(l:patterns/readwrite#hexcasting:read)$(action)Scribe's Reflection/$ will copy whatever iota's in the $(item)Thought-Knot/$ and add it to the stack.$(br2)Once a $(item)Thought-Knot/$ has been written to, the string is indelibly tangled; the iota can be read any number of times, but there is no way to erase or overwrite it. Fortunately, they are not expensive.", + "hexcasting.page.thought_knot.3": "Also, if I store an entity in a $(item)Thought-Knot/$ and try to recall it after the referenced entity has died or otherwise disappeared, the $(l:patterns/readwrite#hexcasting:read)$(action)Scribe's Reflection/$ will add $(l:casting/influences)$(thing)Null/$ to the stack instead.", + "hexcasting.page.thought_knot.crafting.desc": "$(italic)How would you feel if someone saw you wearing a sign that said, \"I am dashing and handsome?\"/$", + "hexcasting.entry.focus": "Focus", - "hexcasting.page.focus.1": "A $(l:items/focus)$(item)Focus/$ can store a single iota.$(br2)When I craft it, it holds the $(l:casting/influences)$(thing)Null/$ influence by default. Using $(l:patterns/readwrite#hexcasting:write)$(action)Scribe's Gambit/$ while holding a $(l:items/focus)$(item)Focus/$ in my other hand will remove the top of the stack and save it into the $(l:items/focus)$(item)Focus/$. Using $(l:patterns/readwrite#hexcasting:read)$(action)Scribe's Reflection/$ will copy whatever iota's in the $(l:items/focus)$(item)Focus/$ and add it to the stack.", - "hexcasting.page.focus.2": "It occurs to me that I could conceivably store a whole list of patterns in a $(l:items/focus)$(item)Focus/$, then recall them and evaluate them with $(l:patterns/meta#hexcasting:eval)$(action)Hermes' Gambit/$. This way I can cast complex spells, or parts of spells, without having to draw them over and over.$(br2)I could use this like a slightly less convenient $(l:items/hexcasting#artifact)$(item)Artifact/$, but I think I could get much better dividends by putting common \"phrases\" in a $(l:items/focus)$(item)Focus/$, like the patterns for figuring out where I'm looking.", - "hexcasting.page.focus.3": "Also, if I store an entity in a $(l:items/focus)$(item)Focus/$ and try to recall it after the referenced entity has died or otherwise disappeared, the $(l:patterns/readwrite#hexcasting:read)$(action)Scribe's Reflection/$ will add $(l:casting/influences)$(thing)Null/$ to the stack instead.$(br2)Finally, it seems if I wish to protect a $(l:items/focus)$(item)focus/$ from accidentally being overwritten, I can seal it with wax by crafting it with a $(item)Honeycomb/$. Attempting to use $(l:patterns/readwrite#hexcasting:write)$(action)Scribe's Gambit/$ on a sealed focus will fail. $(l:patterns/spells/hexcasting#hexcasting:erase)$(action)Erase Item/$ will remove this seal along with the contents.", + "hexcasting.page.focus.1": "A $(item)Focus/$ is like a $(l:items/thought_knot)$(item)Thought-Knot/$, in that iota can be written to or read from it. However, the advantage of a focus is that it is $(italic)reusable/$. If I make a mistake in the iota I write to a $(item)Focus, I can simply cast $(l:patterns/readwrite#hexcasting:write)$(action)Scribe's Gambit/$ again and write over the iota inside.", + "hexcasting.page.focus.2": "If I wish to protect a $(l:items/focus)$(item)focus/$ from accidentally being overwritten, I can seal it with wax by crafting it with a $(item)Honeycomb/$. Attempting to use $(l:patterns/readwrite#hexcasting:write)$(action)Scribe's Gambit/$ on a sealed focus will fail.$(br2)$(l:patterns/spells/hexcasting#hexcasting:erase)$(action)Erase Item/$ will remove this seal along with the contents.", + "hexcasting.page.focus.3": "Indeed, the only advantage of my $(l:items/thought_knot)$(item)Thought-Knot/$s have over $(item)Foci/$ is that $(item)Foci/$ are more expensive to produce. My research indicates that the early practitioners of the art used exclusively $(item)Foci/$, with the $(l:items/thought_knot)$(item)Thought-Knot/$ being an original creation of mine.$(br2)Whoever those ancient people were, they must have been very prosperous.", "hexcasting.page.focus.crafting.desc": "$(italic)Poison apples, poison worms./$", "hexcasting.entry.abacus": "Abacus", - "hexcasting.page.abacus.1": "Although there are $(l:patterns/numbers)$(action)patterns for drawing numbers/$, I find them ... cumbersome, to say the least.$(br2)Fortunately, the old masters of my craft invented an ingenious device called an $(l:items/abacus)$(item)Abacus/$ to provide numbers to my casting. I simply set the number to what I want, then read the value using $(l:patterns/readwrite#hexcasting:read)$(action)Scribe's Reflection/$, just like I would read a $(l:items/focus)$(item)Focus/$.", + "hexcasting.page.abacus.1": "Although there are $(l:patterns/numbers)$(action)patterns for drawing numbers/$, I find them ... cumbersome, to say the least.$(br2)Fortunately, the old masters of my craft invented an ingenious device called an $(l:items/abacus)$(item)Abacus/$ to provide numbers to my casting. I simply set the number to what I want, then read the value using $(l:patterns/readwrite#hexcasting:read)$(action)Scribe's Reflection/$, just like I would read a $(l:items/thought_knot)$(item)Thought-Knot/$ or $(l:items/focus)$(item)Focus/$.", "hexcasting.page.abacus.2": "To operate one, I simply hold it, sneak, and scroll. If in my main hand, the number will increment or decrement by 1, or 10 if I am also holding Control/Command. If in my off hand, the number will increment or decrement by 0.1, or 0.001 if I am also holding Control/Command.$(br2)I can shake the abacus to reset it to zero by sneak-right-clicking.", "hexcasting.page.abacus.crafting.desc": "$(italic)Mathematics? That's for eggheads!/$", diff --git a/Common/src/main/resources/data/hexcasting/patchouli_books/thehexbook/en_us/entries/items/lens.json b/Common/src/main/resources/data/hexcasting/patchouli_books/thehexbook/en_us/entries/items/lens.json index 9bdadb99..857a7b54 100644 --- a/Common/src/main/resources/data/hexcasting/patchouli_books/thehexbook/en_us/entries/items/lens.json +++ b/Common/src/main/resources/data/hexcasting/patchouli_books/thehexbook/en_us/entries/items/lens.json @@ -3,7 +3,8 @@ "icon": "hexcasting:lens", "category": "hexcasting:items", "advancement": "hexcasting:root", - "sortnum": 0, + "priority": true, + "sortnum": 2, "pages": [ { "type": "patchouli:text", diff --git a/Common/src/main/resources/data/hexcasting/patchouli_books/thehexbook/en_us/entries/items/thought_knot.json b/Common/src/main/resources/data/hexcasting/patchouli_books/thehexbook/en_us/entries/items/thought_knot.json new file mode 100644 index 00000000..c9eb1f15 --- /dev/null +++ b/Common/src/main/resources/data/hexcasting/patchouli_books/thehexbook/en_us/entries/items/thought_knot.json @@ -0,0 +1,27 @@ +{ + "name": "hexcasting.entry.thought_knot", + "icon": "hexcasting:thought_knot", + "category": "hexcasting:items", + "sortnum": 4, + "priority": true, + "advancement": "hexcasting:root", + "pages": [ + { + "type": "patchouli:text", + "text": "hexcasting.page.thought_knot.1" + }, + { + "type": "patchouli:text", + "text": "hexcasting.page.thought_knot.2" + }, + { + "type": "patchouli:text", + "text": "hexcasting.page.thought_knot.3" + }, + { + "type": "patchouli:crafting", + "recipe": "hexcasting:thought_knot", + "text": "hexcasting.page.thought_knot.crafting.desc" + } + ] +} diff --git a/Fabric/src/generated/resources/.cache/03e4de26f1265135874f8cdcaebc09d9c08eb42b b/Fabric/src/generated/resources/.cache/03e4de26f1265135874f8cdcaebc09d9c08eb42b index e84eed21..b8671655 100644 --- a/Fabric/src/generated/resources/.cache/03e4de26f1265135874f8cdcaebc09d9c08eb42b +++ b/Fabric/src/generated/resources/.cache/03e4de26f1265135874f8cdcaebc09d9c08eb42b @@ -1,4 +1,4 @@ -// 1.19.2 2023-02-15T01:14:56.227341815 Tags for minecraft:item +// 1.19.2 2023-02-15T02:11:12.160530576 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 64515b52..1b307cfd 100644 --- a/Fabric/src/generated/resources/.cache/67cce32b1c3cbbcb1f646605f4914e3f196986c2 +++ b/Fabric/src/generated/resources/.cache/67cce32b1c3cbbcb1f646605f4914e3f196986c2 @@ -1,4 +1,4 @@ -// 1.19.2 2023-02-15T01:14:56.222862371 LootTables +// 1.19.2 2023-02-15T02:11:12.129277989 LootTables dec1d3592e82f99d9e059d9c771530f103b2bda5 data/hexcasting/loot_tables/blocks/empty_directrix.json 2c42fc5d8c74c98ad15b8bd50f56541fccbef750 data/hexcasting/loot_tables/blocks/edified_tile.json cfb39e2151725fe4f9a7269d9b5de8031ea54a44 data/hexcasting/loot_tables/blocks/directrix_redstone.json diff --git a/Fabric/src/generated/resources/.cache/75bcd4dba6ca7d365462b0ec45e291d1056349c4 b/Fabric/src/generated/resources/.cache/75bcd4dba6ca7d365462b0ec45e291d1056349c4 index e6647fcd..404dc4f5 100644 --- a/Fabric/src/generated/resources/.cache/75bcd4dba6ca7d365462b0ec45e291d1056349c4 +++ b/Fabric/src/generated/resources/.cache/75bcd4dba6ca7d365462b0ec45e291d1056349c4 @@ -1,4 +1,4 @@ -// 1.19.2 2023-02-15T01:14:56.244629488 Tags for minecraft:block +// 1.19.2 2023-02-15T02:11:12.162941713 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 ba4d8790..d7b57144 100644 --- a/Fabric/src/generated/resources/.cache/844611d4af49e23072b8a888c8e73c6c5d8c0768 +++ b/Fabric/src/generated/resources/.cache/844611d4af49e23072b8a888c8e73c6c5d8c0768 @@ -1,4 +1,4 @@ -// 1.19.2 2023-02-15T01:14:56.245457869 Tags for hexcasting:action +// 1.19.2 2023-02-15T02:11:12.177979068 Tags for hexcasting:action e5afc567ea17f035e4eb1d1d48825100b7f6ad68 data/hexcasting/tags/action/per_world_pattern.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 9d9a65a8..75b2a87e 100644 --- a/Fabric/src/generated/resources/.cache/9fb1092f32d4fcbf9e061ffd718d4ec689c6c95e +++ b/Fabric/src/generated/resources/.cache/9fb1092f32d4fcbf9e061ffd718d4ec689c6c95e @@ -1,4 +1,4 @@ -// 1.19.2 2023-02-15T01:14:56.228330969 Recipes +// 1.19.2 2023-02-15T02:11:12.164022928 Recipes 9f75d3e93ecbbbf3ed9a92b2943397e09dcae1a9 data/hexcasting/recipes/dye_colorizer_light_blue.json 04569ccadfd99f203b0485d0c3e877209290f2b3 data/hexcasting/advancements/recipes/hexcasting.creative_tab/dye_colorizer_pink.json 2a9d4a0f3618abf9e9b8699b318a984d2c836913 data/hexcasting/advancements/recipes/brainsweep/brainsweep/directrix_redstone.json @@ -21,6 +21,7 @@ e0609202271e402d8ae58e4f8eaf11dcdda10a9e data/hexcasting/recipes/brainsweep/akas 1b210391768fede639b29ae6fc5adf2b8b4e64c6 data/hexcasting/advancements/recipes/hexcasting.creative_tab/dye_colorizer_brown.json cd22886924e7aaeb62e8f7da0747cc950af9dc32 data/hexcasting/advancements/recipes/hexcasting.creative_tab/pride_colorizer_plural.json 6c54952ecbb6899f3291fe72486e7205e6ab76cc data/hexcasting/recipes/pride_colorizer_intersex.json +2589d3a202f24b2f4f78d90ee3e3ad7961eea023 data/hexcasting/advancements/recipes/hexcasting.creative_tab/thought_knot.json 709232dd093e48895014957f2e4ff5a1a76da583 data/create/recipes/crushing/amethyst_cluster.json ad390fe854110e60aec4c805f7bb5fed45b4e5d1 data/hexcasting/advancements/recipes/hexcasting.creative_tab/amethyst_tiles.json 0ed898da60aa78cd526ff4ae0524359891dbd976 data/hexcasting/advancements/recipes/hexcasting.creative_tab/edified_tile.json @@ -37,6 +38,7 @@ ce0cd4d73792c30dcec2eea306bff44b28cb237f data/hexcasting/recipes/pride_colorizer 4f301e8e812f409be41cfddfa74b1fb7c8034edf data/hexcasting/advancements/recipes/hexcasting.creative_tab/dye_colorizer_purple.json f75c21d35b926a2303d60115a297c387790bbbd9 data/hexcasting/advancements/recipes/hexcasting.creative_tab/edified_trapdoor.json 3b83dd1c1aa1bcc58e6512bca75c3a6a3b7482b3 data/hexcasting/recipes/edified_tile.json +81132fbb6784ed15721aff520964988c1d5be06b data/hexcasting/recipes/thought_knot.json f48c2df6c0981b959c2e1b0bf8ecc4739b2e034f data/hexcasting/advancements/recipes/brainsweep/brainsweep/impetus_look.json b21a84886b937a4c4e72a674f265dccb21411ab9 data/hexcasting/advancements/recipes/hexcasting.creative_tab/focus_rotated.json 0c72527448454438308ba5a4e99452b193fad421 data/hexcasting/recipes/dye_colorizer_gray.json diff --git a/Fabric/src/generated/resources/data/hexcasting/advancements/recipes/hexcasting.creative_tab/thought_knot.json b/Fabric/src/generated/resources/data/hexcasting/advancements/recipes/hexcasting.creative_tab/thought_knot.json new file mode 100644 index 00000000..7d363228 --- /dev/null +++ b/Fabric/src/generated/resources/data/hexcasting/advancements/recipes/hexcasting.creative_tab/thought_knot.json @@ -0,0 +1,32 @@ +{ + "parent": "minecraft:recipes/root", + "criteria": { + "has_item": { + "conditions": { + "items": [ + { + "tag": "hexcasting:staves" + } + ] + }, + "trigger": "minecraft:inventory_changed" + }, + "has_the_recipe": { + "conditions": { + "recipe": "hexcasting:thought_knot" + }, + "trigger": "minecraft:recipe_unlocked" + } + }, + "requirements": [ + [ + "has_item", + "has_the_recipe" + ] + ], + "rewards": { + "recipes": [ + "hexcasting:thought_knot" + ] + } +} \ No newline at end of file diff --git a/Fabric/src/generated/resources/data/hexcasting/recipes/thought_knot.json b/Fabric/src/generated/resources/data/hexcasting/recipes/thought_knot.json new file mode 100644 index 00000000..13962130 --- /dev/null +++ b/Fabric/src/generated/resources/data/hexcasting/recipes/thought_knot.json @@ -0,0 +1,14 @@ +{ + "type": "minecraft:crafting_shapeless", + "ingredients": [ + { + "item": "hexcasting:amethyst_dust" + }, + { + "item": "minecraft:string" + } + ], + "result": { + "item": "hexcasting:thought_knot" + } +} \ No newline at end of file diff --git a/Forge/src/generated/resources/.cache/9fb1092f32d4fcbf9e061ffd718d4ec689c6c95e b/Forge/src/generated/resources/.cache/9fb1092f32d4fcbf9e061ffd718d4ec689c6c95e index 275e2cf4..6cbdc084 100644 --- a/Forge/src/generated/resources/.cache/9fb1092f32d4fcbf9e061ffd718d4ec689c6c95e +++ b/Forge/src/generated/resources/.cache/9fb1092f32d4fcbf9e061ffd718d4ec689c6c95e @@ -1,4 +1,4 @@ -// 1.19.2 2023-01-22T20:49:42.813938013 Recipes +// 1.19.2 2023-02-15T02:10:16.055363304 Recipes 29056d8bbc023668564ee81f4eb8b2a11411cf4a data/create/recipes/crushing/amethyst_block.json 5bb0b70967a422bfd88c01fa1af64e9b98781fd1 data/create/recipes/crushing/amethyst_cluster.json 229931adf8d62f659de5950d711afd24fb5aa535 data/hexcasting/advancements/recipes/brainsweep/brainsweep/akashic_record.json @@ -90,6 +90,7 @@ f0a77ba758e649d0c16a8e2d9964d18f95a544f4 data/hexcasting/advancements/recipes/he 9c8503715195c4cb2e2d9a1abe4f94df7bb9f4b5 data/hexcasting/advancements/recipes/hexcasting/stonecutting/amethyst_tiles.json 63da3af421dfb38283d750eb3b9761f42e95fb91 data/hexcasting/advancements/recipes/hexcasting/stripped_edified_wood.json e0e49c8a9977fe2b0619179b11a4379b5b19ace9 data/hexcasting/advancements/recipes/hexcasting/sub_sandwich.json +2589d3a202f24b2f4f78d90ee3e3ad7961eea023 data/hexcasting/advancements/recipes/hexcasting/thought_knot.json 993a613fabd0ee1005bde11ebe92f8046351ba9e data/hexcasting/advancements/recipes/hexcasting/trinket.json 4440b41499c9c32e297dc184c39da010ff82ac5e data/hexcasting/advancements/recipes/hexcasting/uuid_colorizer.json dc2a9bf96ca9d04ea6bdeb32249322530b5e1cbf data/hexcasting/advancements/recipes/hexcasting/warped_staff.json @@ -189,6 +190,7 @@ f0852056a692d776bf537c821f3d166c2be88bd8 data/hexcasting/recipes/spruce_staff.js 3608f0ec056f2c5d29a9a89305218497fd2c4383 data/hexcasting/recipes/stonecutting/amethyst_tiles.json 0859373b9e60e80f3c8b0962a3bc94903af43d36 data/hexcasting/recipes/stripped_edified_wood.json 13ca24f9f87a6b34f7717e5c326291079e6db96f data/hexcasting/recipes/sub_sandwich.json +81132fbb6784ed15721aff520964988c1d5be06b data/hexcasting/recipes/thought_knot.json 42ab683499c3b0f7ae594879490a37eb6aff9703 data/hexcasting/recipes/trinket.json ffba0344dfc7f604e8e33a333549f74c53f3e7e6 data/hexcasting/recipes/uuid_colorizer.json 4ffed306e5f640054a6f269ae0e548388f087996 data/hexcasting/recipes/warped_staff.json diff --git a/Forge/src/generated/resources/data/hexcasting/advancements/recipes/hexcasting/thought_knot.json b/Forge/src/generated/resources/data/hexcasting/advancements/recipes/hexcasting/thought_knot.json new file mode 100644 index 00000000..7d363228 --- /dev/null +++ b/Forge/src/generated/resources/data/hexcasting/advancements/recipes/hexcasting/thought_knot.json @@ -0,0 +1,32 @@ +{ + "parent": "minecraft:recipes/root", + "criteria": { + "has_item": { + "conditions": { + "items": [ + { + "tag": "hexcasting:staves" + } + ] + }, + "trigger": "minecraft:inventory_changed" + }, + "has_the_recipe": { + "conditions": { + "recipe": "hexcasting:thought_knot" + }, + "trigger": "minecraft:recipe_unlocked" + } + }, + "requirements": [ + [ + "has_item", + "has_the_recipe" + ] + ], + "rewards": { + "recipes": [ + "hexcasting:thought_knot" + ] + } +} \ No newline at end of file diff --git a/Forge/src/generated/resources/data/hexcasting/recipes/thought_knot.json b/Forge/src/generated/resources/data/hexcasting/recipes/thought_knot.json new file mode 100644 index 00000000..13962130 --- /dev/null +++ b/Forge/src/generated/resources/data/hexcasting/recipes/thought_knot.json @@ -0,0 +1,14 @@ +{ + "type": "minecraft:crafting_shapeless", + "ingredients": [ + { + "item": "hexcasting:amethyst_dust" + }, + { + "item": "minecraft:string" + } + ], + "result": { + "item": "hexcasting:thought_knot" + } +} \ No newline at end of file From 88a0234cec7d64ecfc5874252c2c5e0fa733811d Mon Sep 17 00:00:00 2001 From: "petrak@" Date: Wed, 15 Feb 2023 19:14:26 -0600 Subject: [PATCH 74/95] not sure if this is a good look? might go with a BER after all --- .../d2fe5b6fab5fdc7ee7ca336c062752306bdf6128 | 10 +- .../models/block/quenched_allay_0.json | 6 + .../models/block/quenched_allay_1.json | 6 + .../models/block/quenched_allay_2.json | 6 + .../models/block/quenched_allay_3.json | 6 + .../models/item/quenched_allay_0.json | 3 + .../models/item/quenched_allay_1.json | 3 + .../models/item/quenched_allay_2.json | 3 + .../models/item/quenched_allay_3.json | 3 + .../petrak/hexcasting/GaslightingModel.java | 69 ++++ .../hexcasting/client/ClientTickCounter.java | 4 +- .../client/RegisterClientStuff.java | 307 ++---------------- .../client/ScryingLensOverlays.java | 288 ++++++++++++++++ .../common/blocks/BlockQuenchedAllay.java | 11 + .../hexcasting/common/lib/HexBlocks.java | 4 + .../textures/block/quenched_allay.png | Bin 0 -> 191 bytes .../textures/block/quenched_allay_0.png | Bin 0 -> 396 bytes .../textures/block/quenched_allay_1.png | Bin 0 -> 399 bytes .../textures/block/quenched_allay_2.png | Bin 0 -> 411 bytes .../textures/block/quenched_allay_3.png | Bin 0 -> 410 bytes .../fabric/FabricHexClientInitializer.kt | 2 + .../mixin/client/FabricModelManagerMixin.java | 32 ++ .../forge/ForgeHexClientInitializer.java | 12 + .../xplat/HexBlockStatesAndModels.java | 11 +- 24 files changed, 506 insertions(+), 280 deletions(-) create mode 100644 Common/src/generated/resources/assets/hexcasting/models/block/quenched_allay_0.json create mode 100644 Common/src/generated/resources/assets/hexcasting/models/block/quenched_allay_1.json create mode 100644 Common/src/generated/resources/assets/hexcasting/models/block/quenched_allay_2.json create mode 100644 Common/src/generated/resources/assets/hexcasting/models/block/quenched_allay_3.json create mode 100644 Common/src/generated/resources/assets/hexcasting/models/item/quenched_allay_0.json create mode 100644 Common/src/generated/resources/assets/hexcasting/models/item/quenched_allay_1.json create mode 100644 Common/src/generated/resources/assets/hexcasting/models/item/quenched_allay_2.json create mode 100644 Common/src/generated/resources/assets/hexcasting/models/item/quenched_allay_3.json create mode 100644 Common/src/main/java/at/petrak/hexcasting/GaslightingModel.java create mode 100644 Common/src/main/java/at/petrak/hexcasting/client/ScryingLensOverlays.java create mode 100644 Common/src/main/java/at/petrak/hexcasting/common/blocks/BlockQuenchedAllay.java create mode 100644 Common/src/main/resources/assets/hexcasting/textures/block/quenched_allay.png create mode 100644 Common/src/main/resources/assets/hexcasting/textures/block/quenched_allay_0.png create mode 100644 Common/src/main/resources/assets/hexcasting/textures/block/quenched_allay_1.png create mode 100644 Common/src/main/resources/assets/hexcasting/textures/block/quenched_allay_2.png create mode 100644 Common/src/main/resources/assets/hexcasting/textures/block/quenched_allay_3.png create mode 100644 Fabric/src/main/java/at/petrak/hexcasting/fabric/mixin/client/FabricModelManagerMixin.java diff --git a/Common/src/generated/resources/.cache/d2fe5b6fab5fdc7ee7ca336c062752306bdf6128 b/Common/src/generated/resources/.cache/d2fe5b6fab5fdc7ee7ca336c062752306bdf6128 index 21019dee..5c2e0ed1 100644 --- a/Common/src/generated/resources/.cache/d2fe5b6fab5fdc7ee7ca336c062752306bdf6128 +++ b/Common/src/generated/resources/.cache/d2fe5b6fab5fdc7ee7ca336c062752306bdf6128 @@ -1,4 +1,4 @@ -// 1.19.2 2022-11-05T14:30:43.69127 Block States: hexcasting +// 1.19.2 2023-02-15T18:25:55.007347158 Block States: hexcasting 901e38574bdaa40ea4a0f6e773a88a95d9c03e55 assets/hexcasting/blockstates/akashic_bookshelf.json 32a77ef668198002563d68be35a24fa93c8d454a assets/hexcasting/blockstates/akashic_connector.json 85080ce0a0387583a839e4788517d675a1a35e24 assets/hexcasting/blockstates/akashic_record.json @@ -134,6 +134,10 @@ de2a5fd9b621e5086852f2191c360d9274b9b10c assets/hexcasting/models/block/impetus_ 7ac5cb74f321b061c1e93b859540b508c7dcdaa4 assets/hexcasting/models/block/impetus_storedplayer_lit_south.json 46c29660e3fa78aeaa264268b43017f4b0c0d655 assets/hexcasting/models/block/impetus_storedplayer_lit_up.json 4d22557274958179da4671c43c2f387336a701a2 assets/hexcasting/models/block/impetus_storedplayer_lit_west.json +9af2754cb1e53eeaa85618cf92651b4878cf62b1 assets/hexcasting/models/block/quenched_allay_0.json +de4ff723b4332d4e26bd01f74e0485e28c9a2178 assets/hexcasting/models/block/quenched_allay_1.json +4c29163e07f3a903017e38a9cc102f4b37db20b1 assets/hexcasting/models/block/quenched_allay_2.json +487d34cd8e70b3e468337228b74af5c1b4d14c53 assets/hexcasting/models/block/quenched_allay_3.json e1e7ce0bcc08a53b3e6634f7e5b7a6cf488cf45b assets/hexcasting/models/block/redstone_directrix_powered_dim_down.json fb22e529f1ca638b7e952176694ab1912eb4274b assets/hexcasting/models/block/redstone_directrix_powered_dim_east.json a5a53ec6a3cd54592dcb224245a4515a2b3b72ed assets/hexcasting/models/block/redstone_directrix_powered_dim_north.json @@ -185,6 +189,10 @@ d4a109488c27fc5d60e9054cd1485f1982040ff3 assets/hexcasting/models/item/ancient_s 40e22b81ff5a65154cbb82e2a17a19abbc898e63 assets/hexcasting/models/item/impetus_look.json 485b2fdbe038c1671f7d67747e8d640a2f171266 assets/hexcasting/models/item/impetus_rightclick.json 064caa7c4c05c5f0736fe09745ad42eb4515e767 assets/hexcasting/models/item/impetus_storedplayer.json +bab05b6c9632359d9a2961221d18bf63abccf803 assets/hexcasting/models/item/quenched_allay_0.json +2df419ac393b73acc2c679394d89b38db5af4b04 assets/hexcasting/models/item/quenched_allay_1.json +9e0bcaf7d32799af125ce3487f8a6cdd03bf7c49 assets/hexcasting/models/item/quenched_allay_2.json +da748fddb87f4130b21a30f70f11159f98b0125d assets/hexcasting/models/item/quenched_allay_3.json 769dcfb4a504e4dcd28a43cf603a18c66f57e594 assets/hexcasting/models/item/scroll_paper.json 222e40e5754f5cb5a04321c4ed4cee27748c9224 assets/hexcasting/models/item/scroll_paper_lantern.json 145db42b0d90bdb4fd82f5a7eea229be4c0f9675 assets/hexcasting/models/item/slate_block.json diff --git a/Common/src/generated/resources/assets/hexcasting/models/block/quenched_allay_0.json b/Common/src/generated/resources/assets/hexcasting/models/block/quenched_allay_0.json new file mode 100644 index 00000000..6c2a8abe --- /dev/null +++ b/Common/src/generated/resources/assets/hexcasting/models/block/quenched_allay_0.json @@ -0,0 +1,6 @@ +{ + "parent": "minecraft:block/cube_all", + "textures": { + "all": "hexcasting:block/quenched_allay_0" + } +} \ No newline at end of file diff --git a/Common/src/generated/resources/assets/hexcasting/models/block/quenched_allay_1.json b/Common/src/generated/resources/assets/hexcasting/models/block/quenched_allay_1.json new file mode 100644 index 00000000..441d9105 --- /dev/null +++ b/Common/src/generated/resources/assets/hexcasting/models/block/quenched_allay_1.json @@ -0,0 +1,6 @@ +{ + "parent": "minecraft:block/cube_all", + "textures": { + "all": "hexcasting:block/quenched_allay_1" + } +} \ No newline at end of file diff --git a/Common/src/generated/resources/assets/hexcasting/models/block/quenched_allay_2.json b/Common/src/generated/resources/assets/hexcasting/models/block/quenched_allay_2.json new file mode 100644 index 00000000..a561a358 --- /dev/null +++ b/Common/src/generated/resources/assets/hexcasting/models/block/quenched_allay_2.json @@ -0,0 +1,6 @@ +{ + "parent": "minecraft:block/cube_all", + "textures": { + "all": "hexcasting:block/quenched_allay_2" + } +} \ No newline at end of file diff --git a/Common/src/generated/resources/assets/hexcasting/models/block/quenched_allay_3.json b/Common/src/generated/resources/assets/hexcasting/models/block/quenched_allay_3.json new file mode 100644 index 00000000..a6fe2373 --- /dev/null +++ b/Common/src/generated/resources/assets/hexcasting/models/block/quenched_allay_3.json @@ -0,0 +1,6 @@ +{ + "parent": "minecraft:block/cube_all", + "textures": { + "all": "hexcasting:block/quenched_allay_3" + } +} \ No newline at end of file diff --git a/Common/src/generated/resources/assets/hexcasting/models/item/quenched_allay_0.json b/Common/src/generated/resources/assets/hexcasting/models/item/quenched_allay_0.json new file mode 100644 index 00000000..b82fee4e --- /dev/null +++ b/Common/src/generated/resources/assets/hexcasting/models/item/quenched_allay_0.json @@ -0,0 +1,3 @@ +{ + "parent": "hexcasting:block/quenched_allay_0" +} \ No newline at end of file diff --git a/Common/src/generated/resources/assets/hexcasting/models/item/quenched_allay_1.json b/Common/src/generated/resources/assets/hexcasting/models/item/quenched_allay_1.json new file mode 100644 index 00000000..f6de1630 --- /dev/null +++ b/Common/src/generated/resources/assets/hexcasting/models/item/quenched_allay_1.json @@ -0,0 +1,3 @@ +{ + "parent": "hexcasting:block/quenched_allay_1" +} \ No newline at end of file diff --git a/Common/src/generated/resources/assets/hexcasting/models/item/quenched_allay_2.json b/Common/src/generated/resources/assets/hexcasting/models/item/quenched_allay_2.json new file mode 100644 index 00000000..bdf10592 --- /dev/null +++ b/Common/src/generated/resources/assets/hexcasting/models/item/quenched_allay_2.json @@ -0,0 +1,3 @@ +{ + "parent": "hexcasting:block/quenched_allay_2" +} \ No newline at end of file diff --git a/Common/src/generated/resources/assets/hexcasting/models/item/quenched_allay_3.json b/Common/src/generated/resources/assets/hexcasting/models/item/quenched_allay_3.json new file mode 100644 index 00000000..2fa4afd3 --- /dev/null +++ b/Common/src/generated/resources/assets/hexcasting/models/item/quenched_allay_3.json @@ -0,0 +1,3 @@ +{ + "parent": "hexcasting:block/quenched_allay_3" +} \ No newline at end of file diff --git a/Common/src/main/java/at/petrak/hexcasting/GaslightingModel.java b/Common/src/main/java/at/petrak/hexcasting/GaslightingModel.java new file mode 100644 index 00000000..e3b72b8d --- /dev/null +++ b/Common/src/main/java/at/petrak/hexcasting/GaslightingModel.java @@ -0,0 +1,69 @@ +package at.petrak.hexcasting; + +import net.minecraft.client.renderer.block.model.BakedQuad; +import net.minecraft.client.renderer.block.model.ItemOverrides; +import net.minecraft.client.renderer.block.model.ItemTransforms; +import net.minecraft.client.renderer.texture.TextureAtlasSprite; +import net.minecraft.client.resources.model.BakedModel; +import net.minecraft.core.Direction; +import net.minecraft.util.RandomSource; +import net.minecraft.world.level.block.state.BlockState; +import org.jetbrains.annotations.Nullable; + +import java.util.List; + +public class GaslightingModel implements BakedModel { + private static int GASLIGHTING_AMOUNT = 0; + private static boolean HAS_RENDERED_THIS_FRAME = false; + + private final List variants; + private final BakedModel wrapped; + + public GaslightingModel(List variants) { + this.variants = variants; + this.wrapped = this.variants.get(0); + } + + @Override + public List getQuads(@Nullable BlockState state, @Nullable Direction direction, RandomSource random) { + HAS_RENDERED_THIS_FRAME = true; + + var idx = Math.abs(GASLIGHTING_AMOUNT % this.variants.size()); + return this.variants.get(idx).getQuads(state, direction, random); + } + + public boolean useAmbientOcclusion() { + return this.wrapped.useAmbientOcclusion(); + } + + public boolean isGui3d() { + return this.wrapped.isGui3d(); + } + + public boolean usesBlockLight() { + return this.wrapped.usesBlockLight(); + } + + public boolean isCustomRenderer() { + return this.wrapped.isCustomRenderer(); + } + + public TextureAtlasSprite getParticleIcon() { + return this.wrapped.getParticleIcon(); + } + + public ItemTransforms getTransforms() { + return this.wrapped.getTransforms(); + } + + public ItemOverrides getOverrides() { + return this.wrapped.getOverrides(); + } + + public static void postFrameCheckRendered() { + if (!HAS_RENDERED_THIS_FRAME) { + GASLIGHTING_AMOUNT += 1; + } + HAS_RENDERED_THIS_FRAME = false; + } +} diff --git a/Common/src/main/java/at/petrak/hexcasting/client/ClientTickCounter.java b/Common/src/main/java/at/petrak/hexcasting/client/ClientTickCounter.java index 213b3433..a0728ec3 100644 --- a/Common/src/main/java/at/petrak/hexcasting/client/ClientTickCounter.java +++ b/Common/src/main/java/at/petrak/hexcasting/client/ClientTickCounter.java @@ -1,5 +1,6 @@ package at.petrak.hexcasting.client; +import at.petrak.hexcasting.GaslightingModel; import net.minecraft.client.Minecraft; public class ClientTickCounter { @@ -7,7 +8,7 @@ public class ClientTickCounter { public static float partialTicks = 0.0F; public static float getTotal() { - return (float)ticksInGame + partialTicks; + return (float) ticksInGame + partialTicks; } public static void renderTickStart(float renderTickTime) { @@ -18,6 +19,7 @@ public class ClientTickCounter { if (!Minecraft.getInstance().isPaused()) { ++ticksInGame; partialTicks = 0.0F; + GaslightingModel.postFrameCheckRendered(); } } } diff --git a/Common/src/main/java/at/petrak/hexcasting/client/RegisterClientStuff.java b/Common/src/main/java/at/petrak/hexcasting/client/RegisterClientStuff.java index dd17f541..e9e9f3a8 100644 --- a/Common/src/main/java/at/petrak/hexcasting/client/RegisterClientStuff.java +++ b/Common/src/main/java/at/petrak/hexcasting/client/RegisterClientStuff.java @@ -1,8 +1,6 @@ package at.petrak.hexcasting.client; -import at.petrak.hexcasting.api.block.circle.BlockAbstractImpetus; -import at.petrak.hexcasting.api.block.circle.BlockEntityAbstractImpetus; -import at.petrak.hexcasting.api.client.ScryingLensOverlayRegistry; +import at.petrak.hexcasting.GaslightingModel; import at.petrak.hexcasting.api.item.IotaHolderItem; import at.petrak.hexcasting.api.item.MediaHolderItem; import at.petrak.hexcasting.api.misc.MediaConstants; @@ -10,6 +8,7 @@ import at.petrak.hexcasting.api.utils.NBTHelper; import at.petrak.hexcasting.client.be.BlockEntityAkashicBookshelfRenderer; import at.petrak.hexcasting.client.be.BlockEntitySlateRenderer; import at.petrak.hexcasting.client.entity.WallScrollRenderer; +import at.petrak.hexcasting.common.blocks.BlockQuenchedAllay; import at.petrak.hexcasting.common.blocks.akashic.BlockAkashicBookshelf; import at.petrak.hexcasting.common.blocks.akashic.BlockEntityAkashicBookshelf; import at.petrak.hexcasting.common.entities.HexEntities; @@ -22,37 +21,31 @@ import at.petrak.hexcasting.common.lib.HexBlocks; import at.petrak.hexcasting.common.lib.HexItems; import at.petrak.hexcasting.common.lib.hex.HexIotaTypes; import at.petrak.hexcasting.xplat.IClientXplatAbstractions; -import com.mojang.datafixers.util.Pair; -import net.minecraft.ChatFormatting; import net.minecraft.client.color.block.BlockColor; import net.minecraft.client.color.item.ItemColor; import net.minecraft.client.renderer.RenderType; import net.minecraft.client.renderer.blockentity.BlockEntityRendererProvider; -import net.minecraft.core.BlockPos; -import net.minecraft.core.Direction; -import net.minecraft.network.chat.Component; -import net.minecraft.network.chat.Style; -import net.minecraft.network.chat.TextColor; -import net.minecraft.util.Mth; +import net.minecraft.client.resources.model.BakedModel; +import net.minecraft.client.resources.model.ModelBakery; +import net.minecraft.client.resources.model.ModelResourceLocation; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.server.packs.resources.ResourceManager; import net.minecraft.world.item.Item; import net.minecraft.world.item.ItemStack; -import net.minecraft.world.item.Items; -import net.minecraft.world.level.Level; -import net.minecraft.world.level.block.*; +import net.minecraft.world.level.block.Block; import net.minecraft.world.level.block.entity.BlockEntity; import net.minecraft.world.level.block.entity.BlockEntityType; -import net.minecraft.world.level.block.state.BlockState; -import net.minecraft.world.level.block.state.properties.ComparatorMode; -import net.minecraft.world.level.block.state.properties.NoteBlockInstrument; -import net.minecraft.world.level.block.state.properties.RailShape; -import net.minecraft.world.level.material.MaterialColor; import org.jetbrains.annotations.NotNull; +import java.util.ArrayList; import java.util.Locale; +import java.util.Map; import java.util.function.BiConsumer; +import java.util.function.Consumer; import java.util.function.Predicate; import java.util.function.ToIntFunction; -import java.util.function.UnaryOperator; + +import static at.petrak.hexcasting.api.HexAPI.modLoc; public class RegisterClientStuff { public static void init() { @@ -126,7 +119,7 @@ public class RegisterClientStuff { // Minecraft.getInstance().getTextureManager().bindForSetup(tex); // } - addScryingLensStuff(); + ScryingLensOverlays.addScryingLensStuff(); } public static void registerColorProviders(BiConsumer itemColorRegistry, @@ -166,152 +159,6 @@ public class RegisterClientStuff { }; } - private static void addScryingLensStuff() { - ScryingLensOverlayRegistry.addPredicateDisplayer( - (state, pos, observer, world, direction) -> state.getBlock() instanceof BlockAbstractImpetus, - (lines, state, pos, observer, world, direction) -> { - if (world.getBlockEntity(pos) instanceof BlockEntityAbstractImpetus beai) { - beai.applyScryingLensOverlay(lines, state, pos, observer, world, direction); - } - }); - - ScryingLensOverlayRegistry.addDisplayer(Blocks.NOTE_BLOCK, - (lines, state, pos, observer, world, direction) -> { - int note = state.getValue(NoteBlock.NOTE); - - float rCol = Math.max(0.0F, Mth.sin((note / 24F + 0.0F) * Mth.TWO_PI) * 0.65F + 0.35F); - float gCol = Math.max(0.0F, Mth.sin((note / 24F + 0.33333334F) * Mth.TWO_PI) * 0.65F + 0.35F); - float bCol = Math.max(0.0F, Mth.sin((note / 24F + 0.6666667F) * Mth.TWO_PI) * 0.65F + 0.35F); - - int noteColor = 0xFF_000000 | Mth.color(rCol, gCol, bCol); - - var instrument = state.getValue(NoteBlock.INSTRUMENT); - - lines.add(new Pair<>( - new ItemStack(Items.MUSIC_DISC_CHIRP), - Component.literal(String.valueOf(instrument.ordinal())) - .withStyle(color(instrumentColor(instrument))))); - lines.add(new Pair<>( - new ItemStack(Items.NOTE_BLOCK), - Component.literal(String.valueOf(note)) - .withStyle(color(noteColor)))); - }); - - ScryingLensOverlayRegistry.addDisplayer(HexBlocks.AKASHIC_BOOKSHELF, - (lines, state, pos, observer, world, direction) -> { - if (world.getBlockEntity(pos) instanceof BlockEntityAkashicBookshelf tile) { - var iotaTag = tile.getIotaTag(); - if (iotaTag != null) { - var display = HexIotaTypes.getDisplay(iotaTag); - lines.add(new Pair<>(new ItemStack(Items.BOOK), display)); - } - } - }); - - ScryingLensOverlayRegistry.addDisplayer(Blocks.COMPARATOR, - (lines, state, pos, observer, world, direction) -> { - int comparatorValue = ScryingLensOverlayRegistry.getComparatorValue(true); - lines.add(new Pair<>( - new ItemStack(Items.REDSTONE), - Component.literal(comparatorValue == -1 ? "" : String.valueOf(comparatorValue)) - .withStyle(redstoneColor(comparatorValue)))); - - boolean compare = state.getValue(ComparatorBlock.MODE) == ComparatorMode.COMPARE; - - lines.add(new Pair<>( - new ItemStack(Items.REDSTONE_TORCH), - Component.literal(compare ? ">=" : "-") - .withStyle(redstoneColor(compare ? 0 : 15)))); - }); - - ScryingLensOverlayRegistry.addDisplayer(Blocks.POWERED_RAIL, - (lines, state, pos, observer, world, direction) -> { - int power = getPoweredRailStrength(world, pos, state); - lines.add(new Pair<>( - new ItemStack(Items.POWERED_RAIL), - Component.literal(String.valueOf(power)) - .withStyle(redstoneColor(power, 9)))); - }); - - ScryingLensOverlayRegistry.addDisplayer(Blocks.REPEATER, - (lines, state, pos, observer, world, direction) -> lines.add(new Pair<>( - new ItemStack(Items.CLOCK), - Component.literal(String.valueOf(state.getValue(RepeaterBlock.DELAY))) - .withStyle(ChatFormatting.YELLOW)))); - - ScryingLensOverlayRegistry.addPredicateDisplayer( - (state, pos, observer, world, direction) -> state.getBlock() instanceof BeehiveBlock, - (lines, state, pos, observer, world, direction) -> { - int count = ScryingLensOverlayRegistry.getBeeValue(); - lines.add(new Pair<>(new ItemStack(Items.BEE_NEST), count == -1 ? Component.empty() : - Component.translatable( - "hexcasting.tooltip.lens.bee" + (count == 1 ? ".single" : ""), - count - ))); - }); - - ScryingLensOverlayRegistry.addPredicateDisplayer( - (state, pos, observer, world, direction) -> state.isSignalSource() && !state.is( - Blocks.COMPARATOR), - (lines, state, pos, observer, world, direction) -> { - int signalStrength = 0; - if (state.getBlock() instanceof RedStoneWireBlock) { - signalStrength = state.getValue(RedStoneWireBlock.POWER); - } else { - for (Direction dir : Direction.values()) { - signalStrength = Math.max(signalStrength, state.getSignal(world, pos, dir)); - } - } - - lines.add(0, new Pair<>( - new ItemStack(Items.REDSTONE), - Component.literal(String.valueOf(signalStrength)) - .withStyle(redstoneColor(signalStrength)))); - }); - - ScryingLensOverlayRegistry.addPredicateDisplayer( - (state, pos, observer, world, direction) -> state.hasAnalogOutputSignal(), - (lines, state, pos, observer, world, direction) -> { - int comparatorValue = ScryingLensOverlayRegistry.getComparatorValue(false); - lines.add( - new Pair<>( - new ItemStack(Items.COMPARATOR), - Component.literal(comparatorValue == -1 ? "" : String.valueOf(comparatorValue)) - .withStyle(redstoneColor(comparatorValue)))); - }); - } - - private static UnaryOperator