From b6035a19d86a2aed1fe9c78909f6b9aa98cc8376 Mon Sep 17 00:00:00 2001 From: gattsuru Date: Wed, 20 Jul 2022 03:26:02 -0400 Subject: [PATCH 001/117] Fix Edify Saplings on Fabric, Expand CCA Range - Initializes Edified Sapling features in FabrixHexInitializer. - Changes Cardinal Components req to >=4.1.4 . Not ideal, as will not give reliable errors if someone installs 5.0, but I can't get a range of values to be supported. --- Fabric/gradle.properties | 2 +- .../java/at/petrak/hexcasting/fabric/FabricHexInitializer.kt | 3 +++ Fabric/src/main/resources/fabric.mod.json | 2 +- 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/Fabric/gradle.properties b/Fabric/gradle.properties index 8912af00..b7cd04ec 100644 --- a/Fabric/gradle.properties +++ b/Fabric/gradle.properties @@ -3,7 +3,7 @@ fabricVersion=0.51.1+1.18.2 fabricLoaderVersion=0.14.5 fiberVersion=0.23.0-2 -cardinalComponentsVersion=4.1.4 +cardinalComponentsVersion=4.2.0 serializationHooksVersion=0.1.0+1.18.095e8a6 reiVersion=8.0.442 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 479fb8b8..77de054d 100644 --- a/Fabric/src/main/java/at/petrak/hexcasting/fabric/FabricHexInitializer.kt +++ b/Fabric/src/main/java/at/petrak/hexcasting/fabric/FabricHexInitializer.kt @@ -11,6 +11,7 @@ import at.petrak.hexcasting.common.entities.HexEntities import at.petrak.hexcasting.common.items.ItemJewelerHammer import at.petrak.hexcasting.common.lib.* 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.PlayerPositionRecorder import at.petrak.hexcasting.common.recipe.HexRecipeSerializers @@ -97,6 +98,8 @@ object FabricHexInitializer : ModInitializer { HexLootFunctions.registerSerializers(bind(Registry.LOOT_FUNCTION_TYPE)) + AkashicTreeGrower.INSTANCE + // Done with soft implements in forge val flameOn = FlammableBlockRegistry.getDefaultInstance() for (log in listOf( diff --git a/Fabric/src/main/resources/fabric.mod.json b/Fabric/src/main/resources/fabric.mod.json index 3482c873..815fcfa0 100644 --- a/Fabric/src/main/resources/fabric.mod.json +++ b/Fabric/src/main/resources/fabric.mod.json @@ -49,7 +49,7 @@ "minecraft": "=1.18.2", "java": ">=17", "fabric-language-kotlin": ">=1.7.4+kotlin.1.6.21", - "cardinal-components": "~4.1.4", + "cardinal-components": ">=4.1.4", "patchouli": ">=1.18.2-69", "paucal": "~0.4.6" }, From 8824415611ed04e2e958de7f2a8ce8c230f93bae Mon Sep 17 00:00:00 2001 From: gattsuru Date: Fri, 22 Jul 2022 14:58:17 -0400 Subject: [PATCH 002/117] Fix Flight Duration In Fabric --- .../common/casting/operators/spells/great/OpFlight.kt | 8 ++++++++ .../at/petrak/hexcasting/fabric/FabricHexInitializer.kt | 2 ++ 2 files changed, 10 insertions(+) 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 6b35d657..4d2e5610 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 @@ -5,6 +5,7 @@ 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.xplat.IXplatAbstractions +import net.minecraft.server.level.ServerLevel import net.minecraft.server.level.ServerPlayer import net.minecraft.world.entity.LivingEntity import net.minecraft.world.phys.Vec3 @@ -97,4 +98,11 @@ object OpFlight : SpellOperator { } } + + fun fabricTickDownAllFlight(world: ServerLevel) + { + for (player in world.players()) { + tickDownFlight(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 77de054d..d2617383 100644 --- a/Fabric/src/main/java/at/petrak/hexcasting/fabric/FabricHexInitializer.kt +++ b/Fabric/src/main/java/at/petrak/hexcasting/fabric/FabricHexInitializer.kt @@ -6,6 +6,7 @@ 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 @@ -73,6 +74,7 @@ object FabricHexInitializer : ModInitializer { } ServerTickEvents.END_WORLD_TICK.register(PlayerPositionRecorder::updateAllPlayers) + ServerTickEvents.END_WORLD_TICK.register(OpFlight::fabricTickDownAllFlight) CommandRegistrationCallback.EVENT.register { dp, _ -> HexCommands.register(dp) } From 87ed5477164d406fb973d0601376d2529f155962 Mon Sep 17 00:00:00 2001 From: "yrsegal@gmail.com" Date: Sun, 24 Jul 2022 11:56:30 -0400 Subject: [PATCH 003/117] flight is no longer broken --- .../common/casting/operators/spells/great/OpFlight.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 6b35d657..2a64d85c 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 @@ -27,7 +27,7 @@ object OpFlight : SpellOperator { val time = (timeRaw * 20.0).roundToInt() return Triple( Spell(target, time, radiusRaw, ctx.position), - ManaConstants.DUST_UNIT * (0.25 * (timeRaw * radiusRaw + 1.0)).roundToInt(), + (ManaConstants.DUST_UNIT * 0.25 * (timeRaw * radiusRaw + 1.0)).roundToInt(), listOf(ParticleSpray(target.position(), Vec3(0.0, 2.0, 0.0), 0.0, 0.1)) ) } From 31c91a4826b5967a99f0ed2ea2d297e0de007b76 Mon Sep 17 00:00:00 2001 From: gattsuru Date: Sun, 24 Jul 2022 12:16:40 -0400 Subject: [PATCH 004/117] Updates Fabric Config, Impulse docs - Describes increase to costs for multi-Impulse spells - Adds warnings for valid ranges for configs, since FabricConfig doesn't --- Common/src/main/resources/assets/hexcasting/lang/en_us.json | 2 +- .../java/at/petrak/hexcasting/fabric/FabricHexConfig.java | 6 +++--- 2 files changed, 4 insertions(+), 4 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 4f9b3b4f..a80983fa 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.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/$s per point of explosion power.", "hexcasting.page.basic_spell.explode.fire.1": "Remove a number and vector from the stack, then create a fiery explosion at the given location with the given power.", "hexcasting.page.basic_spell.explode.fire.2": "Costs one $(l:items/amethyst)$(item)Amethyst Dust/$, plus about 3 extra $(l:items/amethyst)$(item)Amethyst Dust/$s per point of explosion power. Otherwise, the same as $(l:patterns/spells/basic#hexcasting:explode)$(action)Explosion/$, except with fire.", - "hexcasting.page.basic_spell.add_motion": "Remove an entity and direction from the stack, then give a shove to the given entity in the given direction. The strength of the impulse is determined by the length of the vector.$(br)Costs units of $(l:items/amethyst)$(item)Amethyst Dust/$ equal to the square of the length of the vector.", + "hexcasting.page.basic_spell.add_motion": "Remove an entity and direction from the stack, then give a shove to the given entity in the given direction. The strength of the impulse is determined by the length of the vector.$(br)Costs units of $(l:items/amethyst)$(item)Amethyst Dust/$ equal to the square of the length of the vector, plus one for every Impulse after the first in a spell.", "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/$.", 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 bf9a5375..d3d52b1b 100644 --- a/Fabric/src/main/java/at/petrak/hexcasting/fabric/FabricHexConfig.java +++ b/Fabric/src/main/java/at/petrak/hexcasting/fabric/FabricHexConfig.java @@ -134,7 +134,7 @@ public class FabricHexConfig { public ConfigTree configure(ConfigTreeBuilder bob) { bob .beginValue("patternPointSpeedMultiplier", ConfigTypes.DOUBLE, DEFAULT_PATTERN_POINT_SPEED_MULTIPLIER) - .withComment("How fast the point showing you the stroke order on patterns moves") + .withComment("How fast the point showing you the stroke order on patterns moves. Must be positive.") .finishValue(patternPointSpeedMultiplier::mirror) .beginValue("ctrlTogglesOffStrokeOrder", ConfigTypes.BOOLEAN, DEFAULT_CTRL_TOGGLES_OFF_STROKE_ORDER) @@ -143,7 +143,7 @@ public class FabricHexConfig { .beginValue("gridSnapThreshold", ConfigTypes.DOUBLE, DEFAULT_GRID_SNAP_THRESHOLD) .withComment( - "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.") + "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. Valid range is 0.5 to 1.0, and may cause client crashes if set above or below those values.") .finishValue(gridSnapThreshold::mirror) ; @@ -200,7 +200,7 @@ public class FabricHexConfig { .fork("Spell Circles") .beginValue("maxSpellCircleLength", ConfigTypes.NATURAL, DEFAULT_MAX_SPELL_CIRCLE_LENGTH) - .withComment("The maximum number of slates in a spell circle") + .withComment("The maximum number of slates in a spell circle. Must be at least 4.") .finishValue(maxSpellCircleLength::mirror) .beginValue("circleActionDenyList", ConfigTypes.makeList(ConfigTypes.STRING), List.of()) From cc24932854e384a6c28d243460b23929def447ab Mon Sep 17 00:00:00 2001 From: "yrsegal@gmail.com" Date: Sun, 24 Jul 2022 16:51:57 -0400 Subject: [PATCH 005/117] create compat --- .../datagen/HexItemTagProvider.java | 2 - .../datagen/recipe/HexplatRecipes.java | 30 ++- .../builders/CreateCrushingRecipeBuilder.java | 174 ++++++++++++++++++ Fabric/build.gradle | 2 +- Fabric/src/generated/resources/.cache/cache | 4 +- .../recipes/crushing/amethyst_block.json | 20 ++ .../recipes/crushing/amethyst_cluster.json | 23 +++ .../create/crushing/amethyst_shard.json | 19 ++ .../datagen/HexFabricDataGenerators.java | 3 +- .../FabricCreateCrushingRecipeBuilder.java | 37 ++++ Forge/build.gradle | 4 +- Forge/src/generated/resources/.cache/cache | 4 +- .../recipes/crushing/amethyst_block.json | 20 ++ .../recipes/crushing/amethyst_cluster.json | 23 +++ .../create/crushing/amethyst_shard.json | 19 ++ .../forge/datagen/HexForgeDataGenerators.java | 5 +- .../ForgeCreateCrushingRecipeBuilder.java | 40 ++++ 17 files changed, 418 insertions(+), 11 deletions(-) create mode 100644 Common/src/main/java/at/petrak/hexcasting/datagen/recipe/builders/CreateCrushingRecipeBuilder.java create mode 100644 Fabric/src/generated/resources/data/create/recipes/crushing/amethyst_block.json create mode 100644 Fabric/src/generated/resources/data/create/recipes/crushing/amethyst_cluster.json create mode 100644 Fabric/src/generated/resources/data/hexcasting/recipes/compat/create/crushing/amethyst_shard.json create mode 100644 Fabric/src/main/java/at/petrak/hexcasting/fabric/datagen/builders/FabricCreateCrushingRecipeBuilder.java create mode 100644 Forge/src/generated/resources/data/create/recipes/crushing/amethyst_block.json create mode 100644 Forge/src/generated/resources/data/create/recipes/crushing/amethyst_cluster.json create mode 100644 Forge/src/generated/resources/data/hexcasting/recipes/compat/create/crushing/amethyst_shard.json create mode 100644 Forge/src/main/java/at/petrak/hexcasting/forge/datagen/builders/ForgeCreateCrushingRecipeBuilder.java 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 8072ee5f..7f81a096 100644 --- a/Common/src/main/java/at/petrak/hexcasting/datagen/HexItemTagProvider.java +++ b/Common/src/main/java/at/petrak/hexcasting/datagen/HexItemTagProvider.java @@ -25,8 +25,6 @@ public class HexItemTagProvider extends PaucalItemTagProvider { tag(xtags.gems()).add(HexItems.CHARGED_AMETHYST); tag(xtags.amethystDust()).add(HexItems.AMETHYST_DUST); - tag(ItemTags.CLUSTER_MAX_HARVESTABLES).add(HexItems.JEWELER_HAMMER); - tag(HexItemTags.WANDS).add(HexItems.WAND_AKASHIC, HexItems.WAND_OAK, HexItems.WAND_SPRUCE, HexItems.WAND_BIRCH, HexItems.WAND_JUNGLE, HexItems.WAND_ACACIA, HexItems.WAND_DARK_OAK, 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 a3d14935..6f143ca0 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 @@ -13,6 +13,7 @@ import at.petrak.hexcasting.common.recipe.ingredient.StateIngredientHelper; import at.petrak.hexcasting.common.recipe.ingredient.VillagerIngredient; import at.petrak.hexcasting.datagen.IXplatIngredients; import at.petrak.hexcasting.datagen.recipe.builders.BrainsweepRecipeBuilder; +import at.petrak.hexcasting.datagen.recipe.builders.CreateCrushingRecipeBuilder; import at.petrak.paucal.api.datagen.PaucalRecipeProvider; import net.minecraft.advancements.critereon.EntityPredicate; import net.minecraft.advancements.critereon.MinMaxBounds; @@ -30,16 +31,19 @@ import net.minecraft.world.item.crafting.SimpleRecipeSerializer; import net.minecraft.world.level.block.Blocks; import java.util.function.Consumer; +import java.util.function.Supplier; public class HexplatRecipes extends PaucalRecipeProvider { public DataGenerator generator; public IXplatIngredients ingredients; + public Supplier createCrushing; - public HexplatRecipes(DataGenerator pGenerator, IXplatIngredients ingredients) { + public HexplatRecipes(DataGenerator pGenerator, IXplatIngredients ingredients, Supplier createCrushing) { super(pGenerator, HexAPI.MOD_ID); this.generator = pGenerator; this.ingredients = ingredients; + this.createCrushing = createCrushing; } protected void makeRecipes(Consumer recipes) { @@ -357,6 +361,30 @@ public class HexplatRecipes extends PaucalRecipeProvider { HexBlocks.AKASHIC_RECORD.defaultBlockState()) .unlockedBy("enlightenment", enlightenment) .save(recipes, modLoc("brainsweep/akashic_record")); + + // Create compat + + createCrushing.get() + .withInput(Blocks.AMETHYST_CLUSTER) + .duration(150) + .withOutput(Items.AMETHYST_SHARD, 7) + .withOutput(HexItems.AMETHYST_DUST, 5) + .withOutput(0.25f, HexItems.CHARGED_AMETHYST) + .save(recipes, new ResourceLocation("create", "crushing/amethyst_cluster")); + + createCrushing.get() + .withInput(Blocks.AMETHYST_BLOCK) + .duration(150) + .withOutput(Items.AMETHYST_SHARD, 3) + .withOutput(0.5f, HexItems.AMETHYST_DUST, 4) + .save(recipes, new ResourceLocation("create", "crushing/amethyst_block")); + + createCrushing.get() + .withInput(Items.AMETHYST_SHARD) + .duration(150) + .withOutput(HexItems.AMETHYST_DUST, 4) + .withOutput(0.5f, HexItems.AMETHYST_DUST) + .save(recipes, modLoc("compat/create/crushing/amethyst_shard")); } private void wandRecipe(Consumer recipes, ItemWand wand, Item plank) { diff --git a/Common/src/main/java/at/petrak/hexcasting/datagen/recipe/builders/CreateCrushingRecipeBuilder.java b/Common/src/main/java/at/petrak/hexcasting/datagen/recipe/builders/CreateCrushingRecipeBuilder.java new file mode 100644 index 00000000..cefe261a --- /dev/null +++ b/Common/src/main/java/at/petrak/hexcasting/datagen/recipe/builders/CreateCrushingRecipeBuilder.java @@ -0,0 +1,174 @@ +package at.petrak.hexcasting.datagen.recipe.builders; + +import com.google.gson.JsonArray; +import com.google.gson.JsonObject; +import com.google.gson.JsonParser; +import net.minecraft.advancements.CriterionTriggerInstance; +import net.minecraft.core.Registry; +import net.minecraft.data.recipes.FinishedRecipe; +import net.minecraft.data.recipes.RecipeBuilder; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.world.item.Item; +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.level.ItemLike; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; + +import java.util.ArrayList; +import java.util.List; +import java.util.function.Consumer; + +// Largely adapted from the following classes: +// https://github.com/Creators-of-Create/Create/blob/82be76d8934af03b4e52cad6a9f74a4175ba7b05/src/main/java/com/simibubi/create/content/contraptions/processing/ProcessingOutput.java +// https://github.com/Creators-of-Create/Create/blob/82be76d8934af03b4e52cad6a9f74a4175ba7b05/src/main/java/com/simibubi/create/foundation/data/recipe/ProcessingRecipeGen.java +// https://github.com/Creators-of-Create/Create/blob/82be76d8934af03b4e52cad6a9f74a4175ba7b05/src/main/java/com/simibubi/create/content/contraptions/processing/ProcessingRecipeBuilder.java +// https://github.com/Creators-of-Create/Create/blob/82be76d8934af03b4e52cad6a9f74a4175ba7b05/src/main/java/com/simibubi/create/content/contraptions/processing/ProcessingRecipeSerializer.java +public abstract class CreateCrushingRecipeBuilder implements RecipeBuilder { + private String group = ""; + private Ingredient input; + private final List results = new ArrayList<>(); + private int processingTime = 100; + + @Override + public @NotNull CreateCrushingRecipeBuilder unlockedBy(@NotNull String name, @NotNull CriterionTriggerInstance trigger) { + return this; + } + + @Override + public @NotNull CreateCrushingRecipeBuilder group(@Nullable String name) { + group = name; + return this; + } + + public CreateCrushingRecipeBuilder duration(int duration) { + this.processingTime = duration; + return this; + } + + public CreateCrushingRecipeBuilder withInput(ItemLike item) { + return withInput(Ingredient.of(item)); + } + + public CreateCrushingRecipeBuilder withInput(ItemStack stack) { + return withInput(Ingredient.of(stack)); + } + + public CreateCrushingRecipeBuilder withInput(Ingredient ingredient) { + this.input = ingredient; + return this; + } + + public CreateCrushingRecipeBuilder withOutput(ItemLike output) { + return withOutput(1f, output, 1); + } + + public CreateCrushingRecipeBuilder withOutput(float chance, ItemLike output) { + return withOutput(chance, output, 1); + } + + public CreateCrushingRecipeBuilder withOutput(ItemLike output, int count) { + return withOutput(1f, output, count); + } + + public CreateCrushingRecipeBuilder withOutput(float chance, ItemLike output, int count) { + return withOutput(new ItemStack(output, count), chance); + } + + public CreateCrushingRecipeBuilder withOutput(ItemStack output, float chance) { + this.results.add(new ProcessingOutput(output, chance)); + return this; + } + + @Override + public @NotNull Item getResult() { + return Items.AIR; // Irrelevant, we implement serialization ourselves + } + + @Override + public void save(@NotNull Consumer consumer, @NotNull ResourceLocation resourceLocation) { + consumer.accept(new CrushingRecipe(resourceLocation)); + } + + public abstract void serializeConditions(JsonObject object); + + public abstract CreateCrushingRecipeBuilder whenModLoaded(String modid); + + public abstract CreateCrushingRecipeBuilder whenModMissing(String modid); + + public class CrushingRecipe implements FinishedRecipe { + + private final ResourceLocation id; + + public CrushingRecipe(ResourceLocation id) { + this.id = id; + } + + @Override + public void serializeRecipeData(@NotNull JsonObject json) { + json.addProperty("type", "create:crushing"); + + if (!group.isEmpty()) { + json.addProperty("group", group); + } + + JsonArray jsonIngredients = new JsonArray(); + JsonArray jsonOutputs = new JsonArray(); + + jsonIngredients.add(input.toJson()); + + results.forEach(o -> jsonOutputs.add(o.serialize())); + + json.add("ingredients", jsonIngredients); + json.add("results", jsonOutputs); + + int processingDuration = processingTime; + if (processingDuration > 0) { + json.addProperty("processingTime", processingDuration); + } + + serializeConditions(json); + } + + @Override + public @NotNull ResourceLocation getId() { + return id; + } + + @Override + public @NotNull RecipeSerializer getType() { + return RecipeSerializer.SHAPELESS_RECIPE; // Irrelevant, we implement serialization ourselves + } + + @Override + public JsonObject serializeAdvancement() { + return null; + } + + @Override + public ResourceLocation getAdvancementId() { + return null; + } + } + + private record ProcessingOutput(ItemStack stack, float chance) { + private JsonObject serialize() { + JsonObject json = new JsonObject(); + ResourceLocation resourceLocation = Registry.ITEM.getKey(stack.getItem()); + json.addProperty("item", resourceLocation.toString()); + int count = stack.getCount(); + if (count != 1) { + json.addProperty("count", count); + } + if (stack.hasTag()) { + json.add("nbt", JsonParser.parseString(stack.getTag().toString())); + } + if (chance != 1) { + json.addProperty("chance", chance); + } + return json; + } + } +} diff --git a/Fabric/build.gradle b/Fabric/build.gradle index af95775b..0dbdf09c 100644 --- a/Fabric/build.gradle +++ b/Fabric/build.gradle @@ -97,7 +97,7 @@ tasks.withType(JavaCompile) { source(project(":Common").sourceSets.main.allSource) } compileKotlin { - source(project(":Common").sourceSets.main.allSource) + source(project(":Common").sourceSets.main.kotlin) } sourcesJar { diff --git a/Fabric/src/generated/resources/.cache/cache b/Fabric/src/generated/resources/.cache/cache index f82ebb02..17cfbaa1 100644 --- a/Fabric/src/generated/resources/.cache/cache +++ b/Fabric/src/generated/resources/.cache/cache @@ -55,6 +55,7 @@ f3c6b6917e504e1c3d5d8875f7cce6f311e791d2 data/minecraft/tags/blocks/logs_that_bu 2ad42dd4a4877a23cb7f45e8b75c9f53f58d12f5 data/hexcasting/recipes/wand_acacia.json b0b1c5fff194b92ff8c5d6468e177271fd910abd data/hexcasting/advancements/recipes/hexcasting.creative_tab/dye_colorizer_red.json 9c619750b17ac95e339882ce6c097ba9a000cc82 data/hexcasting/advancements/recipes/hexcasting.creative_tab/pride_colorizer_pansexual.json +ad85e0162a7c68d431fd700700906ccbcadf91ce data/hexcasting/recipes/compat/create/crushing/amethyst_shard.json 2d79a41ba8697f9e1fa26b1bff48f33c824d3823 data/minecraft/tags/blocks/wooden_pressure_plates.json 8334a42636f045b4dc34c0fe5b3b3d3902aa4b7e data/hexcasting/recipes/scroll_small.json 584bd8806ef8df5f0e623ed727d6e54a61e60dea data/hexcasting/loot_tables/blocks/slate_block.json @@ -89,7 +90,6 @@ d72a4675ceb721ee4ac43339d8bfbbb82c2adba2 data/hexcasting/advancements/recipes/he 090b54b026f6fef2502295ddde5a60f5350e2ec6 data/hexcasting/advancements/recipes/hexcasting.creative_tab/artifact.json d14cf2f8f0895a5b6dc09b7582c0abf1c2514adf data/hexcasting/recipes/sub_sandwich.json b596d96eebb4f7bad5930f4eebc589f292b59c98 data/hexcasting/tags/items/akashic_planks.json -115534970df0123519d4a0073e803007f3a6d21f data/minecraft/tags/items/cluster_max_harvestables.json b8b58bbaf1ddca3514896af14db83f304e415305 data/minecraft/tags/items/trapdoors.json f8d2872c4e692153049b6ae4879755a079954763 data/hexcasting/advancements/recipes/hexcasting.creative_tab/wand_spruce.json 26e9416771d97f9c716d07c27b1b5ca4a267eea2 data/hexcasting/loot_tables/blocks/amethyst_dust_block.json @@ -100,6 +100,7 @@ e5ae652aee1567ac2e626fa0f88f160993a6f9a5 data/hexcasting/advancements/recipes/he 7c0107192c0e24ff9f23ab0f59834b6081ca5b33 data/hexcasting/advancements/recipes/hexcasting.creative_tab/wand_crimson.json 1266b263056dd15c862bff27b05a119c4bbc89ee data/hexcasting/advancements/recipes/hexcasting.creative_tab/akashic_door.json a92e5560c774bb81cd9f38bd9378af8695cac622 data/hexcasting/recipes/akashic_stairs.json +59e0c3893a64d84b5fde52291067b3601c43ffc9 data/create/recipes/crushing/amethyst_cluster.json f3a33396e071f3afd61eadab2aabdb9acf2ae775 data/hexcasting/recipes/slate.json f7bbc60f547a02378ddb1f23395add4822725fed data/hexcasting/recipes/wand_oak.json 0529b25d154715d6b1c030d87e59e6f9d41d91d6 data/hexcasting/recipes/focus.json @@ -220,6 +221,7 @@ c25784941d6416744fb2ca2d43a3203e5c3e7c8a data/minecraft/tags/items/leaves.json ef016ca292fa4edc7496b64e6f2931f4e7d90636 data/hexcasting/recipes/amethyst_dust_packing.json 35a9b4beac7c6eddb990464eaeaebec2a9ab9951 data/hexcasting/loot_tables/inject/scroll_loot_many.json 949f05968c562d5e4d35630ce8e3189a2060dee7 data/hexcasting/advancements/recipes/hexcasting.creative_tab/pride_colorizer_intersex.json +cfda8a0bb9051f9f876cd5b9afcd8a7f6a1e4290 data/create/recipes/crushing/amethyst_block.json e4b6c8850f8517ad6af62309f173d053f1e5b364 data/hexcasting/recipes/pride_colorizer_gay.json 7c08784f2de139be380b5299f8ea8b8c78126ed8 data/minecraft/tags/blocks/mineable/axe.json 791dfa661888afb8ece93c6322fd55dd342086b5 data/hexcasting/recipes/pride_colorizer_bisexual.json diff --git a/Fabric/src/generated/resources/data/create/recipes/crushing/amethyst_block.json b/Fabric/src/generated/resources/data/create/recipes/crushing/amethyst_block.json new file mode 100644 index 00000000..d162220c --- /dev/null +++ b/Fabric/src/generated/resources/data/create/recipes/crushing/amethyst_block.json @@ -0,0 +1,20 @@ +{ + "type": "create:crushing", + "ingredients": [ + { + "item": "minecraft:amethyst_block" + } + ], + "results": [ + { + "item": "minecraft:amethyst_shard", + "count": 3 + }, + { + "item": "hexcasting:amethyst_dust", + "count": 4, + "chance": 0.5 + } + ], + "processingTime": 150 +} \ No newline at end of file diff --git a/Fabric/src/generated/resources/data/create/recipes/crushing/amethyst_cluster.json b/Fabric/src/generated/resources/data/create/recipes/crushing/amethyst_cluster.json new file mode 100644 index 00000000..f326bf4a --- /dev/null +++ b/Fabric/src/generated/resources/data/create/recipes/crushing/amethyst_cluster.json @@ -0,0 +1,23 @@ +{ + "type": "create:crushing", + "ingredients": [ + { + "item": "minecraft:amethyst_cluster" + } + ], + "results": [ + { + "item": "minecraft:amethyst_shard", + "count": 7 + }, + { + "item": "hexcasting:amethyst_dust", + "count": 5 + }, + { + "item": "hexcasting:charged_amethyst", + "chance": 0.25 + } + ], + "processingTime": 150 +} \ No newline at end of file diff --git a/Fabric/src/generated/resources/data/hexcasting/recipes/compat/create/crushing/amethyst_shard.json b/Fabric/src/generated/resources/data/hexcasting/recipes/compat/create/crushing/amethyst_shard.json new file mode 100644 index 00000000..ffa35cc3 --- /dev/null +++ b/Fabric/src/generated/resources/data/hexcasting/recipes/compat/create/crushing/amethyst_shard.json @@ -0,0 +1,19 @@ +{ + "type": "create:crushing", + "ingredients": [ + { + "item": "minecraft:amethyst_shard" + } + ], + "results": [ + { + "item": "hexcasting:amethyst_dust", + "count": 4 + }, + { + "item": "hexcasting:amethyst_dust", + "chance": 0.5 + } + ], + "processingTime": 150 +} \ 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 6b3d96ff..84dfa5bc 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 @@ -6,6 +6,7 @@ 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.fabric.datagen.builders.FabricCreateCrushingRecipeBuilder; import at.petrak.hexcasting.xplat.IXplatAbstractions; import net.fabricmc.fabric.api.datagen.v1.DataGeneratorEntrypoint; import net.fabricmc.fabric.api.datagen.v1.FabricDataGenerator; @@ -23,7 +24,7 @@ public class HexFabricDataGenerators implements DataGeneratorEntrypoint { public void onInitializeDataGenerator(FabricDataGenerator gen) { HexAPI.LOGGER.info("Starting Fabric-specific datagen"); - gen.addProvider(new HexplatRecipes(gen, INGREDIENTS)); + gen.addProvider(new HexplatRecipes(gen, INGREDIENTS, FabricCreateCrushingRecipeBuilder::new)); var xtags = IXplatAbstractions.INSTANCE.tags(); var blockTagProvider = new HexBlockTagProvider(gen, xtags); diff --git a/Fabric/src/main/java/at/petrak/hexcasting/fabric/datagen/builders/FabricCreateCrushingRecipeBuilder.java b/Fabric/src/main/java/at/petrak/hexcasting/fabric/datagen/builders/FabricCreateCrushingRecipeBuilder.java new file mode 100644 index 00000000..5d0f8467 --- /dev/null +++ b/Fabric/src/main/java/at/petrak/hexcasting/fabric/datagen/builders/FabricCreateCrushingRecipeBuilder.java @@ -0,0 +1,37 @@ +package at.petrak.hexcasting.fabric.datagen.builders; + +import at.petrak.hexcasting.datagen.recipe.builders.CreateCrushingRecipeBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonObject; +import net.fabricmc.fabric.api.resource.conditions.v1.ConditionJsonProvider; +import net.fabricmc.fabric.api.resource.conditions.v1.DefaultResourceConditions; +import net.fabricmc.fabric.api.resource.conditions.v1.ResourceConditions; + +import java.util.ArrayList; +import java.util.List; + +public class FabricCreateCrushingRecipeBuilder extends CreateCrushingRecipeBuilder { + private final List conditions = new ArrayList<>(); + + public FabricCreateCrushingRecipeBuilder whenModLoaded(String modid) { + return withCondition(DefaultResourceConditions.anyModLoaded(modid)); + } + + public FabricCreateCrushingRecipeBuilder whenModMissing(String modid) { + return withCondition(DefaultResourceConditions.not(DefaultResourceConditions.anyModLoaded(modid))); + } + + public FabricCreateCrushingRecipeBuilder withCondition(ConditionJsonProvider condition) { + conditions.add(condition); + return this; + } + + @Override + public void serializeConditions(JsonObject object) { + if (!conditions.isEmpty()) { + JsonArray conds = new JsonArray(); + conditions.forEach(c -> conds.add(c.toJson())); + object.add(ResourceConditions.CONDITIONS_KEY, conds); + } + } +} diff --git a/Forge/build.gradle b/Forge/build.gradle index fa5a7777..ed6a3cea 100644 --- a/Forge/build.gradle +++ b/Forge/build.gradle @@ -155,10 +155,10 @@ tasks.withType(JavaCompile) { source(project(":Common").sourceSets.main.allSource) } compileKotlin { - source(project(":Common").sourceSets.main.allSource) + source(project(":Common").sourceSets.main.kotlin) } compileTestKotlin { - source(project(":Common").sourceSets.main.allSource) + source(project(":Common").sourceSets.main.kotlin) } diff --git a/Forge/src/generated/resources/.cache/cache b/Forge/src/generated/resources/.cache/cache index 741fcf96..2c77be3e 100644 --- a/Forge/src/generated/resources/.cache/cache +++ b/Forge/src/generated/resources/.cache/cache @@ -1,3 +1,5 @@ +cfda8a0bb9051f9f876cd5b9afcd8a7f6a1e4290 data/create/recipes/crushing/amethyst_block.json +59e0c3893a64d84b5fde52291067b3601c43ffc9 data/create/recipes/crushing/amethyst_cluster.json 4d4caaea035ae4ee878843dd2455042b299b4e5e data/forge/tags/items/dusts/amethyst.json 05e86742a71afd740f47639be62f93bc9898fcde data/forge/tags/items/gems.json cf0ad981bebbb79414d955fb40fbf537fe88b89d data/hexcasting/advancements/recipes/brainsweep/brainsweep/akashic_record.json @@ -154,6 +156,7 @@ d7f85ce9d46aacc7ec89dc7aa0f88a331ccfbae7 data/hexcasting/recipes/brainsweep/akas 5861845c3cd84021c7c19ac4f5b3bcc8e1bd3916 data/hexcasting/recipes/brainsweep/impetus_look.json ab5d271371323d93ff6eed18179ee4f7fd8c939c data/hexcasting/recipes/brainsweep/impetus_rightclick.json d5c6f9a31a8310ec440fc8c14da8988f0d166586 data/hexcasting/recipes/brainsweep/impetus_storedplayer.json +ad85e0162a7c68d431fd700700906ccbcadf91ce data/hexcasting/recipes/compat/create/crushing/amethyst_shard.json bc140b6c5d999b4bc5d12c302297f56bde3b161c data/hexcasting/recipes/cypher.json 33fed8fb8e34df026e1eea0df8161c7f842a8648 data/hexcasting/recipes/dye_colorizer_black.json c36caf44a941a4abc44a15141eba8fe634c76fb8 data/hexcasting/recipes/dye_colorizer_blue.json @@ -242,7 +245,6 @@ b8b58bbaf1ddca3514896af14db83f304e415305 data/minecraft/tags/blocks/trapdoors.js 48e782ce4fbd486dd0d6ceb9fdcb94d0e0c727d4 data/minecraft/tags/blocks/wooden_slabs.json b8b58bbaf1ddca3514896af14db83f304e415305 data/minecraft/tags/blocks/wooden_trapdoors.json 5f3e3813757d8300acad523d45ac7c4d85728399 data/minecraft/tags/items/buttons.json -115534970df0123519d4a0073e803007f3a6d21f data/minecraft/tags/items/cluster_max_harvestables.json 556d2e6068965e90c307a435b372ae761cd1c606 data/minecraft/tags/items/doors.json c25784941d6416744fb2ca2d43a3203e5c3e7c8a data/minecraft/tags/items/leaves.json f3c6b6917e504e1c3d5d8875f7cce6f311e791d2 data/minecraft/tags/items/logs.json diff --git a/Forge/src/generated/resources/data/create/recipes/crushing/amethyst_block.json b/Forge/src/generated/resources/data/create/recipes/crushing/amethyst_block.json new file mode 100644 index 00000000..d162220c --- /dev/null +++ b/Forge/src/generated/resources/data/create/recipes/crushing/amethyst_block.json @@ -0,0 +1,20 @@ +{ + "type": "create:crushing", + "ingredients": [ + { + "item": "minecraft:amethyst_block" + } + ], + "results": [ + { + "item": "minecraft:amethyst_shard", + "count": 3 + }, + { + "item": "hexcasting:amethyst_dust", + "count": 4, + "chance": 0.5 + } + ], + "processingTime": 150 +} \ No newline at end of file diff --git a/Forge/src/generated/resources/data/create/recipes/crushing/amethyst_cluster.json b/Forge/src/generated/resources/data/create/recipes/crushing/amethyst_cluster.json new file mode 100644 index 00000000..f326bf4a --- /dev/null +++ b/Forge/src/generated/resources/data/create/recipes/crushing/amethyst_cluster.json @@ -0,0 +1,23 @@ +{ + "type": "create:crushing", + "ingredients": [ + { + "item": "minecraft:amethyst_cluster" + } + ], + "results": [ + { + "item": "minecraft:amethyst_shard", + "count": 7 + }, + { + "item": "hexcasting:amethyst_dust", + "count": 5 + }, + { + "item": "hexcasting:charged_amethyst", + "chance": 0.25 + } + ], + "processingTime": 150 +} \ No newline at end of file diff --git a/Forge/src/generated/resources/data/hexcasting/recipes/compat/create/crushing/amethyst_shard.json b/Forge/src/generated/resources/data/hexcasting/recipes/compat/create/crushing/amethyst_shard.json new file mode 100644 index 00000000..ffa35cc3 --- /dev/null +++ b/Forge/src/generated/resources/data/hexcasting/recipes/compat/create/crushing/amethyst_shard.json @@ -0,0 +1,19 @@ +{ + "type": "create:crushing", + "ingredients": [ + { + "item": "minecraft:amethyst_shard" + } + ], + "results": [ + { + "item": "hexcasting:amethyst_dust", + "count": 4 + }, + { + "item": "hexcasting:amethyst_dust", + "chance": 0.5 + } + ], + "processingTime": 150 +} \ No newline at end of file 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 5804bbcb..8dcc2e1d 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 @@ -3,6 +3,7 @@ package at.petrak.hexcasting.forge.datagen; import at.petrak.hexcasting.api.HexAPI; import at.petrak.hexcasting.datagen.*; import at.petrak.hexcasting.datagen.recipe.HexplatRecipes; +import at.petrak.hexcasting.forge.datagen.builders.ForgeCreateCrushingRecipeBuilder; import at.petrak.hexcasting.forge.datagen.xplat.HexBlockStatesAndModels; import at.petrak.hexcasting.forge.datagen.xplat.HexItemModels; import at.petrak.hexcasting.xplat.IXplatAbstractions; @@ -54,7 +55,7 @@ public class HexForgeDataGenerators { ExistingFileHelper efh = ev.getExistingFileHelper(); if (ev.includeServer()) { gen.addProvider(new HexLootTables(gen)); - gen.addProvider(new HexplatRecipes(gen, INGREDIENTS)); + gen.addProvider(new HexplatRecipes(gen, INGREDIENTS, ForgeCreateCrushingRecipeBuilder::new)); var xtags = IXplatAbstractions.INSTANCE.tags(); var blockTagProvider = PaucalForgeDatagenWrappers.addEFHToTagProvider( @@ -119,4 +120,4 @@ public class HexForgeDataGenerators { )); } }; -} \ No newline at end of file +} diff --git a/Forge/src/main/java/at/petrak/hexcasting/forge/datagen/builders/ForgeCreateCrushingRecipeBuilder.java b/Forge/src/main/java/at/petrak/hexcasting/forge/datagen/builders/ForgeCreateCrushingRecipeBuilder.java new file mode 100644 index 00000000..57fbf30e --- /dev/null +++ b/Forge/src/main/java/at/petrak/hexcasting/forge/datagen/builders/ForgeCreateCrushingRecipeBuilder.java @@ -0,0 +1,40 @@ +package at.petrak.hexcasting.forge.datagen.builders; + +import at.petrak.hexcasting.datagen.recipe.builders.CreateCrushingRecipeBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonObject; +import net.minecraftforge.common.crafting.CraftingHelper; +import net.minecraftforge.common.crafting.conditions.ICondition; +import net.minecraftforge.common.crafting.conditions.ModLoadedCondition; +import net.minecraftforge.common.crafting.conditions.NotCondition; + +import java.util.ArrayList; +import java.util.List; + +public class ForgeCreateCrushingRecipeBuilder extends CreateCrushingRecipeBuilder { + private final List conditions = new ArrayList<>(); + + @Override + public ForgeCreateCrushingRecipeBuilder whenModLoaded(String modid) { + return withCondition(new ModLoadedCondition(modid)); + } + + @Override + public ForgeCreateCrushingRecipeBuilder whenModMissing(String modid) { + return withCondition(new NotCondition(new ModLoadedCondition(modid))); + } + + public ForgeCreateCrushingRecipeBuilder withCondition(ICondition condition) { + conditions.add(condition); + return this; + } + + @Override + public void serializeConditions(JsonObject object) { + if (!conditions.isEmpty()) { + JsonArray conds = new JsonArray(); + conditions.forEach(c -> conds.add(CraftingHelper.serialize(c))); + object.add("conditions", conds); + } + } +} From 3bd05c94849bce13b71dc1c39a6dd7819ef3798c Mon Sep 17 00:00:00 2001 From: "yrsegal@gmail.com" Date: Sun, 24 Jul 2022 19:48:23 -0400 Subject: [PATCH 006/117] fix #185 --- .../at/petrak/hexcasting/client/gui/GuiSpellcasting.kt | 4 ++-- .../hexcasting/common/network/MsgNewSpellPatternAck.java | 8 +++++--- .../hexcasting/common/network/MsgNewSpellPatternSyn.java | 2 +- 3 files changed, 8 insertions(+), 6 deletions(-) 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 4531e822..ae7c8548 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 @@ -51,9 +51,9 @@ class GuiSpellcasting( } } - fun recvServerUpdate(info: ControllerInfo) { + fun recvServerUpdate(info: ControllerInfo, index: Int) { this.stackDescs = info.stackDesc - this.patterns.lastOrNull()?.let { + this.patterns.getOrNull(index)?.let { it.type = info.resolutionType } 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 e902f767..2f1bae81 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 @@ -17,7 +17,7 @@ import static at.petrak.hexcasting.api.HexAPI.modLoc; /** * Sent server->client when the player finishes casting a spell. */ -public record MsgNewSpellPatternAck(ControllerInfo info) implements IMessage { +public record MsgNewSpellPatternAck(ControllerInfo info, int index) implements IMessage { public static final ResourceLocation ID = modLoc("pat_sc"); @Override @@ -31,6 +31,7 @@ public record MsgNewSpellPatternAck(ControllerInfo info) implements IMessage { var wasSpellCast = buf.readBoolean(); var isStackEmpty = buf.readBoolean(); var resolutionType = buf.readEnum(ResolvedPatternType.class); + var index = buf.readInt(); var descsLen = buf.readInt(); var desc = new ArrayList(descsLen); for (int i = 0; i < descsLen; i++) { @@ -38,7 +39,7 @@ public record MsgNewSpellPatternAck(ControllerInfo info) implements IMessage { } return new MsgNewSpellPatternAck( - new ControllerInfo(wasSpellCast, isStackEmpty, resolutionType, desc) + new ControllerInfo(wasSpellCast, isStackEmpty, resolutionType, desc), index ); } @@ -47,6 +48,7 @@ public record MsgNewSpellPatternAck(ControllerInfo info) implements IMessage { buf.writeBoolean(this.info.getMakesCastSound()); buf.writeBoolean(this.info.isStackClear()); buf.writeEnum(this.info.getResolutionType()); + buf.writeInt(this.index); buf.writeInt(this.info.getStackDesc().size()); for (var desc : this.info.getStackDesc()) { buf.writeComponent(desc); @@ -67,7 +69,7 @@ public record MsgNewSpellPatternAck(ControllerInfo info) implements IMessage { if (self.info().isStackClear()) { mc.setScreen(null); } else { - spellGui.recvServerUpdate(self.info()); + spellGui.recvServerUpdate(self.info(), self.index()); } } } 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 b1faf30c..136add35 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 @@ -109,7 +109,7 @@ public record MsgNewSpellPatternSyn(InteractionHand handUsed, HexPattern pattern IXplatAbstractions.INSTANCE.setPatterns(sender, resolvedPatterns); } - IXplatAbstractions.INSTANCE.sendPacketToPlayer(sender, new MsgNewSpellPatternAck(clientInfo)); + IXplatAbstractions.INSTANCE.sendPacketToPlayer(sender, new MsgNewSpellPatternAck(clientInfo, resolvedPatterns.size() - 1)); } }); } From 941480e703798484c9cbea566409c14f4ed3a21e Mon Sep 17 00:00:00 2001 From: "yrsegal@gmail.com" Date: Sun, 24 Jul 2022 19:49:40 -0400 Subject: [PATCH 007/117] fix #182 --- .../main/java/at/petrak/hexcasting/common/lib/HexBlocks.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Common/src/main/java/at/petrak/hexcasting/common/lib/HexBlocks.java b/Common/src/main/java/at/petrak/hexcasting/common/lib/HexBlocks.java index c6631166..475e9807 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/lib/HexBlocks.java +++ b/Common/src/main/java/at/petrak/hexcasting/common/lib/HexBlocks.java @@ -192,9 +192,9 @@ public class HexBlocks { public static final SlabBlock AKASHIC_SLAB = blockItem("akashic_slab", new BlockHexSlab(akashicWoody().noOcclusion())); public static final WoodButtonBlock AKASHIC_BUTTON = blockItem("akashic_button", - new BlockHexWoodButton(akashicWoody().noOcclusion())); + new BlockHexWoodButton(akashicWoody().noCollission())); public static final PressurePlateBlock AKASHIC_PRESSURE_PLATE = blockItem("akashic_pressure_plate", - new BlockHexPressurePlate(PressurePlateBlock.Sensitivity.EVERYTHING, akashicWoody().noOcclusion())); + new BlockHexPressurePlate(PressurePlateBlock.Sensitivity.EVERYTHING, akashicWoody().noCollission())); public static final BlockAkashicLeaves AKASHIC_LEAVES1 = blockItem("akashic_leaves1", new BlockAkashicLeaves(leaves(MaterialColor.COLOR_PURPLE))); public static final BlockAkashicLeaves AKASHIC_LEAVES2 = blockItem("akashic_leaves2", From 5201063d693bf255961a1d813f6ff190cdc1edf3 Mon Sep 17 00:00:00 2001 From: "yrsegal@gmail.com" Date: Sun, 24 Jul 2022 19:50:44 -0400 Subject: [PATCH 008/117] fix #172 --- .../common/casting/operators/math/logic/OpBoolIdentityKindOf.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/math/logic/OpBoolIdentityKindOf.kt b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/math/logic/OpBoolIdentityKindOf.kt index 612bf5ac..6009e1a4 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/math/logic/OpBoolIdentityKindOf.kt +++ b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/math/logic/OpBoolIdentityKindOf.kt @@ -12,7 +12,7 @@ object OpBoolIdentityKindOf : ConstManaOperator { if (payload == Widget.NULL) return 0.asSpellResult - if (payload.tolerantEquals(0.0) || payload.tolerantEquals(1.0)) + if (payload.tolerantEquals(0.0)) return null.asSpellResult if (payload is SpellList) From e404aa7c2e25e4712351485d70f3044b4ba1b49d Mon Sep 17 00:00:00 2001 From: "yrsegal@gmail.com" Date: Sun, 24 Jul 2022 19:54:14 -0400 Subject: [PATCH 009/117] fix #174 --- .../petrak/hexcasting/api/spell/casting/ContinuationFrame.kt | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Common/src/main/java/at/petrak/hexcasting/api/spell/casting/ContinuationFrame.kt b/Common/src/main/java/at/petrak/hexcasting/api/spell/casting/ContinuationFrame.kt index 2eb1632a..d93ece07 100644 --- a/Common/src/main/java/at/petrak/hexcasting/api/spell/casting/ContinuationFrame.kt +++ b/Common/src/main/java/at/petrak/hexcasting/api/spell/casting/ContinuationFrame.kt @@ -146,7 +146,9 @@ sealed interface ContinuationFrame { // If we still have data to process... val (stackTop, newCont) = if (data.nonEmpty) { - // Push the next datum to the top of the stack, + // Increment the evaluation depth, + harness.ctx.incDepth() + // push the next datum to the top of the stack, data.car to continuation // put the next Thoth object back on the stack for the next Thoth cycle, .pushFrame(ForEach(data.cdr, code, stack, acc)) From d46cafeb0518e4aa9b5a080c06fcdd302cc15d03 Mon Sep 17 00:00:00 2001 From: "yrsegal@gmail.com" Date: Sun, 24 Jul 2022 20:01:51 -0400 Subject: [PATCH 010/117] close #161, close #117 port of a42f6e87f8c33a385bb47f1f9271bdb254a4c331 --- .../petrak/hexcasting/api/mod/HexConfig.java | 6 ++ .../client/ShiftScrollListener.java | 39 ++++++++---- .../hexcasting/client/gui/GuiSpellcasting.kt | 29 +++++---- .../client/ktxt/ClientAccessorWrappers.kt | 9 +++ .../common/network/MsgShiftScrollSyn.java | 63 ++++++++++++------- .../accessor/client/AccessorMouseHandler.java | 14 +++++ Common/src/main/resources/hexplat.mixins.json | 1 + .../fabric/FabricHexClientInitializer.kt | 7 ++- .../hexcasting/fabric/FabricHexConfig.java | 20 ++++++ .../forge/ForgeHexClientInitializer.java | 2 +- .../hexcasting/forge/ForgeHexConfig.java | 18 ++++++ 11 files changed, 161 insertions(+), 47 deletions(-) create mode 100644 Common/src/main/java/at/petrak/hexcasting/client/ktxt/ClientAccessorWrappers.kt create mode 100644 Common/src/main/java/at/petrak/hexcasting/mixin/accessor/client/AccessorMouseHandler.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 c9d1b3ec..a9b1b051 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 @@ -32,11 +32,17 @@ public class HexConfig { boolean ctrlTogglesOffStrokeOrder(); + boolean invertSpellbookScrollDirection(); + + boolean invertAbacusScrollDirection(); + double gridSnapThreshold(); double DEFAULT_PATTERN_POINT_SPEED_MULTIPLIER = 1; boolean DEFAULT_CTRL_TOGGLES_OFF_STROKE_ORDER = false; double DEFAULT_GRID_SNAP_THRESHOLD = 0.5; + boolean DEFAULT_INVERT_SPELLBOOK_SCROLL = false; + boolean DEFAULT_INVERT_ABACUS_SCROLL = false; } public interface ServerConfigAccess { diff --git a/Common/src/main/java/at/petrak/hexcasting/client/ShiftScrollListener.java b/Common/src/main/java/at/petrak/hexcasting/client/ShiftScrollListener.java index 4dfe93cf..9b4c21c7 100644 --- a/Common/src/main/java/at/petrak/hexcasting/client/ShiftScrollListener.java +++ b/Common/src/main/java/at/petrak/hexcasting/client/ShiftScrollListener.java @@ -1,30 +1,36 @@ package at.petrak.hexcasting.client; +import at.petrak.hexcasting.api.mod.HexConfig; import at.petrak.hexcasting.common.lib.HexItems; import at.petrak.hexcasting.common.network.MsgShiftScrollSyn; import at.petrak.hexcasting.xplat.IClientXplatAbstractions; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.screens.Screen; import net.minecraft.client.player.LocalPlayer; -import net.minecraft.world.InteractionHand; import net.minecraft.world.item.Item; public class ShiftScrollListener { - public static boolean onScroll(double delta) { + private static double mainHandDelta = 0; + private static double offHandDelta = 0; + + public static boolean onScrollInGameplay(double delta) { + if (Minecraft.getInstance().screen != null) { + return false; + } + + return onScroll(delta, true); + } + + public static boolean onScroll(double delta, boolean needsSneaking) { LocalPlayer player = Minecraft.getInstance().player; // not .isCrouching! that fails for players who are not on the ground // yes, this does work if you remap your sneak key - if (player.isShiftKeyDown()) { - InteractionHand hand = null; + if (player != null && (player.isShiftKeyDown() || !needsSneaking)) { if (IsScrollableItem(player.getMainHandItem().getItem())) { - hand = InteractionHand.MAIN_HAND; + mainHandDelta += delta; + return true; } else if (IsScrollableItem(player.getOffhandItem().getItem())) { - hand = InteractionHand.OFF_HAND; - } - - if (hand != null) { - IClientXplatAbstractions.INSTANCE.sendPacketToServer( - new MsgShiftScrollSyn(hand, delta, Screen.hasControlDown())); + offHandDelta += delta; return true; } } @@ -32,6 +38,17 @@ public class ShiftScrollListener { return false; } + public static void clientTickEnd() { + if (mainHandDelta != 0 || offHandDelta != 0) { + IClientXplatAbstractions.INSTANCE.sendPacketToServer( + new MsgShiftScrollSyn(mainHandDelta, offHandDelta, Screen.hasControlDown(), + HexConfig.client().invertSpellbookScrollDirection(), + HexConfig.client().invertAbacusScrollDirection())); + mainHandDelta = 0; + offHandDelta = 0; + } + } + private static boolean IsScrollableItem(Item item) { return item == HexItems.SPELLBOOK || item == HexItems.ABACUS; } 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 ae7c8548..4bb0a9f0 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 @@ -11,14 +11,14 @@ import at.petrak.hexcasting.api.spell.math.HexDir import at.petrak.hexcasting.api.spell.math.HexPattern import at.petrak.hexcasting.api.utils.asTranslatedComponent import at.petrak.hexcasting.api.utils.otherHand +import at.petrak.hexcasting.client.ShiftScrollListener import at.petrak.hexcasting.client.drawPatternFromPoints import at.petrak.hexcasting.client.drawSpot +import at.petrak.hexcasting.client.ktxt.accumulatedScroll import at.petrak.hexcasting.client.sound.GridSoundInstance -import at.petrak.hexcasting.common.items.ItemSpellbook import at.petrak.hexcasting.common.lib.HexItems import at.petrak.hexcasting.common.lib.HexSounds import at.petrak.hexcasting.common.network.MsgNewSpellPatternSyn -import at.petrak.hexcasting.common.network.MsgShiftScrollSyn import at.petrak.hexcasting.xplat.IClientXplatAbstractions import com.mojang.blaze3d.systems.RenderSystem import com.mojang.blaze3d.vertex.PoseStack @@ -33,6 +33,7 @@ import net.minecraft.world.InteractionHand import net.minecraft.world.phys.Vec2 import kotlin.math.atan2 import kotlin.math.roundToInt +import kotlin.math.sign import kotlin.math.sqrt class GuiSpellcasting( @@ -235,15 +236,21 @@ class GuiSpellcasting( override fun mouseScrolled(pMouseX: Double, pMouseY: Double, pDelta: Double): Boolean { super.mouseScrolled(pMouseX, pMouseY, pDelta) - val otherHand = otherHand(this.handOpenedWith) - if (Minecraft.getInstance().player!!.getItemInHand(otherHand).item is ItemSpellbook) - IClientXplatAbstractions.INSTANCE.sendPacketToServer( - MsgShiftScrollSyn( - otherHand, - pDelta, - hasControlDown() - ) - ) + val mouseHandler = Minecraft.getInstance().mouseHandler + + if (mouseHandler.accumulatedScroll != 0.0 && sign(pDelta) != sign(mouseHandler.accumulatedScroll)) { + mouseHandler.accumulatedScroll = 0.0 + } + + mouseHandler.accumulatedScroll += pDelta + val accumulation: Int = mouseHandler.accumulatedScroll.toInt() + if (accumulation == 0) { + return true + } + + mouseHandler.accumulatedScroll -= accumulation.toDouble() + + ShiftScrollListener.onScroll(pDelta, false) return true } diff --git a/Common/src/main/java/at/petrak/hexcasting/client/ktxt/ClientAccessorWrappers.kt b/Common/src/main/java/at/petrak/hexcasting/client/ktxt/ClientAccessorWrappers.kt new file mode 100644 index 00000000..5863d7f0 --- /dev/null +++ b/Common/src/main/java/at/petrak/hexcasting/client/ktxt/ClientAccessorWrappers.kt @@ -0,0 +1,9 @@ +@file:JvmName("ClientAccessorWrappers") +package at.petrak.hexcasting.client.ktxt + +import at.petrak.hexcasting.mixin.accessor.client.AccessorMouseHandler +import net.minecraft.client.MouseHandler + +var MouseHandler.accumulatedScroll: Double + get() = (this as AccessorMouseHandler).`hex$getAccumulatedScroll`() + set(value) = (this as AccessorMouseHandler).`hex$setAccumulatedScroll`(value) 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 e9a0d904..d46e635a 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 @@ -25,7 +25,7 @@ import static at.petrak.hexcasting.api.HexAPI.modLoc; * Sent client->server when the client shift+scrolls with a shift-scrollable item * or scrolls in the spellcasting UI. */ -public record MsgShiftScrollSyn(InteractionHand hand, double scrollDelta, boolean isCtrl) implements IMessage { +public record MsgShiftScrollSyn(double mainHandDelta, double offHandDelta, boolean isCtrl, boolean invertSpellbook, boolean invertAbacus) implements IMessage { public static final ResourceLocation ID = modLoc("scroll"); @Override @@ -35,32 +35,47 @@ public record MsgShiftScrollSyn(InteractionHand hand, double scrollDelta, boolea public static MsgShiftScrollSyn deserialize(ByteBuf buffer) { var buf = new FriendlyByteBuf(buffer); - var hand = buf.readEnum(InteractionHand.class); - var scrollDelta = buf.readDouble(); + var mainHandDelta = buf.readDouble(); + var offHandDelta = buf.readDouble(); var isCtrl = buf.readBoolean(); - return new MsgShiftScrollSyn(hand, scrollDelta, isCtrl); + var invertSpellbook = buf.readBoolean(); + var invertAbacus = buf.readBoolean(); + return new MsgShiftScrollSyn(mainHandDelta, offHandDelta, isCtrl, invertSpellbook, invertAbacus); } public void serialize(FriendlyByteBuf buf) { - buf.writeEnum(this.hand); - buf.writeDouble(this.scrollDelta); + buf.writeDouble(this.mainHandDelta); + buf.writeDouble(this.offHandDelta); buf.writeBoolean(this.isCtrl); + buf.writeBoolean(this.invertSpellbook); + buf.writeBoolean(this.invertAbacus); } public void handle(MinecraftServer server, ServerPlayer sender) { server.execute(() -> { - var stack = sender.getItemInHand(hand); - - if (stack.getItem() == HexItems.SPELLBOOK) { - spellbook(sender, stack); - } else if (stack.getItem() == HexItems.ABACUS) { - abacus(sender, stack); - } + handleForHand(sender, InteractionHand.MAIN_HAND, mainHandDelta); + handleForHand(sender, InteractionHand.OFF_HAND, offHandDelta); }); } - private void spellbook(ServerPlayer sender, ItemStack stack) { - var newIdx = ItemSpellbook.RotatePageIdx(stack, this.scrollDelta < 0.0); + private void handleForHand(ServerPlayer sender, InteractionHand hand, double delta) { + if (delta != 0) { + var stack = sender.getItemInHand(hand); + + if (stack.getItem() == HexItems.SPELLBOOK) { + spellbook(sender, hand, stack, delta); + } else if (stack.getItem() == HexItems.ABACUS) { + abacus(sender, hand, stack, delta); + } + }; + } + + private void spellbook(ServerPlayer sender, InteractionHand hand, ItemStack stack, double delta) { + if (invertSpellbook) { + delta = -delta; + } + + var newIdx = ItemSpellbook.RotatePageIdx(stack, delta < 0.0); var len = ItemSpellbook.HighestPage(stack); @@ -99,21 +114,25 @@ public record MsgShiftScrollSyn(InteractionHand hand, double scrollDelta, boolea sender.displayClientMessage(component.withStyle(ChatFormatting.GRAY), true); } - private void abacus(ServerPlayer sender, ItemStack stack) { - var increase = this.scrollDelta < 0; + private void abacus(ServerPlayer sender, InteractionHand hand, ItemStack stack, double delta) { + if (invertAbacus) { + delta = -delta; + } + + var increase = delta < 0; double num = NBTHelper.getDouble(stack, ItemAbacus.TAG_VALUE); - double delta; + double shiftDelta; float pitch; - if (this.hand == InteractionHand.MAIN_HAND) { - delta = this.isCtrl ? 10 : 1; + if (hand == InteractionHand.MAIN_HAND) { + shiftDelta = this.isCtrl ? 10 : 1; pitch = this.isCtrl ? 0.7f : 0.9f; } else { - delta = this.isCtrl ? 0.01 : 0.1; + shiftDelta = this.isCtrl ? 0.01 : 0.1; pitch = this.isCtrl ? 1.3f : 1.0f; } - num += delta * (increase ? 1 : -1); + num += shiftDelta * (increase ? 1 : -1); NBTHelper.putDouble(stack, ItemAbacus.TAG_VALUE, num); pitch *= (increase ? 1.05f : 0.95f); diff --git a/Common/src/main/java/at/petrak/hexcasting/mixin/accessor/client/AccessorMouseHandler.java b/Common/src/main/java/at/petrak/hexcasting/mixin/accessor/client/AccessorMouseHandler.java new file mode 100644 index 00000000..d663d132 --- /dev/null +++ b/Common/src/main/java/at/petrak/hexcasting/mixin/accessor/client/AccessorMouseHandler.java @@ -0,0 +1,14 @@ +package at.petrak.hexcasting.mixin.accessor.client; + +import net.minecraft.client.MouseHandler; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.gen.Accessor; + +@Mixin(MouseHandler.class) +public interface AccessorMouseHandler { + @Accessor("accumulatedScroll") + double hex$getAccumulatedScroll(); + + @Accessor("accumulatedScroll") + void hex$setAccumulatedScroll(double scroll); +} diff --git a/Common/src/main/resources/hexplat.mixins.json b/Common/src/main/resources/hexplat.mixins.json index db8581fe..d0cc4b1c 100644 --- a/Common/src/main/resources/hexplat.mixins.json +++ b/Common/src/main/resources/hexplat.mixins.json @@ -21,6 +21,7 @@ "client": [ "accessor.client.AccessorCompositeRenderType", "accessor.client.AccessorEmptyTextureStateShard", + "accessor.client.AccessorMouseHandler", "accessor.client.AccessorRenderStateShard", "accessor.client.AccessorRenderType", "client.MixinClientLevel" 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 36fcecda..ac58d762 100644 --- a/Fabric/src/main/java/at/petrak/hexcasting/fabric/FabricHexClientInitializer.kt +++ b/Fabric/src/main/java/at/petrak/hexcasting/fabric/FabricHexClientInitializer.kt @@ -31,9 +31,12 @@ object FabricHexClientInitializer : ClientModInitializer { } HudRenderCallback.EVENT.register(HexAdditionalRenderers::overlayGui) WorldRenderEvents.START.register { ClientTickCounter.renderTickStart(it.tickDelta()) } - ClientTickEvents.END_CLIENT_TICK.register { ClientTickCounter.clientTickEnd() } + ClientTickEvents.END_CLIENT_TICK.register { + ClientTickCounter.clientTickEnd() + ShiftScrollListener.clientTickEnd() + } - MouseScrollCallback.EVENT.register(ShiftScrollListener::onScroll) + MouseScrollCallback.EVENT.register(ShiftScrollListener::onScrollInGameplay) RegisterClientStuff.init() RegisterClientStuff.registerParticles() 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 bf9a5375..f4b36e41 100644 --- a/Fabric/src/main/java/at/petrak/hexcasting/fabric/FabricHexConfig.java +++ b/Fabric/src/main/java/at/petrak/hexcasting/fabric/FabricHexConfig.java @@ -130,6 +130,8 @@ public class FabricHexConfig { private final PropertyMirror ctrlTogglesOffStrokeOrder = PropertyMirror.create(ConfigTypes.BOOLEAN); private final PropertyMirror gridSnapThreshold = PropertyMirror.create( ConfigTypes.DOUBLE.withMinimum(0.5).withMaximum(1.0)); + private final PropertyMirror invertSpellbookScrollDirection = PropertyMirror.create(ConfigTypes.BOOLEAN); + private final PropertyMirror invertAbacusScrollDirection = PropertyMirror.create(ConfigTypes.BOOLEAN); public ConfigTree configure(ConfigTreeBuilder bob) { bob @@ -146,6 +148,14 @@ public class FabricHexConfig { "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.") .finishValue(gridSnapThreshold::mirror) + .beginValue("invertSpellbookScrollDirection", ConfigTypes.BOOLEAN, DEFAULT_INVERT_SPELLBOOK_SCROLL) + .withComment("Whether scrolling up (as opposed to down) will increase the page index of the spellbook, and vice versa") + .finishValue(invertSpellbookScrollDirection::mirror) + + .beginValue("invertAbacusScrollDirection", ConfigTypes.BOOLEAN, DEFAULT_INVERT_ABACUS_SCROLL) + .withComment("Whether scrolling up (as opposed to down) will increase the value of the abacus, and vice versa") + .finishValue(invertAbacusScrollDirection::mirror) + ; return bob.build(); @@ -161,6 +171,16 @@ public class FabricHexConfig { return ctrlTogglesOffStrokeOrder.getValue(); } + @Override + public boolean invertSpellbookScrollDirection() { + return invertSpellbookScrollDirection.getValue(); + } + + @Override + public boolean invertAbacusScrollDirection() { + return invertAbacusScrollDirection.getValue(); + } + @Override public double gridSnapThreshold() { return gridSnapThreshold.getValue(); 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 2bf43a09..dbe92623 100644 --- a/Forge/src/main/java/at/petrak/hexcasting/forge/ForgeHexClientInitializer.java +++ b/Forge/src/main/java/at/petrak/hexcasting/forge/ForgeHexClientInitializer.java @@ -44,7 +44,7 @@ public class ForgeHexClientInitializer { }); evBus.addListener((InputEvent.MouseScrollEvent e) -> { - var cancel = ShiftScrollListener.onScroll(e.getScrollDelta()); + var cancel = ShiftScrollListener.onScrollInGameplay(e.getScrollDelta()); e.setCanceled(cancel); }); } 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 3cc21e42..ae83b577 100644 --- a/Forge/src/main/java/at/petrak/hexcasting/forge/ForgeHexConfig.java +++ b/Forge/src/main/java/at/petrak/hexcasting/forge/ForgeHexConfig.java @@ -53,6 +53,8 @@ public class ForgeHexConfig implements HexConfig.CommonConfigAccess { private static ForgeConfigSpec.DoubleValue patternPointSpeedMultiplier; private static ForgeConfigSpec.BooleanValue ctrlTogglesOffStrokeOrder; private static ForgeConfigSpec.DoubleValue gridSnapThreshold; + private static ForgeConfigSpec.BooleanValue invertSpellbookScrollDirection; + private static ForgeConfigSpec.BooleanValue invertAbacusScrollDirection; public Client(ForgeConfigSpec.Builder builder) { patternPointSpeedMultiplier = builder.comment( @@ -65,6 +67,22 @@ public class ForgeHexConfig implements HexConfig.CommonConfigAccess { gridSnapThreshold = builder.comment( "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." ).defineInRange("gridSnapThreshold", DEFAULT_GRID_SNAP_THRESHOLD, 0.5, 1.0); + invertSpellbookScrollDirection = builder.comment( + "Whether scrolling up (as opposed to down) will increase the page index of the spellbook, and vice versa") + .define("invertSpellbookScrollDirection", DEFAULT_INVERT_SPELLBOOK_SCROLL); + invertAbacusScrollDirection = builder.comment( + "Whether scrolling up (as opposed to down) will increase the value of the abacus, and vice versa") + .define("invertAbacusScrollDirection", DEFAULT_INVERT_ABACUS_SCROLL); + } + + @Override + public boolean invertSpellbookScrollDirection() { + return invertSpellbookScrollDirection.get(); + } + + @Override + public boolean invertAbacusScrollDirection() { + return invertAbacusScrollDirection.get(); } @Override From 7e92a8352c84375d76b94ad59b1fedc70e2d74be Mon Sep 17 00:00:00 2001 From: "yrsegal@gmail.com" Date: Sun, 24 Jul 2022 20:02:21 -0400 Subject: [PATCH 011/117] fix the cost of bonemeal port of b7561ce6194de4f1932afbee3705c3dbf8afe340 --- .../operators/spells/OpTheOnlyReasonAnyoneDownloadedPsi.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 71c8c7fd..d40c6bcb 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 @@ -24,7 +24,7 @@ object OpTheOnlyReasonAnyoneDownloadedPsi : SpellOperator { return Triple( Spell(target), - (ManaConstants.DUST_UNIT + 1.125).toInt(), + (ManaConstants.DUST_UNIT * 1.125).toInt(), listOf(ParticleSpray.burst(Vec3.atCenterOf(BlockPos(target)), 1.0)) ) } From 150f646ddf3b34c7f7aa4e03c06fc42decd03138 Mon Sep 17 00:00:00 2001 From: "yrsegal@gmail.com" Date: Sun, 24 Jul 2022 20:03:07 -0400 Subject: [PATCH 012/117] Fix #152 port of 9d089a20a69e87f3466d4a3d7741ccb6a3a3fd63 --- .../hexcasting/common/casting/operators/OpBlockAxisRaycast.kt | 2 +- .../hexcasting/common/casting/operators/OpBlockRaycast.kt | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) 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 2ee55971..0070be12 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 @@ -24,7 +24,7 @@ object OpBlockAxisRaycast : ConstManaOperator { ) ) - return if (blockHitResult.type == HitResult.Type.BLOCK) { + return if (blockHitResult.type == HitResult.Type.BLOCK && ctx.isVecInRange(Vec3.atCenterOf(blockHitResult.blockPos))) { blockHitResult.direction.step().asSpellResult } else { null.asSpellResult 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 e747c514..0da0082b 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 @@ -24,7 +24,7 @@ object OpBlockRaycast : ConstManaOperator { ) ) - return if (blockHitResult.type == HitResult.Type.BLOCK) { + return if (blockHitResult.type == HitResult.Type.BLOCK && ctx.isVecInRange(Vec3.atCenterOf(blockHitResult.blockPos))) { // the position on the bhr is the position of the specific *hit point*, which is actually on the outside of the block // this is weird (for example, casting OpBreakBlock at this position will not break the block we're looking at) // so we return the block pos instead From 64c143cfe93d9fceb4dd8da5fbe68500082c3ba0 Mon Sep 17 00:00:00 2001 From: "yrsegal@gmail.com" Date: Sun, 24 Jul 2022 20:03:45 -0400 Subject: [PATCH 013/117] Fix #154 port of 02804df55c9637f6e4cd31ff2d0bd16a50cbd7d2 --- .../at/petrak/hexcasting/api/spell/casting/CastingContext.kt | 4 ---- 1 file changed, 4 deletions(-) diff --git a/Common/src/main/java/at/petrak/hexcasting/api/spell/casting/CastingContext.kt b/Common/src/main/java/at/petrak/hexcasting/api/spell/casting/CastingContext.kt index 1e6bfc10..143d170b 100644 --- a/Common/src/main/java/at/petrak/hexcasting/api/spell/casting/CastingContext.kt +++ b/Common/src/main/java/at/petrak/hexcasting/api/spell/casting/CastingContext.kt @@ -39,10 +39,6 @@ data class CastingContext( private val entitiesGivenMotion = mutableSetOf() inline fun getHeldItemToOperateOn(acceptItemIf: (ItemStack) -> Boolean): Pair { - if (this.spellCircle == null) { - return caster.getItemInHand(otherHand) to otherHand - } - val handItem = caster.getItemInHand(castingHand) if (!acceptItemIf(handItem)) return caster.getItemInHand(otherHand) to otherHand From 25b594d75ae5fde2da71ae797a64c546be39bdcb Mon Sep 17 00:00:00 2001 From: "yrsegal@gmail.com" Date: Sun, 24 Jul 2022 20:04:36 -0400 Subject: [PATCH 014/117] Fix #156 port of 2be002118517cd0eb2524f531948b85a61c1f42f --- .../at/petrak/hexcasting/api/spell/casting/CastingContext.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Common/src/main/java/at/petrak/hexcasting/api/spell/casting/CastingContext.kt b/Common/src/main/java/at/petrak/hexcasting/api/spell/casting/CastingContext.kt index 143d170b..b0114a52 100644 --- a/Common/src/main/java/at/petrak/hexcasting/api/spell/casting/CastingContext.kt +++ b/Common/src/main/java/at/petrak/hexcasting/api/spell/casting/CastingContext.kt @@ -83,7 +83,7 @@ data class CastingContext( return entitiesGivenMotion.contains(target) } - fun isVecInWorld(vec: Vec3) = world.isInWorldBounds(BlockPos(vec)) && world.worldBorder.isWithinBounds(vec.x, vec.z) + fun isVecInWorld(vec: Vec3) = world.isInWorldBounds(BlockPos(vec)) && world.worldBorder.isWithinBounds(vec.x, vec.z, 0.5) fun isVecInRange(vec: Vec3): Boolean { val sentinel = IXplatAbstractions.INSTANCE.getSentinel(caster) From 549d6f685c2c042b0bc8097adc8a9548452e355d Mon Sep 17 00:00:00 2001 From: "yrsegal@gmail.com" Date: Sun, 24 Jul 2022 20:07:09 -0400 Subject: [PATCH 015/117] Fix #136 port of 1b01174186c312fb25c47f67de59055724e4de75 --- .../casting/operators/spells/OpBreakBlock.kt | 3 +++ .../casting/operators/spells/OpConjure.kt | 3 +++ .../casting/operators/spells/OpCreateWater.kt | 2 +- .../casting/operators/spells/OpPlaceBlock.kt | 4 ++++ .../operators/spells/great/OpCreateLava.kt | 8 ++----- .../hexcasting/xplat/IXplatAbstractions.java | 4 ++++ .../fabric/xplat/FabricXplatImpl.java | 17 ++++++++++++++ .../forge/xplat/ForgeXplatImpl.java | 22 +++++++++++++++---- 8 files changed, 52 insertions(+), 11 deletions(-) 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 abd9706b..632adad1 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 @@ -35,6 +35,9 @@ object OpBreakBlock : SpellOperator { return val blockstate = ctx.world.getBlockState(pos) + if (!IXplatAbstractions.INSTANCE.isBreakingAllowed(ctx.world, pos, blockstate, ctx.caster)) + return + val tier = HexConfig.server().opBreakHarvestLevel() diff --git a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/spells/OpConjure.kt b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/spells/OpConjure.kt index 6eca6d16..3bc9d21a 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/spells/OpConjure.kt +++ b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/spells/OpConjure.kt @@ -52,6 +52,9 @@ class OpConjure(val light: Boolean) : SpellOperator { val worldState = ctx.world.getBlockState(pos) if (worldState.canBeReplaced(placeContext)) { val block = if (this.light) HexBlocks.CONJURED_LIGHT else HexBlocks.CONJURED_BLOCK + if (!IXplatAbstractions.INSTANCE.isPlacingAllowed(ctx.world, pos, ItemStack(block), ctx.caster)) + return + val state = block.getStateForPlacement(placeContext) if (state != null) { ctx.world.setBlock(pos, state, 5) diff --git a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/spells/OpCreateWater.kt b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/spells/OpCreateWater.kt index 7dd8121e..58f23cd9 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/spells/OpCreateWater.kt +++ b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/spells/OpCreateWater.kt @@ -35,7 +35,7 @@ object OpCreateWater : SpellOperator { override fun cast(ctx: CastingContext) { val pos = BlockPos(target) - if (!ctx.world.mayInteract(ctx.caster, pos)) + if (!ctx.world.mayInteract(ctx.caster, pos)|| !IXplatAbstractions.INSTANCE.isPlacingAllowed(ctx.world, pos, ItemStack(Items.WATER_BUCKET), ctx.caster)) return val state = ctx.world.getBlockState(pos) 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 95758bfd..74472103 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,6 +4,7 @@ import at.petrak.hexcasting.api.misc.ManaConstants import at.petrak.hexcasting.api.spell.* import at.petrak.hexcasting.api.spell.casting.CastingContext import at.petrak.hexcasting.api.spell.mishaps.MishapBadBlock +import at.petrak.hexcasting.xplat.IXplatAbstractions import net.minecraft.core.BlockPos import net.minecraft.core.particles.BlockParticleOption import net.minecraft.core.particles.ParticleTypes @@ -64,6 +65,9 @@ object OpPlaceBlock : SpellOperator { val placeeSlot = ctx.getOperativeSlot { it.item is BlockItem } if (placeeSlot != null) { val placeeStack = ctx.caster.inventory.getItem(placeeSlot).copy() + if (!IXplatAbstractions.INSTANCE.isPlacingAllowed(ctx.world, pos, placeeStack, ctx.caster)) + return + if (!placeeStack.isEmpty) { // https://github.com/VazkiiMods/Psi/blob/master/src/main/java/vazkii/psi/common/spell/trick/block/PieceTrickPlaceBlock.java#L143 val oldStack = ctx.caster.getItemInHand(ctx.castingHand) diff --git a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/spells/great/OpCreateLava.kt b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/spells/great/OpCreateLava.kt index f0c8f0c6..13ca6c01 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/spells/great/OpCreateLava.kt +++ b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/spells/great/OpCreateLava.kt @@ -2,11 +2,7 @@ package at.petrak.hexcasting.common.casting.operators.spells.great import at.petrak.hexcasting.api.HexAPI import at.petrak.hexcasting.api.misc.ManaConstants -import at.petrak.hexcasting.api.spell.getChecked -import at.petrak.hexcasting.api.spell.ParticleSpray -import at.petrak.hexcasting.api.spell.RenderedSpell -import at.petrak.hexcasting.api.spell.SpellDatum -import at.petrak.hexcasting.api.spell.SpellOperator +import at.petrak.hexcasting.api.spell.* import at.petrak.hexcasting.api.spell.casting.CastingContext import at.petrak.hexcasting.xplat.IXplatAbstractions import net.minecraft.core.BlockPos @@ -39,7 +35,7 @@ object OpCreateLava : SpellOperator { override fun cast(ctx: CastingContext) { val pos = BlockPos(target) - if (!ctx.world.mayInteract(ctx.caster, pos)) + if (!ctx.world.mayInteract(ctx.caster, pos)|| !IXplatAbstractions.INSTANCE.isPlacingAllowed(ctx.world, pos, ItemStack(Items.LAVA_BUCKET), ctx.caster)) return val state = ctx.world.getBlockState(pos) 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 ad785a76..8654eb1d 100644 --- a/Common/src/main/java/at/petrak/hexcasting/xplat/IXplatAbstractions.java +++ b/Common/src/main/java/at/petrak/hexcasting/xplat/IXplatAbstractions.java @@ -143,6 +143,10 @@ public interface IXplatAbstractions { String getModName(String namespace); + boolean isBreakingAllowed(Level world, BlockPos pos, BlockState state, Player player); + + boolean isPlacingAllowed(Level world, BlockPos pos, ItemStack blockStack, Player player); + // interop PehkuiInterop.ApiAbstraction getPehkuiApi(); 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 34000d3f..af8f3e6b 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 @@ -24,6 +24,8 @@ import at.petrak.hexcasting.xplat.Platform; import com.jamieswhiteshirt.reachentityattributes.ReachEntityAttributes; import net.fabricmc.api.EnvType; import net.fabricmc.fabric.api.client.itemgroup.FabricItemGroupBuilder; +import net.fabricmc.fabric.api.event.player.PlayerBlockBreakEvents; +import net.fabricmc.fabric.api.event.player.UseItemCallback; import net.fabricmc.fabric.api.item.v1.FabricItemSettings; import net.fabricmc.fabric.api.networking.v1.PlayerLookup; import net.fabricmc.fabric.api.networking.v1.ServerPlayNetworking; @@ -46,6 +48,7 @@ import net.minecraft.server.level.ServerLevel; import net.minecraft.server.level.ServerPlayer; import net.minecraft.tags.TagKey; import net.minecraft.world.InteractionHand; +import net.minecraft.world.InteractionResult; import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.EquipmentSlot; import net.minecraft.world.entity.Mob; @@ -357,6 +360,20 @@ public class FabricXplatImpl implements IXplatAbstractions { return namespace; } + @Override + public boolean isBreakingAllowed(Level world, BlockPos pos, BlockState state, Player player) { + return PlayerBlockBreakEvents.BEFORE.invoker().beforeBlockBreak(world, player, pos, state, world.getBlockEntity(pos)); + } + + @Override + public boolean isPlacingAllowed(Level world, BlockPos pos, ItemStack blockStack, Player player) { + ItemStack cached = player.getMainHandItem(); + player.setItemInHand(InteractionHand.MAIN_HAND, blockStack.copy()); + var success = UseItemCallback.EVENT.invoker().interact(player, world, InteractionHand.MAIN_HAND); + player.setItemInHand(InteractionHand.MAIN_HAND, cached); + return success.getResult() == InteractionResult.PASS; // No other mod tried to consume this + } + private static PehkuiInterop.ApiAbstraction PEHKUI_API = null; @Override 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 c82e0fc9..f1a24096 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 @@ -58,17 +58,17 @@ import net.minecraft.world.level.block.entity.BlockEntityType; import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.material.Fluid; import net.minecraft.world.level.storage.loot.predicates.LootItemCondition; +import net.minecraft.world.phys.BlockHitResult; import net.minecraft.world.phys.Vec3; import net.minecraftforge.api.distmarker.Dist; -import net.minecraftforge.common.ForgeMod; -import net.minecraftforge.common.TierSortingRegistry; -import net.minecraftforge.common.ToolActions; +import net.minecraftforge.common.*; import net.minecraftforge.common.loot.CanToolPerformAction; +import net.minecraftforge.event.world.BlockEvent; import net.minecraftforge.fluids.FluidAttributes; import net.minecraftforge.fluids.FluidStack; import net.minecraftforge.fluids.FluidUtil; -import net.minecraftforge.fml.ModContainer; import net.minecraftforge.fluids.capability.IFluidHandler; +import net.minecraftforge.fml.ModContainer; import net.minecraftforge.fml.ModList; import net.minecraftforge.fml.loading.FMLLoader; import net.minecraftforge.network.NetworkDirection; @@ -402,6 +402,20 @@ public class ForgeXplatImpl implements IXplatAbstractions { return namespace; } + @Override + public boolean isBreakingAllowed(Level world, BlockPos pos, BlockState state, Player player) { + return !MinecraftForge.EVENT_BUS.post(new BlockEvent.BreakEvent(world, pos, state, player)); + } + + @Override + public boolean isPlacingAllowed(Level world, BlockPos pos, ItemStack blockStack, Player player) { + ItemStack cached = player.getMainHandItem(); + player.setItemInHand(InteractionHand.MAIN_HAND, blockStack.copy()); + var evt = ForgeHooks.onRightClickBlock(player, InteractionHand.MAIN_HAND, pos, new BlockHitResult(Vec3.atCenterOf(pos), Direction.DOWN, pos, true)); + player.setItemInHand(InteractionHand.MAIN_HAND, cached); + return !evt.isCanceled(); + } + // it's literally the EXACT SAME on fabric aaa private static PehkuiInterop.ApiAbstraction PEHKUI_API = null; From f0b85dfb3a8416df59a180a8141cd560c60117e4 Mon Sep 17 00:00:00 2001 From: "yrsegal@gmail.com" Date: Sun, 24 Jul 2022 20:16:51 -0400 Subject: [PATCH 016/117] Fix #135 port of 21ce790bb796ad69b1c251ade7f8d0426a937f87 --- Common/src/generated/resources/.cache/cache | 1 + .../hexcasting/models/block/conjured.json | 5 ++ .../datagen/recipe/HexplatRecipes.java | 10 ++- Fabric/src/generated/resources/.cache/cache | 64 +++++++++---------- .../recipes/dye_colorizer_black.json | 7 +- .../recipes/dye_colorizer_blue.json | 7 +- .../recipes/dye_colorizer_brown.json | 7 +- .../recipes/dye_colorizer_cyan.json | 7 +- .../recipes/dye_colorizer_gray.json | 7 +- .../recipes/dye_colorizer_green.json | 7 +- .../recipes/dye_colorizer_light_blue.json | 7 +- .../recipes/dye_colorizer_light_gray.json | 7 +- .../recipes/dye_colorizer_lime.json | 7 +- .../recipes/dye_colorizer_magenta.json | 7 +- .../recipes/dye_colorizer_orange.json | 7 +- .../recipes/dye_colorizer_pink.json | 7 +- .../recipes/dye_colorizer_purple.json | 7 +- .../hexcasting/recipes/dye_colorizer_red.json | 7 +- .../recipes/dye_colorizer_white.json | 7 +- .../recipes/dye_colorizer_yellow.json | 7 +- .../recipes/pride_colorizer_agender.json | 7 +- .../recipes/pride_colorizer_aroace.json | 7 +- .../recipes/pride_colorizer_aromantic.json | 7 +- .../recipes/pride_colorizer_asexual.json | 7 +- .../recipes/pride_colorizer_bisexual.json | 7 +- .../recipes/pride_colorizer_demiboy.json | 7 +- .../recipes/pride_colorizer_demigirl.json | 7 +- .../recipes/pride_colorizer_gay.json | 7 +- .../recipes/pride_colorizer_genderfluid.json | 7 +- .../recipes/pride_colorizer_genderqueer.json | 7 +- .../recipes/pride_colorizer_intersex.json | 7 +- .../recipes/pride_colorizer_lesbian.json | 7 +- .../recipes/pride_colorizer_nonbinary.json | 7 +- .../recipes/pride_colorizer_pansexual.json | 7 +- .../recipes/pride_colorizer_plural.json | 7 +- .../recipes/pride_colorizer_transgender.json | 7 +- Forge/src/generated/resources/.cache/cache | 64 +++++++++---------- .../recipes/dye_colorizer_black.json | 7 +- .../recipes/dye_colorizer_blue.json | 7 +- .../recipes/dye_colorizer_brown.json | 7 +- .../recipes/dye_colorizer_cyan.json | 7 +- .../recipes/dye_colorizer_gray.json | 7 +- .../recipes/dye_colorizer_green.json | 7 +- .../recipes/dye_colorizer_light_blue.json | 7 +- .../recipes/dye_colorizer_light_gray.json | 7 +- .../recipes/dye_colorizer_lime.json | 7 +- .../recipes/dye_colorizer_magenta.json | 7 +- .../recipes/dye_colorizer_orange.json | 7 +- .../recipes/dye_colorizer_pink.json | 7 +- .../recipes/dye_colorizer_purple.json | 7 +- .../hexcasting/recipes/dye_colorizer_red.json | 7 +- .../recipes/dye_colorizer_white.json | 7 +- .../recipes/dye_colorizer_yellow.json | 7 +- .../recipes/pride_colorizer_agender.json | 7 +- .../recipes/pride_colorizer_aroace.json | 7 +- .../recipes/pride_colorizer_aromantic.json | 7 +- .../recipes/pride_colorizer_asexual.json | 7 +- .../recipes/pride_colorizer_bisexual.json | 7 +- .../recipes/pride_colorizer_demiboy.json | 7 +- .../recipes/pride_colorizer_demigirl.json | 7 +- .../recipes/pride_colorizer_gay.json | 7 +- .../recipes/pride_colorizer_genderfluid.json | 7 +- .../recipes/pride_colorizer_genderqueer.json | 7 +- .../recipes/pride_colorizer_intersex.json | 7 +- .../recipes/pride_colorizer_lesbian.json | 7 +- .../recipes/pride_colorizer_nonbinary.json | 7 +- .../recipes/pride_colorizer_pansexual.json | 7 +- .../recipes/pride_colorizer_plural.json | 7 +- .../recipes/pride_colorizer_transgender.json | 7 +- .../xplat/HexBlockStatesAndModels.java | 2 +- 70 files changed, 203 insertions(+), 391 deletions(-) create mode 100644 Common/src/generated/resources/assets/hexcasting/models/block/conjured.json diff --git a/Common/src/generated/resources/.cache/cache b/Common/src/generated/resources/.cache/cache index 76076938..390f2ff6 100644 --- a/Common/src/generated/resources/.cache/cache +++ b/Common/src/generated/resources/.cache/cache @@ -100,6 +100,7 @@ e85c2dfe9a161a97723871ab1ce8c973dcbf23d4 assets/hexcasting/models/block/amethyst df994438c20d9dec9009c9c56de74860a847681b assets/hexcasting/models/block/amethyst_tiles.json 4e65ad75eeee22fa1d2c899fc86ac8b7b9a43701 assets/hexcasting/models/block/ancient_scroll_paper.json 062366f91878466f15ebeeaa11d3fa4906918f7b assets/hexcasting/models/block/ancient_scroll_paper_lantern.json +447abb147b12bbfa0899cd3fb86d80fb759669b3 assets/hexcasting/models/block/conjured.json dee605b03de1e145b8fe1b5e57cbc86cc8ceae9e assets/hexcasting/models/block/empty_directrix_dim_x.json f23e20b75d407758c1def44d7f7a6c648fac3d59 assets/hexcasting/models/block/empty_directrix_dim_y.json f5f34f91c22a91e479a038cedd383fa807385d20 assets/hexcasting/models/block/empty_directrix_dim_z.json diff --git a/Common/src/generated/resources/assets/hexcasting/models/block/conjured.json b/Common/src/generated/resources/assets/hexcasting/models/block/conjured.json new file mode 100644 index 00000000..4e90fd01 --- /dev/null +++ b/Common/src/generated/resources/assets/hexcasting/models/block/conjured.json @@ -0,0 +1,5 @@ +{ + "textures": { + "particle": "minecraft:block/amethyst_block" + } +} \ No newline at end of file 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 6f143ca0..4afd5169 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 @@ -123,12 +123,11 @@ public class HexplatRecipes extends PaucalRecipeProvider { for (var dye : DyeColor.values()) { var item = HexItems.DYE_COLORIZERS.get(dye); ShapedRecipeBuilder.shaped(item) - .define('B', Items.BOWL) .define('D', HexItems.AMETHYST_DUST) .define('C', DyeItem.byColor(dye)) - .pattern(" C ") .pattern(" D ") - .pattern(" B ") + .pattern("DCD") + .pattern(" D ") .unlockedBy("has_item", hasItem(HexItems.AMETHYST_DUST)).save(recipes); } @@ -402,12 +401,11 @@ public class HexplatRecipes extends PaucalRecipeProvider { private void gayRecipe(Consumer recipes, ItemPrideColorizer.Type type, Item material) { var colorizer = HexItems.PRIDE_COLORIZERS.get(type); ShapedRecipeBuilder.shaped(colorizer) - .define('B', Items.BOWL) .define('D', HexItems.AMETHYST_DUST) .define('C', material) - .pattern(" C ") .pattern(" D ") - .pattern(" B ") + .pattern("DCD") + .pattern(" D ") .unlockedBy("has_item", hasItem(HexItems.AMETHYST_DUST)).save(recipes); } diff --git a/Fabric/src/generated/resources/.cache/cache b/Fabric/src/generated/resources/.cache/cache index 17cfbaa1..e872333c 100644 --- a/Fabric/src/generated/resources/.cache/cache +++ b/Fabric/src/generated/resources/.cache/cache @@ -1,6 +1,6 @@ 556d2e6068965e90c307a435b372ae761cd1c606 data/minecraft/tags/items/wooden_doors.json b596d96eebb4f7bad5930f4eebc589f292b59c98 data/minecraft/tags/items/planks.json -a00a851be50d49034ff939ca5fb3adbe0ee47302 data/hexcasting/recipes/pride_colorizer_pansexual.json +568ac8a13b7762b92cc274d74a7c729cc6e16687 data/hexcasting/recipes/pride_colorizer_pansexual.json c521621c409275e219f72abf5c6089d60408e646 data/hexcasting/loot_tables/blocks/impetus_rightclick.json 023c32e8834eb313c4fa94a84a8f6390ee951ef0 data/hexcasting/advancements/recipes/hexcasting.creative_tab/empty_impetus.json bdf848284137f0116ddf4725b0dda6eaa0cef5fd data/hexcasting/loot_tables/blocks/akashic_wood_stripped.json @@ -20,21 +20,21 @@ b107ec9af9e08d124f3d4f14d85911f55a5b905b data/hexcasting/recipes/akashic_pressur cd3ca380294544b07e91ce85d97808c30ffa5d17 data/hexcasting/advancements/recipes/hexcasting.creative_tab/spellbook.json 7351200c8e3eb24772852c578286384c8aab61bd data/hexcasting/advancements/recipes/hexcasting.creative_tab/empty_directrix.json e0ff0fe75be853b849f84b05787c1c791fa9e208 data/hexcasting/advancements/recipes/hexcasting.creative_tab/akashic_stairs.json -c5341777604a4be5a311e300a4de89967b7caad2 data/hexcasting/recipes/dye_colorizer_yellow.json +d910f10b472c3ff422f14961539e4c31b8830bff data/hexcasting/recipes/dye_colorizer_yellow.json 918075a87ccc30a489aa8cafa2de992dd179aeac data/hexcasting/advancements/recipes/hexcasting.creative_tab/dye_colorizer_lime.json 9f7a9ba332e1018098d21a5ec474440fca7f6c73 data/hexcasting/recipes/brainsweep/directrix_redstone.json 779b7b9be93062e935972af1cff9c79fa5440a23 data/hexcasting/recipes/amethyst_sconce.json -29559dc2a5c4e189ab7edfbb71fed0a84dd96d45 data/hexcasting/recipes/dye_colorizer_red.json +b475e6d26350d0560e2cd66879f86520faaeb68c data/hexcasting/recipes/dye_colorizer_red.json 811177c2ddc341f7a6d8704e1eb273f200aee3a1 data/hexcasting/loot_tables/blocks/akashic_button.json 4d4caaea035ae4ee878843dd2455042b299b4e5e data/c/tags/items/amethyst_dusts.json 5f9f0962f407062e7b6dd0e8c5f8c55ce13962a5 data/hexcasting/advancements/recipes/brainsweep/brainsweep/impetus_rightclick.json 7f165b1783a871cf69db2e9978290f8993665649 data/hexcasting/advancements/recipes/hexcasting.creative_tab/cypher.json -21765e0f23ca7932c9c4891f1c36bc5a5faa54b9 data/hexcasting/recipes/pride_colorizer_transgender.json -c331d1b6a4d3d42eac052e73ff0b90d7dc117745 data/hexcasting/recipes/pride_colorizer_demigirl.json +f50c71bbbbf7d77665c9008fcdd9be0d571ce48e data/hexcasting/recipes/pride_colorizer_transgender.json +d3ad9a9e92dd125f872d9671930d4e57f24894ed data/hexcasting/recipes/pride_colorizer_demigirl.json b684bfa3755ca25996e74152d2efecbc9d6387d8 data/hexcasting/advancements/recipes/hexcasting.creative_tab/stonecutting/amethyst_tiles.json 2d79a41ba8697f9e1fa26b1bff48f33c824d3823 data/minecraft/tags/blocks/pressure_plates.json add097a7a749bd1ebd5828216f013f6cd5b72b62 data/hexcasting/recipes/akashic_door.json -4fad619e1330e938d2e2596fc8fd4e5050a8b40e data/hexcasting/recipes/dye_colorizer_lime.json +3e89b354e3eb8f8ec2518b03f13c5c4295adef5f data/hexcasting/recipes/dye_colorizer_lime.json 5d4811f78feefbef0a305555143f488b3dac7ac6 data/hexcasting/advancements/recipes/brainsweep/brainsweep/impetus_storedplayer.json 85fea90b80954899f236e52d3b3a25f305f8b9d5 data/hexcasting/advancements/recipes/hexcasting.creative_tab/scroll_paper_lantern.json 1ba431aef086bb60bfe8fe01b4d2bf5dfb7593c4 data/hexcasting/loot_tables/blocks/impetus_look.json @@ -73,9 +73,9 @@ b8b58bbaf1ddca3514896af14db83f304e415305 data/minecraft/tags/items/wooden_trapdo 48e782ce4fbd486dd0d6ceb9fdcb94d0e0c727d4 data/minecraft/tags/items/slabs.json fdce54a0e527322819787ec9232b24d401c45a29 data/hexcasting/advancements/recipes/hexcasting.creative_tab/pride_colorizer_demiboy.json ef936e73eea3be9d53c4ac5c78d1477675550375 data/hexcasting/recipes/stonecutting/amethyst_tiles.json -bc79add419b8791e68b35076355fea11dfc640c6 data/hexcasting/recipes/dye_colorizer_white.json +88cf11d37222254d9e3a4bef0f9ca2de1495c31a data/hexcasting/recipes/dye_colorizer_white.json 0e95c5f97c4089d654334a0d58fbf2b808548bd0 data/hexcasting/advancements/recipes/hexcasting.creative_tab/dye_colorizer_gray.json -16fd879351f390bfa980a5f4d77e32f576de2f66 data/hexcasting/recipes/dye_colorizer_purple.json +eb06eb90c08b051ff6c42215fb7c91123e240a66 data/hexcasting/recipes/dye_colorizer_purple.json 55dded121a8dddb2ee7fb1f3ffcdcd1ada4afbd5 data/hexcasting/advancements/recipes/hexcasting.creative_tab/akashic_wood.json 9d4704f96cc4cfa3275092fb58ff90c98449abe3 data/hexcasting/loot_tables/blocks/ancient_scroll_paper.json 022dc03ce6f2915459c7bf75d44ec0b8bb3e4083 data/hexcasting/recipes/wand_dark_oak.json @@ -84,7 +84,7 @@ e454c9f48ec394f4d353c5a6c04641c9871b8798 data/hexcasting/advancements/recipes/he c25784941d6416744fb2ca2d43a3203e5c3e7c8a data/minecraft/tags/blocks/leaves.json a952d33cda8b805237052b602cf066683c4bf261 data/hexcasting/recipes/empty_directrix.json f6fab3a3296d157a2b969af0c86eb0e5a9f14df4 data/hexcasting/recipes/wand_birch.json -3ce0bea99cfbac7d316f4439ee79ac6b7f6f5b61 data/hexcasting/recipes/pride_colorizer_plural.json +b2d8fb979a3fbe47404da349318f38ab45bac760 data/hexcasting/recipes/pride_colorizer_plural.json 2397e64bd5fa2af12bb4f0f7efbc55f387c07a2b data/hexcasting/recipes/lens.json d72a4675ceb721ee4ac43339d8bfbbb82c2adba2 data/hexcasting/advancements/recipes/hexcasting.creative_tab/slate_block.json 090b54b026f6fef2502295ddde5a60f5350e2ec6 data/hexcasting/advancements/recipes/hexcasting.creative_tab/artifact.json @@ -94,7 +94,7 @@ b8b58bbaf1ddca3514896af14db83f304e415305 data/minecraft/tags/items/trapdoors.jso f8d2872c4e692153049b6ae4879755a079954763 data/hexcasting/advancements/recipes/hexcasting.creative_tab/wand_spruce.json 26e9416771d97f9c716d07c27b1b5ca4a267eea2 data/hexcasting/loot_tables/blocks/amethyst_dust_block.json 05d435799cbf3ee1b51c5b4ffeace507691bcf2a data/hexcasting/advancements/recipes/hexcasting.creative_tab/pride_colorizer_gay.json -e4ef73afbd13a579493f45929c3f7adb8aa86dc2 data/hexcasting/recipes/dye_colorizer_cyan.json +44d5d32647164e5510ecdbde22addbc047e4603a data/hexcasting/recipes/dye_colorizer_cyan.json 8aa3d09d72255aa4da497ab4225654961063a496 data/hexcasting/recipes/ancient_scroll_paper.json e5ae652aee1567ac2e626fa0f88f160993a6f9a5 data/hexcasting/advancements/recipes/hexcasting.creative_tab/amethyst_dust_unpacking.json 7c0107192c0e24ff9f23ab0f59834b6081ca5b33 data/hexcasting/advancements/recipes/hexcasting.creative_tab/wand_crimson.json @@ -110,16 +110,16 @@ fc57d15e9f9f11347a2170dd06053954345368d2 data/hexcasting/advancements/recipes/he cd63a4179aa8c6aff90b251995bc4e8e1a71a784 data/hexcasting/loot_tables/blocks/akashic_leaves3.json f3c6b6917e504e1c3d5d8875f7cce6f311e791d2 data/hexcasting/tags/blocks/akashic_logs.json 66e51300dc72c27ed8024ddf852ac9a6208a66b1 data/hexcasting/advancements/recipes/hexcasting.creative_tab/akashic_bookshelf.json -fe5f10e9258f430859f1f1f87320a2b5c7b67654 data/hexcasting/recipes/dye_colorizer_green.json +3b082fff535586c13c12811a29839eb0096bfdb1 data/hexcasting/recipes/dye_colorizer_green.json d4328adfccf702d2de3eb6098a47c95e429b7b28 data/hexcasting/loot_tables/blocks/akashic_door.json -6f1c0a84236b1e3cb4352d87bf3d553eb7e1a938 data/hexcasting/recipes/dye_colorizer_orange.json +186dc05888e66e17af0217bd0680648dc3da3968 data/hexcasting/recipes/dye_colorizer_orange.json 737ac05e20d6633abd383d654f7cd7e92564447b data/hexcasting/loot_tables/blocks/directrix_redstone.json b7c248d2627c2a2b398d1c50181c1e0863612424 data/hexcasting/recipes/empty_impetus.json 3fe1fcf17e1e25aebede47c537f92888330ccf9f data/hexcasting/advancements/recipes/hexcasting.creative_tab/abacus.json 4dc3f5865d69a604923cb59f4a3eed7b4aa175cf data/hexcasting/recipes/ageing_scroll_paper_lantern.json eb4bfbd7fc7632a5c16aa1d50d6090a1f466069b data/minecraft/tags/blocks/mineable/pickaxe.json 43071f2aa09fa59dd8f0211a68c842dac833be02 data/hexcasting/advancements/recipes/hexcasting.creative_tab/scroll.json -fa30b1fb1c6fc9e763d5ce0e4dcfd71afcc81de2 data/hexcasting/recipes/pride_colorizer_agender.json +37584409884ac4d9fbf7f0a4a3cb8ef3b5d32965 data/hexcasting/recipes/pride_colorizer_agender.json 556d2e6068965e90c307a435b372ae761cd1c606 data/minecraft/tags/items/doors.json 804f0e5c6c32c7310129437ccca3ffc148bb973b data/hexcasting/advancements/recipes/hexcasting.creative_tab/wand_acacia.json 3b2bcffe70bb1f732f06c2560cef66de6c273d62 data/hexcasting/advancements/recipes/hexcasting.creative_tab/wand_warped.json @@ -127,7 +127,7 @@ ddd7bd92b9e1586cebd2cee658315a9336a80a76 data/hexcasting/advancements/recipes/he 318c04242e7b9c302e68b3bfe6dd11ec0fc8a863 data/hexcasting/advancements/recipes/hexcasting.creative_tab/wand_jungle.json 2c542a616b312e41537fb25a2362877dd50d2692 data/hexcasting/recipes/akashic_connector.json 6837c1fe0ab23167ca8475086b28115369227e0c data/hexcasting/advancements/recipes/hexcasting.creative_tab/dye_colorizer_light_gray.json -9b2b94e2eabaa8260a15191bb869ceb3ca80779c data/hexcasting/recipes/pride_colorizer_aromantic.json +5e6df78e451395e08f86c8d89dca0a2c99a69691 data/hexcasting/recipes/pride_colorizer_aromantic.json c2a362b8c19cb288187d8ff340f82198edc54378 data/hexcasting/advancements/recipes/brainsweep/brainsweep/budding_amethyst.json b9083c4c0a7a365bdfd785a21826a89dc8d5db52 data/hexcasting/loot_tables/blocks/akashic_record.json 2d52419f3fcdc10643cdb8cef89858efc0ad4d11 data/hexcasting/advancements/recipes/hexcasting.creative_tab/wand_akashic.json @@ -142,14 +142,14 @@ d7f85ce9d46aacc7ec89dc7aa0f88a331ccfbae7 data/hexcasting/recipes/brainsweep/akas ce79c9e183b57bfbdb75cd074d7ff6e48894d05c data/hexcasting/loot_tables/blocks/akashic_connector.json f3c6b6917e504e1c3d5d8875f7cce6f311e791d2 data/minecraft/tags/items/logs.json 49b6ea97ddc55ef3d7fa47582f268a07a35cadde data/hexcasting/loot_tables/blocks/slate.json -c830f27bdee064af5bf2f1b2466042cf208c6788 data/hexcasting/recipes/pride_colorizer_intersex.json +ac128e72adda8fea0ad63d7e6e18dd9399f53d65 data/hexcasting/recipes/pride_colorizer_intersex.json 99aae9efc13ff2b8a4612579b2f865ed2fbe8985 data/hexcasting/advancements/recipes/hexcasting.creative_tab/akashic_tile.json eb771389a05a4cdfb98286942f2a65bf2a77458f data/hexcasting/advancements/recipes/hexcasting.creative_tab/pride_colorizer_lesbian.json d8825a8cbaf100d309b4bd8ac26ed22b020011cb data/hexcasting/advancements/recipes/hexcasting.creative_tab/scroll_medium.json 556d2e6068965e90c307a435b372ae761cd1c606 data/minecraft/tags/blocks/doors.json f089ab17470c5fa0065438c5533d5fafb3ee8eaf data/hexcasting/advancements/recipes/hexcasting.creative_tab/focus.json 39a4ba8180e45cab481184d2bcdc217893244446 data/hexcasting/advancements/recipes/hexcasting.creative_tab/pride_colorizer_asexual.json -43c7ffd19f2364de00b1e2cf8794ce5cf36494fb data/hexcasting/recipes/pride_colorizer_nonbinary.json +cd7e618d7c08ffff67683852f799362fb8aaebaf data/hexcasting/recipes/pride_colorizer_nonbinary.json 9fcc0862c99c50a1df9d3af95b2b3c2af28afa1b data/hexcasting/advancements/recipes/hexcasting.creative_tab/slate_block_from_slates.json 48e782ce4fbd486dd0d6ceb9fdcb94d0e0c727d4 data/minecraft/tags/items/wooden_slabs.json cf855b595844c6f2522c0ad18030519279b396ad data/hexcasting/advancements/recipes/hexcasting.creative_tab/dye_colorizer_magenta.json @@ -166,12 +166,12 @@ b596d96eebb4f7bad5930f4eebc589f292b59c98 data/minecraft/tags/blocks/planks.json 8dab47781281a29e39cb8e6c4da6a27f916e0646 data/hexcasting/advancements/recipes/hexcasting.creative_tab/pride_colorizer_nonbinary.json 7a535e710c96e39a17606a10bc1f153d7c57b8e7 data/hexcasting/advancements/recipes/hexcasting.creative_tab/akashic_pressure_plate.json 26782da27b3ce2dcab8545f672d68fe1a8549f35 data/hexcasting/advancements/recipes/hexcasting.creative_tab/akashic_slab.json -fe8a7288aa27c07932a31c64ff8fadb943b278d5 data/hexcasting/recipes/dye_colorizer_pink.json +6f904b1ac6fc5863a8e718bc42043c40d5ec4c2a data/hexcasting/recipes/dye_colorizer_pink.json 16705d340500a2796facb4256852fd3d8e9775f8 data/hexcasting/loot_tables/blocks/akashic_wood.json b3583f65db5e1eaae0426b14416c076982ca3685 data/hexcasting/advancements/recipes/hexcasting.creative_tab/pride_colorizer_aroace.json d6355142e6edb7964c95997dc877a3652081f793 data/hexcasting/loot_tables/blocks/amethyst_tiles.json a4f3fed2e6ddc8e60a19a1a51bd5b54904a43fa8 data/hexcasting/advancements/recipes/hexcasting.creative_tab/pride_colorizer_agender.json -d0e37cea33e6323cb1936c44ed959e3dc8238bb7 data/hexcasting/recipes/pride_colorizer_genderqueer.json +456ae69977612b6f62c109783518e9006287e77b data/hexcasting/recipes/pride_colorizer_genderqueer.json 563cb6dda9c55864f141f2ec0ecd2a2b95f57237 data/hexcasting/advancements/recipes/hexcasting.creative_tab/amethyst_tiles.json 86ee80768fef41cf9b517564b733f4586094f367 data/hexcasting/recipes/scroll_medium.json b519fd81671c9cb8d909bbfd0d4017d2005432d3 data/hexcasting/advancements/recipes/hexcasting.creative_tab/dye_colorizer_blue.json @@ -185,13 +185,13 @@ d7213631b2f9075c9bdef0d5a48ca28f85f5a090 data/hexcasting/advancements/recipes/he 9c857c4aeda8a1b3d7a1b5d341871a9434b5816f data/hexcasting/advancements/recipes/hexcasting.creative_tab/dye_colorizer_yellow.json 149179e18b1b8db5dc3fb96e6faa6cb6ffaecb75 data/hexcasting/advancements/recipes/hexcasting.creative_tab/akashic_panel.json 1157a6545ece0e2b8734b8a1428f9a3c021c8b73 data/hexcasting/recipes/wand_akashic.json -386f1b0f7676324186d0694de3c86a77fac5ce98 data/hexcasting/recipes/dye_colorizer_magenta.json +4d1c771493f5968a0878c142342ceb8717a5784f data/hexcasting/recipes/dye_colorizer_magenta.json 1dc89dff5d4fadb95d9b5a2a5a910f63ea4b02bf data/minecraft/tags/blocks/crystal_sound_blocks.json 05e86742a71afd740f47639be62f93bc9898fcde data/c/tags/items/gems.json -b4f71066f51788ce3d05429dcd5d1e451bcb7503 data/hexcasting/recipes/pride_colorizer_asexual.json +0a72e213fec8dd32b1ea9623a242484ce8318c47 data/hexcasting/recipes/pride_colorizer_asexual.json ccf4ea841ea9a66738253385c659ff86c85a73f5 data/hexcasting/recipes/scroll_paper.json 0cd94b91d64a31a251eebbb37845d165c603452e data/hexcasting/recipes/wand_crimson.json -57fe1e77bc786588a764620e65f0631254544b1f data/hexcasting/recipes/pride_colorizer_genderfluid.json +0ca193fe94bc004aa0080826ed0fc4596f9a62dd data/hexcasting/recipes/pride_colorizer_genderfluid.json 08f14a615c6c8c0b8a08a56af000c1e1991732d3 data/hexcasting/advancements/recipes/hexcasting.creative_tab/trinket.json a2ea936ff220d9faa168ffbc60a9823de2119ac5 data/hexcasting/recipes/cypher.json 7077bb190244008a715eab451c80e8d489844c01 data/hexcasting/loot_tables/blocks/empty_impetus.json @@ -201,20 +201,20 @@ b8b58bbaf1ddca3514896af14db83f304e415305 data/minecraft/tags/blocks/wooden_trapd 6f33e68b62de15df1673b772d37171b130e3c9bb data/hexcasting/advancements/recipes/hexcasting.creative_tab/pride_colorizer_plural.json f55afc2c05d93b5a44bc9fd73c5e81e71b183965 data/minecraft/tags/blocks/mineable/shovel.json fe60c763bfe0afa0a266b7390edfc62bde8941b7 data/hexcasting/tags/items/phial_base.json -c471220e70ee9ecbf58a21ea1d28e653efcc4fad data/hexcasting/recipes/dye_colorizer_gray.json -b162dffb52838921c3a354d817465a23df64ec00 data/hexcasting/recipes/pride_colorizer_aroace.json +8df59ac1ca676bf1a506f3116fd273d6379f238e data/hexcasting/recipes/dye_colorizer_gray.json +c3a01df30228881c199686192d105fb2651c39c8 data/hexcasting/recipes/pride_colorizer_aroace.json 59000d9f3edb942081f7d1e03d753e9cd59690cc data/hexcasting/advancements/recipes/hexcasting.creative_tab/sub_sandwich.json 49508c455626eeca18c957edc0cde016e823f7b0 data/hexcasting/recipes/scroll.json 6f5c41ab9f87ec1206efaaab8d91adc766bb79fd data/hexcasting/recipes/slate_block_from_slates.json f74f8389f1e8bdb77a92ecfb8d7d7d6f4418d818 data/hexcasting/recipes/akashic_panel.json 72795bfbffffa8ab2a02c869f16447167f4fd179 data/hexcasting/loot_tables/blocks/akashic_pressure_plate.json -523d98655e0f395d65640929d4254b6d4b3163d2 data/hexcasting/recipes/pride_colorizer_lesbian.json +1d558c1b63dd3c3e129261f53db5fd6748b59051 data/hexcasting/recipes/pride_colorizer_lesbian.json cf0ad981bebbb79414d955fb40fbf537fe88b89d data/hexcasting/advancements/recipes/brainsweep/brainsweep/akashic_record.json c386a7294db6ed97f9b131cb8402ca6203092b63 data/hexcasting/recipes/akashic_wood_stripped.json e5c835d3866e8f5ecfb03c9e7c2c134a50951d67 data/hexcasting/recipes/amethyst_tiles.json -91348d69c8a49eae2bbaf9fb00b9604c43716527 data/hexcasting/recipes/dye_colorizer_brown.json +bc490780a689c62da00244137679bbaa8a653430 data/hexcasting/recipes/dye_colorizer_brown.json f332cdebf9c53edec6cb3903f65d4ccc1398f849 data/hexcasting/advancements/recipes/hexcasting.creative_tab/pride_colorizer_aromantic.json -25f5d03a6f4290bbbe86c9cac5604b1e8a49ad84 data/hexcasting/recipes/dye_colorizer_light_gray.json +64686e6d1a10a4bd16ec0378dc9ce720eff3b4d7 data/hexcasting/recipes/dye_colorizer_light_gray.json 484be1c50092772587dd18769e63ee3ab22ad971 data/hexcasting/advancements/recipes/hexcasting.creative_tab/dye_colorizer_orange.json c25784941d6416744fb2ca2d43a3203e5c3e7c8a data/minecraft/tags/items/leaves.json 62b120d8943a9e73778ad1468f12532b21774994 data/hexcasting/recipes/akashic_trapdoor.json @@ -222,19 +222,19 @@ ef016ca292fa4edc7496b64e6f2931f4e7d90636 data/hexcasting/recipes/amethyst_dust_p 35a9b4beac7c6eddb990464eaeaebec2a9ab9951 data/hexcasting/loot_tables/inject/scroll_loot_many.json 949f05968c562d5e4d35630ce8e3189a2060dee7 data/hexcasting/advancements/recipes/hexcasting.creative_tab/pride_colorizer_intersex.json cfda8a0bb9051f9f876cd5b9afcd8a7f6a1e4290 data/create/recipes/crushing/amethyst_block.json -e4b6c8850f8517ad6af62309f173d053f1e5b364 data/hexcasting/recipes/pride_colorizer_gay.json +02dcee696b1e162f20dbfcf02bdb9e2144a64a27 data/hexcasting/recipes/pride_colorizer_gay.json 7c08784f2de139be380b5299f8ea8b8c78126ed8 data/minecraft/tags/blocks/mineable/axe.json -791dfa661888afb8ece93c6322fd55dd342086b5 data/hexcasting/recipes/pride_colorizer_bisexual.json +32e3d36398fa63e017ed6c46e7e19d7ba041c3d9 data/hexcasting/recipes/pride_colorizer_bisexual.json 1af91ec74694bf90fb7f53b6d55078c7e21460cc data/hexcasting/advancements/recipes/hexcasting.creative_tab/pride_colorizer_genderqueer.json f3c6b6917e504e1c3d5d8875f7cce6f311e791d2 data/minecraft/tags/items/logs_that_burn.json -06a4f3776d2bb8f294737d100143a0914342310a data/hexcasting/recipes/dye_colorizer_light_blue.json +ef8563a18c0bb3999a1092efe37540ea474633c5 data/hexcasting/recipes/dye_colorizer_light_blue.json 3b1c077f88f625c0b2653324c7b94fd3f2b3a538 data/hexcasting/loot_tables/blocks/akashic_tile.json db8a00478e1c4b0f9b143b5946d1ba25e489591d data/hexcasting/recipes/dynamic/seal_focus.json 196c49b203748e57a9b2b1259055b9de4b6be8d8 data/hexcasting/recipes/wand_spruce.json 09e80537530ed51b6792f16fe8b32448e89dc334 data/hexcasting/recipes/slate_block.json 31f9b7d8141f67981deedf7a46894e454006bb28 data/hexcasting/advancements/recipes/hexcasting.creative_tab/akashic_button.json 6b4459635b3d53cc2b6836fa97d29244a65b412d data/hexcasting/recipes/abacus.json -77961f5c461ff869f06b10019b810edf9eac37ac data/hexcasting/recipes/pride_colorizer_demiboy.json +1b96773128b11946ff4f30d5aa4040f9e04d0d40 data/hexcasting/recipes/pride_colorizer_demiboy.json 076dd8bb2ce1508293384fa93fa138a369d10751 data/hexcasting/advancements/recipes/hexcasting.creative_tab/dye_colorizer_green.json 3147422bed290cb47ea3763dbdc6f0e96eed5c2a data/hexcasting/loot_tables/inject/scroll_loot_few.json aab3082b3303f358cc265fb10bc9bbe08c96eef0 data/hexcasting/recipes/trinket.json @@ -245,9 +245,9 @@ c3aed1dbaa46e084711a116d1bb4522df9a7405a data/hexcasting/advancements/recipes/he 7cb828138a8ea2dae399011ee02bb909ca5f993e data/hexcasting/loot_tables/blocks/akashic_log_stripped.json 3b566309ba10142fe73c8f32ce501592befd907e data/hexcasting/loot_tables/blocks/akashic_stairs.json ab5d271371323d93ff6eed18179ee4f7fd8c939c data/hexcasting/recipes/brainsweep/impetus_rightclick.json -33fed8fb8e34df026e1eea0df8161c7f842a8648 data/hexcasting/recipes/dye_colorizer_black.json +8c22db477365a800ce1e715aeaad896550467047 data/hexcasting/recipes/dye_colorizer_black.json f3c6b6917e504e1c3d5d8875f7cce6f311e791d2 data/hexcasting/tags/items/akashic_logs.json -c36caf44a941a4abc44a15141eba8fe634c76fb8 data/hexcasting/recipes/dye_colorizer_blue.json +c64f5e56ca18eb68d2e58827920ca0e3ae4617ca data/hexcasting/recipes/dye_colorizer_blue.json 5f3e3813757d8300acad523d45ac7c4d85728399 data/minecraft/tags/blocks/wooden_buttons.json e125117befadda0785e370969a8e04eff070d057 data/hexcasting/loot_tables/blocks/amethyst_sconce.json 4da41a82a17f58c9342944f214e745696c1d8ed7 data/hexcasting/loot_tables/blocks/impetus_storedplayer.json diff --git a/Fabric/src/generated/resources/data/hexcasting/recipes/dye_colorizer_black.json b/Fabric/src/generated/resources/data/hexcasting/recipes/dye_colorizer_black.json index caf8f0b1..b8521f4d 100644 --- a/Fabric/src/generated/resources/data/hexcasting/recipes/dye_colorizer_black.json +++ b/Fabric/src/generated/resources/data/hexcasting/recipes/dye_colorizer_black.json @@ -1,14 +1,11 @@ { "type": "minecraft:crafting_shaped", "pattern": [ - " C ", " D ", - " B " + "DCD", + " D " ], "key": { - "B": { - "item": "minecraft:bowl" - }, "D": { "item": "hexcasting:amethyst_dust" }, diff --git a/Fabric/src/generated/resources/data/hexcasting/recipes/dye_colorizer_blue.json b/Fabric/src/generated/resources/data/hexcasting/recipes/dye_colorizer_blue.json index 66bed974..3f62bd90 100644 --- a/Fabric/src/generated/resources/data/hexcasting/recipes/dye_colorizer_blue.json +++ b/Fabric/src/generated/resources/data/hexcasting/recipes/dye_colorizer_blue.json @@ -1,14 +1,11 @@ { "type": "minecraft:crafting_shaped", "pattern": [ - " C ", " D ", - " B " + "DCD", + " D " ], "key": { - "B": { - "item": "minecraft:bowl" - }, "D": { "item": "hexcasting:amethyst_dust" }, diff --git a/Fabric/src/generated/resources/data/hexcasting/recipes/dye_colorizer_brown.json b/Fabric/src/generated/resources/data/hexcasting/recipes/dye_colorizer_brown.json index 1d78857d..7e906497 100644 --- a/Fabric/src/generated/resources/data/hexcasting/recipes/dye_colorizer_brown.json +++ b/Fabric/src/generated/resources/data/hexcasting/recipes/dye_colorizer_brown.json @@ -1,14 +1,11 @@ { "type": "minecraft:crafting_shaped", "pattern": [ - " C ", " D ", - " B " + "DCD", + " D " ], "key": { - "B": { - "item": "minecraft:bowl" - }, "D": { "item": "hexcasting:amethyst_dust" }, diff --git a/Fabric/src/generated/resources/data/hexcasting/recipes/dye_colorizer_cyan.json b/Fabric/src/generated/resources/data/hexcasting/recipes/dye_colorizer_cyan.json index 8c9cfed2..9fd40ad3 100644 --- a/Fabric/src/generated/resources/data/hexcasting/recipes/dye_colorizer_cyan.json +++ b/Fabric/src/generated/resources/data/hexcasting/recipes/dye_colorizer_cyan.json @@ -1,14 +1,11 @@ { "type": "minecraft:crafting_shaped", "pattern": [ - " C ", " D ", - " B " + "DCD", + " D " ], "key": { - "B": { - "item": "minecraft:bowl" - }, "D": { "item": "hexcasting:amethyst_dust" }, diff --git a/Fabric/src/generated/resources/data/hexcasting/recipes/dye_colorizer_gray.json b/Fabric/src/generated/resources/data/hexcasting/recipes/dye_colorizer_gray.json index b1ee5991..4a5c5c83 100644 --- a/Fabric/src/generated/resources/data/hexcasting/recipes/dye_colorizer_gray.json +++ b/Fabric/src/generated/resources/data/hexcasting/recipes/dye_colorizer_gray.json @@ -1,14 +1,11 @@ { "type": "minecraft:crafting_shaped", "pattern": [ - " C ", " D ", - " B " + "DCD", + " D " ], "key": { - "B": { - "item": "minecraft:bowl" - }, "D": { "item": "hexcasting:amethyst_dust" }, diff --git a/Fabric/src/generated/resources/data/hexcasting/recipes/dye_colorizer_green.json b/Fabric/src/generated/resources/data/hexcasting/recipes/dye_colorizer_green.json index 4cd95563..a6b4ca5e 100644 --- a/Fabric/src/generated/resources/data/hexcasting/recipes/dye_colorizer_green.json +++ b/Fabric/src/generated/resources/data/hexcasting/recipes/dye_colorizer_green.json @@ -1,14 +1,11 @@ { "type": "minecraft:crafting_shaped", "pattern": [ - " C ", " D ", - " B " + "DCD", + " D " ], "key": { - "B": { - "item": "minecraft:bowl" - }, "D": { "item": "hexcasting:amethyst_dust" }, diff --git a/Fabric/src/generated/resources/data/hexcasting/recipes/dye_colorizer_light_blue.json b/Fabric/src/generated/resources/data/hexcasting/recipes/dye_colorizer_light_blue.json index 25a7197c..0133b26c 100644 --- a/Fabric/src/generated/resources/data/hexcasting/recipes/dye_colorizer_light_blue.json +++ b/Fabric/src/generated/resources/data/hexcasting/recipes/dye_colorizer_light_blue.json @@ -1,14 +1,11 @@ { "type": "minecraft:crafting_shaped", "pattern": [ - " C ", " D ", - " B " + "DCD", + " D " ], "key": { - "B": { - "item": "minecraft:bowl" - }, "D": { "item": "hexcasting:amethyst_dust" }, diff --git a/Fabric/src/generated/resources/data/hexcasting/recipes/dye_colorizer_light_gray.json b/Fabric/src/generated/resources/data/hexcasting/recipes/dye_colorizer_light_gray.json index 368700cf..68f6a504 100644 --- a/Fabric/src/generated/resources/data/hexcasting/recipes/dye_colorizer_light_gray.json +++ b/Fabric/src/generated/resources/data/hexcasting/recipes/dye_colorizer_light_gray.json @@ -1,14 +1,11 @@ { "type": "minecraft:crafting_shaped", "pattern": [ - " C ", " D ", - " B " + "DCD", + " D " ], "key": { - "B": { - "item": "minecraft:bowl" - }, "D": { "item": "hexcasting:amethyst_dust" }, diff --git a/Fabric/src/generated/resources/data/hexcasting/recipes/dye_colorizer_lime.json b/Fabric/src/generated/resources/data/hexcasting/recipes/dye_colorizer_lime.json index 5f76b5d7..b7962d11 100644 --- a/Fabric/src/generated/resources/data/hexcasting/recipes/dye_colorizer_lime.json +++ b/Fabric/src/generated/resources/data/hexcasting/recipes/dye_colorizer_lime.json @@ -1,14 +1,11 @@ { "type": "minecraft:crafting_shaped", "pattern": [ - " C ", " D ", - " B " + "DCD", + " D " ], "key": { - "B": { - "item": "minecraft:bowl" - }, "D": { "item": "hexcasting:amethyst_dust" }, diff --git a/Fabric/src/generated/resources/data/hexcasting/recipes/dye_colorizer_magenta.json b/Fabric/src/generated/resources/data/hexcasting/recipes/dye_colorizer_magenta.json index 6f6d2b12..6de92267 100644 --- a/Fabric/src/generated/resources/data/hexcasting/recipes/dye_colorizer_magenta.json +++ b/Fabric/src/generated/resources/data/hexcasting/recipes/dye_colorizer_magenta.json @@ -1,14 +1,11 @@ { "type": "minecraft:crafting_shaped", "pattern": [ - " C ", " D ", - " B " + "DCD", + " D " ], "key": { - "B": { - "item": "minecraft:bowl" - }, "D": { "item": "hexcasting:amethyst_dust" }, diff --git a/Fabric/src/generated/resources/data/hexcasting/recipes/dye_colorizer_orange.json b/Fabric/src/generated/resources/data/hexcasting/recipes/dye_colorizer_orange.json index 7d773eaa..668733dc 100644 --- a/Fabric/src/generated/resources/data/hexcasting/recipes/dye_colorizer_orange.json +++ b/Fabric/src/generated/resources/data/hexcasting/recipes/dye_colorizer_orange.json @@ -1,14 +1,11 @@ { "type": "minecraft:crafting_shaped", "pattern": [ - " C ", " D ", - " B " + "DCD", + " D " ], "key": { - "B": { - "item": "minecraft:bowl" - }, "D": { "item": "hexcasting:amethyst_dust" }, diff --git a/Fabric/src/generated/resources/data/hexcasting/recipes/dye_colorizer_pink.json b/Fabric/src/generated/resources/data/hexcasting/recipes/dye_colorizer_pink.json index 22ed9a0c..d81d9930 100644 --- a/Fabric/src/generated/resources/data/hexcasting/recipes/dye_colorizer_pink.json +++ b/Fabric/src/generated/resources/data/hexcasting/recipes/dye_colorizer_pink.json @@ -1,14 +1,11 @@ { "type": "minecraft:crafting_shaped", "pattern": [ - " C ", " D ", - " B " + "DCD", + " D " ], "key": { - "B": { - "item": "minecraft:bowl" - }, "D": { "item": "hexcasting:amethyst_dust" }, diff --git a/Fabric/src/generated/resources/data/hexcasting/recipes/dye_colorizer_purple.json b/Fabric/src/generated/resources/data/hexcasting/recipes/dye_colorizer_purple.json index ff457f3f..bfcfbe54 100644 --- a/Fabric/src/generated/resources/data/hexcasting/recipes/dye_colorizer_purple.json +++ b/Fabric/src/generated/resources/data/hexcasting/recipes/dye_colorizer_purple.json @@ -1,14 +1,11 @@ { "type": "minecraft:crafting_shaped", "pattern": [ - " C ", " D ", - " B " + "DCD", + " D " ], "key": { - "B": { - "item": "minecraft:bowl" - }, "D": { "item": "hexcasting:amethyst_dust" }, diff --git a/Fabric/src/generated/resources/data/hexcasting/recipes/dye_colorizer_red.json b/Fabric/src/generated/resources/data/hexcasting/recipes/dye_colorizer_red.json index a51c335a..b360c398 100644 --- a/Fabric/src/generated/resources/data/hexcasting/recipes/dye_colorizer_red.json +++ b/Fabric/src/generated/resources/data/hexcasting/recipes/dye_colorizer_red.json @@ -1,14 +1,11 @@ { "type": "minecraft:crafting_shaped", "pattern": [ - " C ", " D ", - " B " + "DCD", + " D " ], "key": { - "B": { - "item": "minecraft:bowl" - }, "D": { "item": "hexcasting:amethyst_dust" }, diff --git a/Fabric/src/generated/resources/data/hexcasting/recipes/dye_colorizer_white.json b/Fabric/src/generated/resources/data/hexcasting/recipes/dye_colorizer_white.json index f77b7214..c0680e35 100644 --- a/Fabric/src/generated/resources/data/hexcasting/recipes/dye_colorizer_white.json +++ b/Fabric/src/generated/resources/data/hexcasting/recipes/dye_colorizer_white.json @@ -1,14 +1,11 @@ { "type": "minecraft:crafting_shaped", "pattern": [ - " C ", " D ", - " B " + "DCD", + " D " ], "key": { - "B": { - "item": "minecraft:bowl" - }, "D": { "item": "hexcasting:amethyst_dust" }, diff --git a/Fabric/src/generated/resources/data/hexcasting/recipes/dye_colorizer_yellow.json b/Fabric/src/generated/resources/data/hexcasting/recipes/dye_colorizer_yellow.json index 28a2b452..6daaaaee 100644 --- a/Fabric/src/generated/resources/data/hexcasting/recipes/dye_colorizer_yellow.json +++ b/Fabric/src/generated/resources/data/hexcasting/recipes/dye_colorizer_yellow.json @@ -1,14 +1,11 @@ { "type": "minecraft:crafting_shaped", "pattern": [ - " C ", " D ", - " B " + "DCD", + " D " ], "key": { - "B": { - "item": "minecraft:bowl" - }, "D": { "item": "hexcasting:amethyst_dust" }, diff --git a/Fabric/src/generated/resources/data/hexcasting/recipes/pride_colorizer_agender.json b/Fabric/src/generated/resources/data/hexcasting/recipes/pride_colorizer_agender.json index f7423b29..d083b8b5 100644 --- a/Fabric/src/generated/resources/data/hexcasting/recipes/pride_colorizer_agender.json +++ b/Fabric/src/generated/resources/data/hexcasting/recipes/pride_colorizer_agender.json @@ -1,14 +1,11 @@ { "type": "minecraft:crafting_shaped", "pattern": [ - " C ", " D ", - " B " + "DCD", + " D " ], "key": { - "B": { - "item": "minecraft:bowl" - }, "D": { "item": "hexcasting:amethyst_dust" }, diff --git a/Fabric/src/generated/resources/data/hexcasting/recipes/pride_colorizer_aroace.json b/Fabric/src/generated/resources/data/hexcasting/recipes/pride_colorizer_aroace.json index 2d1cb107..df170670 100644 --- a/Fabric/src/generated/resources/data/hexcasting/recipes/pride_colorizer_aroace.json +++ b/Fabric/src/generated/resources/data/hexcasting/recipes/pride_colorizer_aroace.json @@ -1,14 +1,11 @@ { "type": "minecraft:crafting_shaped", "pattern": [ - " C ", " D ", - " B " + "DCD", + " D " ], "key": { - "B": { - "item": "minecraft:bowl" - }, "D": { "item": "hexcasting:amethyst_dust" }, diff --git a/Fabric/src/generated/resources/data/hexcasting/recipes/pride_colorizer_aromantic.json b/Fabric/src/generated/resources/data/hexcasting/recipes/pride_colorizer_aromantic.json index 7e64c3b2..8b638de8 100644 --- a/Fabric/src/generated/resources/data/hexcasting/recipes/pride_colorizer_aromantic.json +++ b/Fabric/src/generated/resources/data/hexcasting/recipes/pride_colorizer_aromantic.json @@ -1,14 +1,11 @@ { "type": "minecraft:crafting_shaped", "pattern": [ - " C ", " D ", - " B " + "DCD", + " D " ], "key": { - "B": { - "item": "minecraft:bowl" - }, "D": { "item": "hexcasting:amethyst_dust" }, diff --git a/Fabric/src/generated/resources/data/hexcasting/recipes/pride_colorizer_asexual.json b/Fabric/src/generated/resources/data/hexcasting/recipes/pride_colorizer_asexual.json index 71663854..f9da411e 100644 --- a/Fabric/src/generated/resources/data/hexcasting/recipes/pride_colorizer_asexual.json +++ b/Fabric/src/generated/resources/data/hexcasting/recipes/pride_colorizer_asexual.json @@ -1,14 +1,11 @@ { "type": "minecraft:crafting_shaped", "pattern": [ - " C ", " D ", - " B " + "DCD", + " D " ], "key": { - "B": { - "item": "minecraft:bowl" - }, "D": { "item": "hexcasting:amethyst_dust" }, diff --git a/Fabric/src/generated/resources/data/hexcasting/recipes/pride_colorizer_bisexual.json b/Fabric/src/generated/resources/data/hexcasting/recipes/pride_colorizer_bisexual.json index 719a2b2b..022c10c7 100644 --- a/Fabric/src/generated/resources/data/hexcasting/recipes/pride_colorizer_bisexual.json +++ b/Fabric/src/generated/resources/data/hexcasting/recipes/pride_colorizer_bisexual.json @@ -1,14 +1,11 @@ { "type": "minecraft:crafting_shaped", "pattern": [ - " C ", " D ", - " B " + "DCD", + " D " ], "key": { - "B": { - "item": "minecraft:bowl" - }, "D": { "item": "hexcasting:amethyst_dust" }, diff --git a/Fabric/src/generated/resources/data/hexcasting/recipes/pride_colorizer_demiboy.json b/Fabric/src/generated/resources/data/hexcasting/recipes/pride_colorizer_demiboy.json index ed68c2c3..7fe308eb 100644 --- a/Fabric/src/generated/resources/data/hexcasting/recipes/pride_colorizer_demiboy.json +++ b/Fabric/src/generated/resources/data/hexcasting/recipes/pride_colorizer_demiboy.json @@ -1,14 +1,11 @@ { "type": "minecraft:crafting_shaped", "pattern": [ - " C ", " D ", - " B " + "DCD", + " D " ], "key": { - "B": { - "item": "minecraft:bowl" - }, "D": { "item": "hexcasting:amethyst_dust" }, diff --git a/Fabric/src/generated/resources/data/hexcasting/recipes/pride_colorizer_demigirl.json b/Fabric/src/generated/resources/data/hexcasting/recipes/pride_colorizer_demigirl.json index 21c7d5b2..b639ec3a 100644 --- a/Fabric/src/generated/resources/data/hexcasting/recipes/pride_colorizer_demigirl.json +++ b/Fabric/src/generated/resources/data/hexcasting/recipes/pride_colorizer_demigirl.json @@ -1,14 +1,11 @@ { "type": "minecraft:crafting_shaped", "pattern": [ - " C ", " D ", - " B " + "DCD", + " D " ], "key": { - "B": { - "item": "minecraft:bowl" - }, "D": { "item": "hexcasting:amethyst_dust" }, diff --git a/Fabric/src/generated/resources/data/hexcasting/recipes/pride_colorizer_gay.json b/Fabric/src/generated/resources/data/hexcasting/recipes/pride_colorizer_gay.json index de7a7272..e3f6d599 100644 --- a/Fabric/src/generated/resources/data/hexcasting/recipes/pride_colorizer_gay.json +++ b/Fabric/src/generated/resources/data/hexcasting/recipes/pride_colorizer_gay.json @@ -1,14 +1,11 @@ { "type": "minecraft:crafting_shaped", "pattern": [ - " C ", " D ", - " B " + "DCD", + " D " ], "key": { - "B": { - "item": "minecraft:bowl" - }, "D": { "item": "hexcasting:amethyst_dust" }, diff --git a/Fabric/src/generated/resources/data/hexcasting/recipes/pride_colorizer_genderfluid.json b/Fabric/src/generated/resources/data/hexcasting/recipes/pride_colorizer_genderfluid.json index 7ed9c812..3ec108d6 100644 --- a/Fabric/src/generated/resources/data/hexcasting/recipes/pride_colorizer_genderfluid.json +++ b/Fabric/src/generated/resources/data/hexcasting/recipes/pride_colorizer_genderfluid.json @@ -1,14 +1,11 @@ { "type": "minecraft:crafting_shaped", "pattern": [ - " C ", " D ", - " B " + "DCD", + " D " ], "key": { - "B": { - "item": "minecraft:bowl" - }, "D": { "item": "hexcasting:amethyst_dust" }, diff --git a/Fabric/src/generated/resources/data/hexcasting/recipes/pride_colorizer_genderqueer.json b/Fabric/src/generated/resources/data/hexcasting/recipes/pride_colorizer_genderqueer.json index f9b713f6..3e649081 100644 --- a/Fabric/src/generated/resources/data/hexcasting/recipes/pride_colorizer_genderqueer.json +++ b/Fabric/src/generated/resources/data/hexcasting/recipes/pride_colorizer_genderqueer.json @@ -1,14 +1,11 @@ { "type": "minecraft:crafting_shaped", "pattern": [ - " C ", " D ", - " B " + "DCD", + " D " ], "key": { - "B": { - "item": "minecraft:bowl" - }, "D": { "item": "hexcasting:amethyst_dust" }, diff --git a/Fabric/src/generated/resources/data/hexcasting/recipes/pride_colorizer_intersex.json b/Fabric/src/generated/resources/data/hexcasting/recipes/pride_colorizer_intersex.json index 3b86f28e..34595396 100644 --- a/Fabric/src/generated/resources/data/hexcasting/recipes/pride_colorizer_intersex.json +++ b/Fabric/src/generated/resources/data/hexcasting/recipes/pride_colorizer_intersex.json @@ -1,14 +1,11 @@ { "type": "minecraft:crafting_shaped", "pattern": [ - " C ", " D ", - " B " + "DCD", + " D " ], "key": { - "B": { - "item": "minecraft:bowl" - }, "D": { "item": "hexcasting:amethyst_dust" }, diff --git a/Fabric/src/generated/resources/data/hexcasting/recipes/pride_colorizer_lesbian.json b/Fabric/src/generated/resources/data/hexcasting/recipes/pride_colorizer_lesbian.json index 6d4436f0..98bc4b46 100644 --- a/Fabric/src/generated/resources/data/hexcasting/recipes/pride_colorizer_lesbian.json +++ b/Fabric/src/generated/resources/data/hexcasting/recipes/pride_colorizer_lesbian.json @@ -1,14 +1,11 @@ { "type": "minecraft:crafting_shaped", "pattern": [ - " C ", " D ", - " B " + "DCD", + " D " ], "key": { - "B": { - "item": "minecraft:bowl" - }, "D": { "item": "hexcasting:amethyst_dust" }, diff --git a/Fabric/src/generated/resources/data/hexcasting/recipes/pride_colorizer_nonbinary.json b/Fabric/src/generated/resources/data/hexcasting/recipes/pride_colorizer_nonbinary.json index bf538202..4972b2db 100644 --- a/Fabric/src/generated/resources/data/hexcasting/recipes/pride_colorizer_nonbinary.json +++ b/Fabric/src/generated/resources/data/hexcasting/recipes/pride_colorizer_nonbinary.json @@ -1,14 +1,11 @@ { "type": "minecraft:crafting_shaped", "pattern": [ - " C ", " D ", - " B " + "DCD", + " D " ], "key": { - "B": { - "item": "minecraft:bowl" - }, "D": { "item": "hexcasting:amethyst_dust" }, diff --git a/Fabric/src/generated/resources/data/hexcasting/recipes/pride_colorizer_pansexual.json b/Fabric/src/generated/resources/data/hexcasting/recipes/pride_colorizer_pansexual.json index 3a96efbd..ec18619d 100644 --- a/Fabric/src/generated/resources/data/hexcasting/recipes/pride_colorizer_pansexual.json +++ b/Fabric/src/generated/resources/data/hexcasting/recipes/pride_colorizer_pansexual.json @@ -1,14 +1,11 @@ { "type": "minecraft:crafting_shaped", "pattern": [ - " C ", " D ", - " B " + "DCD", + " D " ], "key": { - "B": { - "item": "minecraft:bowl" - }, "D": { "item": "hexcasting:amethyst_dust" }, diff --git a/Fabric/src/generated/resources/data/hexcasting/recipes/pride_colorizer_plural.json b/Fabric/src/generated/resources/data/hexcasting/recipes/pride_colorizer_plural.json index 42646441..4e4bb50a 100644 --- a/Fabric/src/generated/resources/data/hexcasting/recipes/pride_colorizer_plural.json +++ b/Fabric/src/generated/resources/data/hexcasting/recipes/pride_colorizer_plural.json @@ -1,14 +1,11 @@ { "type": "minecraft:crafting_shaped", "pattern": [ - " C ", " D ", - " B " + "DCD", + " D " ], "key": { - "B": { - "item": "minecraft:bowl" - }, "D": { "item": "hexcasting:amethyst_dust" }, diff --git a/Fabric/src/generated/resources/data/hexcasting/recipes/pride_colorizer_transgender.json b/Fabric/src/generated/resources/data/hexcasting/recipes/pride_colorizer_transgender.json index 4fd1fb42..4ef8f3cd 100644 --- a/Fabric/src/generated/resources/data/hexcasting/recipes/pride_colorizer_transgender.json +++ b/Fabric/src/generated/resources/data/hexcasting/recipes/pride_colorizer_transgender.json @@ -1,14 +1,11 @@ { "type": "minecraft:crafting_shaped", "pattern": [ - " C ", " D ", - " B " + "DCD", + " D " ], "key": { - "B": { - "item": "minecraft:bowl" - }, "D": { "item": "hexcasting:amethyst_dust" }, diff --git a/Forge/src/generated/resources/.cache/cache b/Forge/src/generated/resources/.cache/cache index 2c77be3e..f112b1d8 100644 --- a/Forge/src/generated/resources/.cache/cache +++ b/Forge/src/generated/resources/.cache/cache @@ -158,22 +158,22 @@ ab5d271371323d93ff6eed18179ee4f7fd8c939c data/hexcasting/recipes/brainsweep/impe d5c6f9a31a8310ec440fc8c14da8988f0d166586 data/hexcasting/recipes/brainsweep/impetus_storedplayer.json ad85e0162a7c68d431fd700700906ccbcadf91ce data/hexcasting/recipes/compat/create/crushing/amethyst_shard.json bc140b6c5d999b4bc5d12c302297f56bde3b161c data/hexcasting/recipes/cypher.json -33fed8fb8e34df026e1eea0df8161c7f842a8648 data/hexcasting/recipes/dye_colorizer_black.json -c36caf44a941a4abc44a15141eba8fe634c76fb8 data/hexcasting/recipes/dye_colorizer_blue.json -91348d69c8a49eae2bbaf9fb00b9604c43716527 data/hexcasting/recipes/dye_colorizer_brown.json -e4ef73afbd13a579493f45929c3f7adb8aa86dc2 data/hexcasting/recipes/dye_colorizer_cyan.json -c471220e70ee9ecbf58a21ea1d28e653efcc4fad data/hexcasting/recipes/dye_colorizer_gray.json -fe5f10e9258f430859f1f1f87320a2b5c7b67654 data/hexcasting/recipes/dye_colorizer_green.json -06a4f3776d2bb8f294737d100143a0914342310a data/hexcasting/recipes/dye_colorizer_light_blue.json -25f5d03a6f4290bbbe86c9cac5604b1e8a49ad84 data/hexcasting/recipes/dye_colorizer_light_gray.json -4fad619e1330e938d2e2596fc8fd4e5050a8b40e data/hexcasting/recipes/dye_colorizer_lime.json -386f1b0f7676324186d0694de3c86a77fac5ce98 data/hexcasting/recipes/dye_colorizer_magenta.json -6f1c0a84236b1e3cb4352d87bf3d553eb7e1a938 data/hexcasting/recipes/dye_colorizer_orange.json -fe8a7288aa27c07932a31c64ff8fadb943b278d5 data/hexcasting/recipes/dye_colorizer_pink.json -16fd879351f390bfa980a5f4d77e32f576de2f66 data/hexcasting/recipes/dye_colorizer_purple.json -29559dc2a5c4e189ab7edfbb71fed0a84dd96d45 data/hexcasting/recipes/dye_colorizer_red.json -bc79add419b8791e68b35076355fea11dfc640c6 data/hexcasting/recipes/dye_colorizer_white.json -c5341777604a4be5a311e300a4de89967b7caad2 data/hexcasting/recipes/dye_colorizer_yellow.json +8c22db477365a800ce1e715aeaad896550467047 data/hexcasting/recipes/dye_colorizer_black.json +c64f5e56ca18eb68d2e58827920ca0e3ae4617ca data/hexcasting/recipes/dye_colorizer_blue.json +bc490780a689c62da00244137679bbaa8a653430 data/hexcasting/recipes/dye_colorizer_brown.json +44d5d32647164e5510ecdbde22addbc047e4603a data/hexcasting/recipes/dye_colorizer_cyan.json +8df59ac1ca676bf1a506f3116fd273d6379f238e data/hexcasting/recipes/dye_colorizer_gray.json +3b082fff535586c13c12811a29839eb0096bfdb1 data/hexcasting/recipes/dye_colorizer_green.json +ef8563a18c0bb3999a1092efe37540ea474633c5 data/hexcasting/recipes/dye_colorizer_light_blue.json +64686e6d1a10a4bd16ec0378dc9ce720eff3b4d7 data/hexcasting/recipes/dye_colorizer_light_gray.json +3e89b354e3eb8f8ec2518b03f13c5c4295adef5f data/hexcasting/recipes/dye_colorizer_lime.json +4d1c771493f5968a0878c142342ceb8717a5784f data/hexcasting/recipes/dye_colorizer_magenta.json +186dc05888e66e17af0217bd0680648dc3da3968 data/hexcasting/recipes/dye_colorizer_orange.json +6f904b1ac6fc5863a8e718bc42043c40d5ec4c2a data/hexcasting/recipes/dye_colorizer_pink.json +eb06eb90c08b051ff6c42215fb7c91123e240a66 data/hexcasting/recipes/dye_colorizer_purple.json +b475e6d26350d0560e2cd66879f86520faaeb68c data/hexcasting/recipes/dye_colorizer_red.json +88cf11d37222254d9e3a4bef0f9ca2de1495c31a data/hexcasting/recipes/dye_colorizer_white.json +d910f10b472c3ff422f14961539e4c31b8830bff data/hexcasting/recipes/dye_colorizer_yellow.json db8a00478e1c4b0f9b143b5946d1ba25e489591d data/hexcasting/recipes/dynamic/seal_focus.json 3a376402af89128dc37adaa0a72b6de66d58309d data/hexcasting/recipes/dynamic/seal_spellbook.json a952d33cda8b805237052b602cf066683c4bf261 data/hexcasting/recipes/empty_directrix.json @@ -181,22 +181,22 @@ b7c248d2627c2a2b398d1c50181c1e0863612424 data/hexcasting/recipes/empty_impetus.j 7eaf7ee280d1982ecbaf5175cea5c5a7c7804f98 data/hexcasting/recipes/focus.json 5bc29f5b97e50c8d82ebe5b8bc45753c6f8c2873 data/hexcasting/recipes/jeweler_hammer.json 2397e64bd5fa2af12bb4f0f7efbc55f387c07a2b data/hexcasting/recipes/lens.json -fa30b1fb1c6fc9e763d5ce0e4dcfd71afcc81de2 data/hexcasting/recipes/pride_colorizer_agender.json -b162dffb52838921c3a354d817465a23df64ec00 data/hexcasting/recipes/pride_colorizer_aroace.json -9b2b94e2eabaa8260a15191bb869ceb3ca80779c data/hexcasting/recipes/pride_colorizer_aromantic.json -b4f71066f51788ce3d05429dcd5d1e451bcb7503 data/hexcasting/recipes/pride_colorizer_asexual.json -791dfa661888afb8ece93c6322fd55dd342086b5 data/hexcasting/recipes/pride_colorizer_bisexual.json -77961f5c461ff869f06b10019b810edf9eac37ac data/hexcasting/recipes/pride_colorizer_demiboy.json -c331d1b6a4d3d42eac052e73ff0b90d7dc117745 data/hexcasting/recipes/pride_colorizer_demigirl.json -e4b6c8850f8517ad6af62309f173d053f1e5b364 data/hexcasting/recipes/pride_colorizer_gay.json -57fe1e77bc786588a764620e65f0631254544b1f data/hexcasting/recipes/pride_colorizer_genderfluid.json -d0e37cea33e6323cb1936c44ed959e3dc8238bb7 data/hexcasting/recipes/pride_colorizer_genderqueer.json -c830f27bdee064af5bf2f1b2466042cf208c6788 data/hexcasting/recipes/pride_colorizer_intersex.json -523d98655e0f395d65640929d4254b6d4b3163d2 data/hexcasting/recipes/pride_colorizer_lesbian.json -43c7ffd19f2364de00b1e2cf8794ce5cf36494fb data/hexcasting/recipes/pride_colorizer_nonbinary.json -a00a851be50d49034ff939ca5fb3adbe0ee47302 data/hexcasting/recipes/pride_colorizer_pansexual.json -3ce0bea99cfbac7d316f4439ee79ac6b7f6f5b61 data/hexcasting/recipes/pride_colorizer_plural.json -21765e0f23ca7932c9c4891f1c36bc5a5faa54b9 data/hexcasting/recipes/pride_colorizer_transgender.json +37584409884ac4d9fbf7f0a4a3cb8ef3b5d32965 data/hexcasting/recipes/pride_colorizer_agender.json +c3a01df30228881c199686192d105fb2651c39c8 data/hexcasting/recipes/pride_colorizer_aroace.json +5e6df78e451395e08f86c8d89dca0a2c99a69691 data/hexcasting/recipes/pride_colorizer_aromantic.json +0a72e213fec8dd32b1ea9623a242484ce8318c47 data/hexcasting/recipes/pride_colorizer_asexual.json +32e3d36398fa63e017ed6c46e7e19d7ba041c3d9 data/hexcasting/recipes/pride_colorizer_bisexual.json +1b96773128b11946ff4f30d5aa4040f9e04d0d40 data/hexcasting/recipes/pride_colorizer_demiboy.json +d3ad9a9e92dd125f872d9671930d4e57f24894ed data/hexcasting/recipes/pride_colorizer_demigirl.json +02dcee696b1e162f20dbfcf02bdb9e2144a64a27 data/hexcasting/recipes/pride_colorizer_gay.json +0ca193fe94bc004aa0080826ed0fc4596f9a62dd data/hexcasting/recipes/pride_colorizer_genderfluid.json +456ae69977612b6f62c109783518e9006287e77b data/hexcasting/recipes/pride_colorizer_genderqueer.json +ac128e72adda8fea0ad63d7e6e18dd9399f53d65 data/hexcasting/recipes/pride_colorizer_intersex.json +1d558c1b63dd3c3e129261f53db5fd6748b59051 data/hexcasting/recipes/pride_colorizer_lesbian.json +cd7e618d7c08ffff67683852f799362fb8aaebaf data/hexcasting/recipes/pride_colorizer_nonbinary.json +568ac8a13b7762b92cc274d74a7c729cc6e16687 data/hexcasting/recipes/pride_colorizer_pansexual.json +b2d8fb979a3fbe47404da349318f38ab45bac760 data/hexcasting/recipes/pride_colorizer_plural.json +f50c71bbbbf7d77665c9008fcdd9be0d571ce48e data/hexcasting/recipes/pride_colorizer_transgender.json 49508c455626eeca18c957edc0cde016e823f7b0 data/hexcasting/recipes/scroll.json 86ee80768fef41cf9b517564b733f4586094f367 data/hexcasting/recipes/scroll_medium.json ccf4ea841ea9a66738253385c659ff86c85a73f5 data/hexcasting/recipes/scroll_paper.json diff --git a/Forge/src/generated/resources/data/hexcasting/recipes/dye_colorizer_black.json b/Forge/src/generated/resources/data/hexcasting/recipes/dye_colorizer_black.json index caf8f0b1..b8521f4d 100644 --- a/Forge/src/generated/resources/data/hexcasting/recipes/dye_colorizer_black.json +++ b/Forge/src/generated/resources/data/hexcasting/recipes/dye_colorizer_black.json @@ -1,14 +1,11 @@ { "type": "minecraft:crafting_shaped", "pattern": [ - " C ", " D ", - " B " + "DCD", + " D " ], "key": { - "B": { - "item": "minecraft:bowl" - }, "D": { "item": "hexcasting:amethyst_dust" }, diff --git a/Forge/src/generated/resources/data/hexcasting/recipes/dye_colorizer_blue.json b/Forge/src/generated/resources/data/hexcasting/recipes/dye_colorizer_blue.json index 66bed974..3f62bd90 100644 --- a/Forge/src/generated/resources/data/hexcasting/recipes/dye_colorizer_blue.json +++ b/Forge/src/generated/resources/data/hexcasting/recipes/dye_colorizer_blue.json @@ -1,14 +1,11 @@ { "type": "minecraft:crafting_shaped", "pattern": [ - " C ", " D ", - " B " + "DCD", + " D " ], "key": { - "B": { - "item": "minecraft:bowl" - }, "D": { "item": "hexcasting:amethyst_dust" }, diff --git a/Forge/src/generated/resources/data/hexcasting/recipes/dye_colorizer_brown.json b/Forge/src/generated/resources/data/hexcasting/recipes/dye_colorizer_brown.json index 1d78857d..7e906497 100644 --- a/Forge/src/generated/resources/data/hexcasting/recipes/dye_colorizer_brown.json +++ b/Forge/src/generated/resources/data/hexcasting/recipes/dye_colorizer_brown.json @@ -1,14 +1,11 @@ { "type": "minecraft:crafting_shaped", "pattern": [ - " C ", " D ", - " B " + "DCD", + " D " ], "key": { - "B": { - "item": "minecraft:bowl" - }, "D": { "item": "hexcasting:amethyst_dust" }, diff --git a/Forge/src/generated/resources/data/hexcasting/recipes/dye_colorizer_cyan.json b/Forge/src/generated/resources/data/hexcasting/recipes/dye_colorizer_cyan.json index 8c9cfed2..9fd40ad3 100644 --- a/Forge/src/generated/resources/data/hexcasting/recipes/dye_colorizer_cyan.json +++ b/Forge/src/generated/resources/data/hexcasting/recipes/dye_colorizer_cyan.json @@ -1,14 +1,11 @@ { "type": "minecraft:crafting_shaped", "pattern": [ - " C ", " D ", - " B " + "DCD", + " D " ], "key": { - "B": { - "item": "minecraft:bowl" - }, "D": { "item": "hexcasting:amethyst_dust" }, diff --git a/Forge/src/generated/resources/data/hexcasting/recipes/dye_colorizer_gray.json b/Forge/src/generated/resources/data/hexcasting/recipes/dye_colorizer_gray.json index b1ee5991..4a5c5c83 100644 --- a/Forge/src/generated/resources/data/hexcasting/recipes/dye_colorizer_gray.json +++ b/Forge/src/generated/resources/data/hexcasting/recipes/dye_colorizer_gray.json @@ -1,14 +1,11 @@ { "type": "minecraft:crafting_shaped", "pattern": [ - " C ", " D ", - " B " + "DCD", + " D " ], "key": { - "B": { - "item": "minecraft:bowl" - }, "D": { "item": "hexcasting:amethyst_dust" }, diff --git a/Forge/src/generated/resources/data/hexcasting/recipes/dye_colorizer_green.json b/Forge/src/generated/resources/data/hexcasting/recipes/dye_colorizer_green.json index 4cd95563..a6b4ca5e 100644 --- a/Forge/src/generated/resources/data/hexcasting/recipes/dye_colorizer_green.json +++ b/Forge/src/generated/resources/data/hexcasting/recipes/dye_colorizer_green.json @@ -1,14 +1,11 @@ { "type": "minecraft:crafting_shaped", "pattern": [ - " C ", " D ", - " B " + "DCD", + " D " ], "key": { - "B": { - "item": "minecraft:bowl" - }, "D": { "item": "hexcasting:amethyst_dust" }, diff --git a/Forge/src/generated/resources/data/hexcasting/recipes/dye_colorizer_light_blue.json b/Forge/src/generated/resources/data/hexcasting/recipes/dye_colorizer_light_blue.json index 25a7197c..0133b26c 100644 --- a/Forge/src/generated/resources/data/hexcasting/recipes/dye_colorizer_light_blue.json +++ b/Forge/src/generated/resources/data/hexcasting/recipes/dye_colorizer_light_blue.json @@ -1,14 +1,11 @@ { "type": "minecraft:crafting_shaped", "pattern": [ - " C ", " D ", - " B " + "DCD", + " D " ], "key": { - "B": { - "item": "minecraft:bowl" - }, "D": { "item": "hexcasting:amethyst_dust" }, diff --git a/Forge/src/generated/resources/data/hexcasting/recipes/dye_colorizer_light_gray.json b/Forge/src/generated/resources/data/hexcasting/recipes/dye_colorizer_light_gray.json index 368700cf..68f6a504 100644 --- a/Forge/src/generated/resources/data/hexcasting/recipes/dye_colorizer_light_gray.json +++ b/Forge/src/generated/resources/data/hexcasting/recipes/dye_colorizer_light_gray.json @@ -1,14 +1,11 @@ { "type": "minecraft:crafting_shaped", "pattern": [ - " C ", " D ", - " B " + "DCD", + " D " ], "key": { - "B": { - "item": "minecraft:bowl" - }, "D": { "item": "hexcasting:amethyst_dust" }, diff --git a/Forge/src/generated/resources/data/hexcasting/recipes/dye_colorizer_lime.json b/Forge/src/generated/resources/data/hexcasting/recipes/dye_colorizer_lime.json index 5f76b5d7..b7962d11 100644 --- a/Forge/src/generated/resources/data/hexcasting/recipes/dye_colorizer_lime.json +++ b/Forge/src/generated/resources/data/hexcasting/recipes/dye_colorizer_lime.json @@ -1,14 +1,11 @@ { "type": "minecraft:crafting_shaped", "pattern": [ - " C ", " D ", - " B " + "DCD", + " D " ], "key": { - "B": { - "item": "minecraft:bowl" - }, "D": { "item": "hexcasting:amethyst_dust" }, diff --git a/Forge/src/generated/resources/data/hexcasting/recipes/dye_colorizer_magenta.json b/Forge/src/generated/resources/data/hexcasting/recipes/dye_colorizer_magenta.json index 6f6d2b12..6de92267 100644 --- a/Forge/src/generated/resources/data/hexcasting/recipes/dye_colorizer_magenta.json +++ b/Forge/src/generated/resources/data/hexcasting/recipes/dye_colorizer_magenta.json @@ -1,14 +1,11 @@ { "type": "minecraft:crafting_shaped", "pattern": [ - " C ", " D ", - " B " + "DCD", + " D " ], "key": { - "B": { - "item": "minecraft:bowl" - }, "D": { "item": "hexcasting:amethyst_dust" }, diff --git a/Forge/src/generated/resources/data/hexcasting/recipes/dye_colorizer_orange.json b/Forge/src/generated/resources/data/hexcasting/recipes/dye_colorizer_orange.json index 7d773eaa..668733dc 100644 --- a/Forge/src/generated/resources/data/hexcasting/recipes/dye_colorizer_orange.json +++ b/Forge/src/generated/resources/data/hexcasting/recipes/dye_colorizer_orange.json @@ -1,14 +1,11 @@ { "type": "minecraft:crafting_shaped", "pattern": [ - " C ", " D ", - " B " + "DCD", + " D " ], "key": { - "B": { - "item": "minecraft:bowl" - }, "D": { "item": "hexcasting:amethyst_dust" }, diff --git a/Forge/src/generated/resources/data/hexcasting/recipes/dye_colorizer_pink.json b/Forge/src/generated/resources/data/hexcasting/recipes/dye_colorizer_pink.json index 22ed9a0c..d81d9930 100644 --- a/Forge/src/generated/resources/data/hexcasting/recipes/dye_colorizer_pink.json +++ b/Forge/src/generated/resources/data/hexcasting/recipes/dye_colorizer_pink.json @@ -1,14 +1,11 @@ { "type": "minecraft:crafting_shaped", "pattern": [ - " C ", " D ", - " B " + "DCD", + " D " ], "key": { - "B": { - "item": "minecraft:bowl" - }, "D": { "item": "hexcasting:amethyst_dust" }, diff --git a/Forge/src/generated/resources/data/hexcasting/recipes/dye_colorizer_purple.json b/Forge/src/generated/resources/data/hexcasting/recipes/dye_colorizer_purple.json index ff457f3f..bfcfbe54 100644 --- a/Forge/src/generated/resources/data/hexcasting/recipes/dye_colorizer_purple.json +++ b/Forge/src/generated/resources/data/hexcasting/recipes/dye_colorizer_purple.json @@ -1,14 +1,11 @@ { "type": "minecraft:crafting_shaped", "pattern": [ - " C ", " D ", - " B " + "DCD", + " D " ], "key": { - "B": { - "item": "minecraft:bowl" - }, "D": { "item": "hexcasting:amethyst_dust" }, diff --git a/Forge/src/generated/resources/data/hexcasting/recipes/dye_colorizer_red.json b/Forge/src/generated/resources/data/hexcasting/recipes/dye_colorizer_red.json index a51c335a..b360c398 100644 --- a/Forge/src/generated/resources/data/hexcasting/recipes/dye_colorizer_red.json +++ b/Forge/src/generated/resources/data/hexcasting/recipes/dye_colorizer_red.json @@ -1,14 +1,11 @@ { "type": "minecraft:crafting_shaped", "pattern": [ - " C ", " D ", - " B " + "DCD", + " D " ], "key": { - "B": { - "item": "minecraft:bowl" - }, "D": { "item": "hexcasting:amethyst_dust" }, diff --git a/Forge/src/generated/resources/data/hexcasting/recipes/dye_colorizer_white.json b/Forge/src/generated/resources/data/hexcasting/recipes/dye_colorizer_white.json index f77b7214..c0680e35 100644 --- a/Forge/src/generated/resources/data/hexcasting/recipes/dye_colorizer_white.json +++ b/Forge/src/generated/resources/data/hexcasting/recipes/dye_colorizer_white.json @@ -1,14 +1,11 @@ { "type": "minecraft:crafting_shaped", "pattern": [ - " C ", " D ", - " B " + "DCD", + " D " ], "key": { - "B": { - "item": "minecraft:bowl" - }, "D": { "item": "hexcasting:amethyst_dust" }, diff --git a/Forge/src/generated/resources/data/hexcasting/recipes/dye_colorizer_yellow.json b/Forge/src/generated/resources/data/hexcasting/recipes/dye_colorizer_yellow.json index 28a2b452..6daaaaee 100644 --- a/Forge/src/generated/resources/data/hexcasting/recipes/dye_colorizer_yellow.json +++ b/Forge/src/generated/resources/data/hexcasting/recipes/dye_colorizer_yellow.json @@ -1,14 +1,11 @@ { "type": "minecraft:crafting_shaped", "pattern": [ - " C ", " D ", - " B " + "DCD", + " D " ], "key": { - "B": { - "item": "minecraft:bowl" - }, "D": { "item": "hexcasting:amethyst_dust" }, diff --git a/Forge/src/generated/resources/data/hexcasting/recipes/pride_colorizer_agender.json b/Forge/src/generated/resources/data/hexcasting/recipes/pride_colorizer_agender.json index f7423b29..d083b8b5 100644 --- a/Forge/src/generated/resources/data/hexcasting/recipes/pride_colorizer_agender.json +++ b/Forge/src/generated/resources/data/hexcasting/recipes/pride_colorizer_agender.json @@ -1,14 +1,11 @@ { "type": "minecraft:crafting_shaped", "pattern": [ - " C ", " D ", - " B " + "DCD", + " D " ], "key": { - "B": { - "item": "minecraft:bowl" - }, "D": { "item": "hexcasting:amethyst_dust" }, diff --git a/Forge/src/generated/resources/data/hexcasting/recipes/pride_colorizer_aroace.json b/Forge/src/generated/resources/data/hexcasting/recipes/pride_colorizer_aroace.json index 2d1cb107..df170670 100644 --- a/Forge/src/generated/resources/data/hexcasting/recipes/pride_colorizer_aroace.json +++ b/Forge/src/generated/resources/data/hexcasting/recipes/pride_colorizer_aroace.json @@ -1,14 +1,11 @@ { "type": "minecraft:crafting_shaped", "pattern": [ - " C ", " D ", - " B " + "DCD", + " D " ], "key": { - "B": { - "item": "minecraft:bowl" - }, "D": { "item": "hexcasting:amethyst_dust" }, diff --git a/Forge/src/generated/resources/data/hexcasting/recipes/pride_colorizer_aromantic.json b/Forge/src/generated/resources/data/hexcasting/recipes/pride_colorizer_aromantic.json index 7e64c3b2..8b638de8 100644 --- a/Forge/src/generated/resources/data/hexcasting/recipes/pride_colorizer_aromantic.json +++ b/Forge/src/generated/resources/data/hexcasting/recipes/pride_colorizer_aromantic.json @@ -1,14 +1,11 @@ { "type": "minecraft:crafting_shaped", "pattern": [ - " C ", " D ", - " B " + "DCD", + " D " ], "key": { - "B": { - "item": "minecraft:bowl" - }, "D": { "item": "hexcasting:amethyst_dust" }, diff --git a/Forge/src/generated/resources/data/hexcasting/recipes/pride_colorizer_asexual.json b/Forge/src/generated/resources/data/hexcasting/recipes/pride_colorizer_asexual.json index 71663854..f9da411e 100644 --- a/Forge/src/generated/resources/data/hexcasting/recipes/pride_colorizer_asexual.json +++ b/Forge/src/generated/resources/data/hexcasting/recipes/pride_colorizer_asexual.json @@ -1,14 +1,11 @@ { "type": "minecraft:crafting_shaped", "pattern": [ - " C ", " D ", - " B " + "DCD", + " D " ], "key": { - "B": { - "item": "minecraft:bowl" - }, "D": { "item": "hexcasting:amethyst_dust" }, diff --git a/Forge/src/generated/resources/data/hexcasting/recipes/pride_colorizer_bisexual.json b/Forge/src/generated/resources/data/hexcasting/recipes/pride_colorizer_bisexual.json index 719a2b2b..022c10c7 100644 --- a/Forge/src/generated/resources/data/hexcasting/recipes/pride_colorizer_bisexual.json +++ b/Forge/src/generated/resources/data/hexcasting/recipes/pride_colorizer_bisexual.json @@ -1,14 +1,11 @@ { "type": "minecraft:crafting_shaped", "pattern": [ - " C ", " D ", - " B " + "DCD", + " D " ], "key": { - "B": { - "item": "minecraft:bowl" - }, "D": { "item": "hexcasting:amethyst_dust" }, diff --git a/Forge/src/generated/resources/data/hexcasting/recipes/pride_colorizer_demiboy.json b/Forge/src/generated/resources/data/hexcasting/recipes/pride_colorizer_demiboy.json index ed68c2c3..7fe308eb 100644 --- a/Forge/src/generated/resources/data/hexcasting/recipes/pride_colorizer_demiboy.json +++ b/Forge/src/generated/resources/data/hexcasting/recipes/pride_colorizer_demiboy.json @@ -1,14 +1,11 @@ { "type": "minecraft:crafting_shaped", "pattern": [ - " C ", " D ", - " B " + "DCD", + " D " ], "key": { - "B": { - "item": "minecraft:bowl" - }, "D": { "item": "hexcasting:amethyst_dust" }, diff --git a/Forge/src/generated/resources/data/hexcasting/recipes/pride_colorizer_demigirl.json b/Forge/src/generated/resources/data/hexcasting/recipes/pride_colorizer_demigirl.json index 21c7d5b2..b639ec3a 100644 --- a/Forge/src/generated/resources/data/hexcasting/recipes/pride_colorizer_demigirl.json +++ b/Forge/src/generated/resources/data/hexcasting/recipes/pride_colorizer_demigirl.json @@ -1,14 +1,11 @@ { "type": "minecraft:crafting_shaped", "pattern": [ - " C ", " D ", - " B " + "DCD", + " D " ], "key": { - "B": { - "item": "minecraft:bowl" - }, "D": { "item": "hexcasting:amethyst_dust" }, diff --git a/Forge/src/generated/resources/data/hexcasting/recipes/pride_colorizer_gay.json b/Forge/src/generated/resources/data/hexcasting/recipes/pride_colorizer_gay.json index de7a7272..e3f6d599 100644 --- a/Forge/src/generated/resources/data/hexcasting/recipes/pride_colorizer_gay.json +++ b/Forge/src/generated/resources/data/hexcasting/recipes/pride_colorizer_gay.json @@ -1,14 +1,11 @@ { "type": "minecraft:crafting_shaped", "pattern": [ - " C ", " D ", - " B " + "DCD", + " D " ], "key": { - "B": { - "item": "minecraft:bowl" - }, "D": { "item": "hexcasting:amethyst_dust" }, diff --git a/Forge/src/generated/resources/data/hexcasting/recipes/pride_colorizer_genderfluid.json b/Forge/src/generated/resources/data/hexcasting/recipes/pride_colorizer_genderfluid.json index 7ed9c812..3ec108d6 100644 --- a/Forge/src/generated/resources/data/hexcasting/recipes/pride_colorizer_genderfluid.json +++ b/Forge/src/generated/resources/data/hexcasting/recipes/pride_colorizer_genderfluid.json @@ -1,14 +1,11 @@ { "type": "minecraft:crafting_shaped", "pattern": [ - " C ", " D ", - " B " + "DCD", + " D " ], "key": { - "B": { - "item": "minecraft:bowl" - }, "D": { "item": "hexcasting:amethyst_dust" }, diff --git a/Forge/src/generated/resources/data/hexcasting/recipes/pride_colorizer_genderqueer.json b/Forge/src/generated/resources/data/hexcasting/recipes/pride_colorizer_genderqueer.json index f9b713f6..3e649081 100644 --- a/Forge/src/generated/resources/data/hexcasting/recipes/pride_colorizer_genderqueer.json +++ b/Forge/src/generated/resources/data/hexcasting/recipes/pride_colorizer_genderqueer.json @@ -1,14 +1,11 @@ { "type": "minecraft:crafting_shaped", "pattern": [ - " C ", " D ", - " B " + "DCD", + " D " ], "key": { - "B": { - "item": "minecraft:bowl" - }, "D": { "item": "hexcasting:amethyst_dust" }, diff --git a/Forge/src/generated/resources/data/hexcasting/recipes/pride_colorizer_intersex.json b/Forge/src/generated/resources/data/hexcasting/recipes/pride_colorizer_intersex.json index 3b86f28e..34595396 100644 --- a/Forge/src/generated/resources/data/hexcasting/recipes/pride_colorizer_intersex.json +++ b/Forge/src/generated/resources/data/hexcasting/recipes/pride_colorizer_intersex.json @@ -1,14 +1,11 @@ { "type": "minecraft:crafting_shaped", "pattern": [ - " C ", " D ", - " B " + "DCD", + " D " ], "key": { - "B": { - "item": "minecraft:bowl" - }, "D": { "item": "hexcasting:amethyst_dust" }, diff --git a/Forge/src/generated/resources/data/hexcasting/recipes/pride_colorizer_lesbian.json b/Forge/src/generated/resources/data/hexcasting/recipes/pride_colorizer_lesbian.json index 6d4436f0..98bc4b46 100644 --- a/Forge/src/generated/resources/data/hexcasting/recipes/pride_colorizer_lesbian.json +++ b/Forge/src/generated/resources/data/hexcasting/recipes/pride_colorizer_lesbian.json @@ -1,14 +1,11 @@ { "type": "minecraft:crafting_shaped", "pattern": [ - " C ", " D ", - " B " + "DCD", + " D " ], "key": { - "B": { - "item": "minecraft:bowl" - }, "D": { "item": "hexcasting:amethyst_dust" }, diff --git a/Forge/src/generated/resources/data/hexcasting/recipes/pride_colorizer_nonbinary.json b/Forge/src/generated/resources/data/hexcasting/recipes/pride_colorizer_nonbinary.json index bf538202..4972b2db 100644 --- a/Forge/src/generated/resources/data/hexcasting/recipes/pride_colorizer_nonbinary.json +++ b/Forge/src/generated/resources/data/hexcasting/recipes/pride_colorizer_nonbinary.json @@ -1,14 +1,11 @@ { "type": "minecraft:crafting_shaped", "pattern": [ - " C ", " D ", - " B " + "DCD", + " D " ], "key": { - "B": { - "item": "minecraft:bowl" - }, "D": { "item": "hexcasting:amethyst_dust" }, diff --git a/Forge/src/generated/resources/data/hexcasting/recipes/pride_colorizer_pansexual.json b/Forge/src/generated/resources/data/hexcasting/recipes/pride_colorizer_pansexual.json index 3a96efbd..ec18619d 100644 --- a/Forge/src/generated/resources/data/hexcasting/recipes/pride_colorizer_pansexual.json +++ b/Forge/src/generated/resources/data/hexcasting/recipes/pride_colorizer_pansexual.json @@ -1,14 +1,11 @@ { "type": "minecraft:crafting_shaped", "pattern": [ - " C ", " D ", - " B " + "DCD", + " D " ], "key": { - "B": { - "item": "minecraft:bowl" - }, "D": { "item": "hexcasting:amethyst_dust" }, diff --git a/Forge/src/generated/resources/data/hexcasting/recipes/pride_colorizer_plural.json b/Forge/src/generated/resources/data/hexcasting/recipes/pride_colorizer_plural.json index 42646441..4e4bb50a 100644 --- a/Forge/src/generated/resources/data/hexcasting/recipes/pride_colorizer_plural.json +++ b/Forge/src/generated/resources/data/hexcasting/recipes/pride_colorizer_plural.json @@ -1,14 +1,11 @@ { "type": "minecraft:crafting_shaped", "pattern": [ - " C ", " D ", - " B " + "DCD", + " D " ], "key": { - "B": { - "item": "minecraft:bowl" - }, "D": { "item": "hexcasting:amethyst_dust" }, diff --git a/Forge/src/generated/resources/data/hexcasting/recipes/pride_colorizer_transgender.json b/Forge/src/generated/resources/data/hexcasting/recipes/pride_colorizer_transgender.json index 4fd1fb42..4ef8f3cd 100644 --- a/Forge/src/generated/resources/data/hexcasting/recipes/pride_colorizer_transgender.json +++ b/Forge/src/generated/resources/data/hexcasting/recipes/pride_colorizer_transgender.json @@ -1,14 +1,11 @@ { "type": "minecraft:crafting_shaped", "pattern": [ - " C ", " D ", - " B " + "DCD", + " D " ], "key": { - "B": { - "item": "minecraft:bowl" - }, "D": { "item": "hexcasting:amethyst_dust" }, diff --git a/Forge/src/main/java/at/petrak/hexcasting/forge/datagen/xplat/HexBlockStatesAndModels.java b/Forge/src/main/java/at/petrak/hexcasting/forge/datagen/xplat/HexBlockStatesAndModels.java index 716d01d0..81de72fb 100644 --- a/Forge/src/main/java/at/petrak/hexcasting/forge/datagen/xplat/HexBlockStatesAndModels.java +++ b/Forge/src/main/java/at/petrak/hexcasting/forge/datagen/xplat/HexBlockStatesAndModels.java @@ -235,7 +235,7 @@ public class HexBlockStatesAndModels extends PaucalBlockStateAndModelProvider { simpleBlock(HexBlocks.SCONCE, sconceModel); simpleBlockItem(HexBlocks.SCONCE, sconceModel); - var conjuredModel = models().getExistingFile(modLoc("conjured")); + var conjuredModel = models().getBuilder("conjured").texture("particle", mcLoc("block/amethyst_block")); simpleBlock(HexBlocks.CONJURED_BLOCK, conjuredModel); simpleBlock(HexBlocks.CONJURED_LIGHT, conjuredModel); } From 41deea129cd872e7b3c85ebff431dc64d71d3748 Mon Sep 17 00:00:00 2001 From: "yrsegal@gmail.com" Date: Sun, 24 Jul 2022 20:20:07 -0400 Subject: [PATCH 017/117] Close #160 port of 287fadc8cebc2df76c4efa6c44bd591fe208ec98 --- .../circle/BlockEntityAbstractImpetus.java | 46 ++++++++++++------- .../api/spell/casting/CastingHarness.kt | 3 ++ .../items/magic/ItemCreativeUnlocker.java | 18 ++++++-- .../fabric/storage/FabricImpetusStorage.kt | 2 +- .../forge/cap/ForgeImpetusCapability.java | 2 +- 5 files changed, 47 insertions(+), 24 deletions(-) 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 15528529..6b4b792b 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 @@ -10,6 +10,7 @@ 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.utils.ManaHelper; +import at.petrak.hexcasting.common.items.magic.ItemCreativeUnlocker; import at.petrak.hexcasting.common.lib.HexItems; import at.petrak.hexcasting.common.lib.HexSounds; import at.petrak.hexcasting.xplat.IXplatAbstractions; @@ -117,10 +118,14 @@ public abstract class BlockEntityAbstractImpetus extends HexBlockEntity implemen LocalPlayer observer, ClientLevel world, Direction hitFace, InteractionHand lensHand) { if (world.getBlockEntity(pos) instanceof BlockEntityAbstractImpetus beai) { - var dustCount = (float) beai.getMana() / (float) ManaConstants.DUST_UNIT; - var dustCmp = new TranslatableComponent("hexcasting.tooltip.lens.impetus.mana", - String.format("%.2f", dustCount)); - lines.add(new Pair<>(new ItemStack(HexItems.AMETHYST_DUST), dustCmp)); + if (beai.getMana() < 0) { + lines.add(new Pair<>(new ItemStack(HexItems.AMETHYST_DUST), ItemCreativeUnlocker.infiniteMedia(world))); + } else { + var dustCount = (float) beai.getMana() / (float) ManaConstants.DUST_UNIT; + var dustCmp = new TranslatableComponent("hexcasting.tooltip.lens.impetus.mana", + String.format("%.2f", dustCount)); + lines.add(new Pair<>(new ItemStack(HexItems.AMETHYST_DUST), dustCmp)); + } var mishap = this.getLastMishap(); if (mishap != null) { @@ -530,30 +535,37 @@ public abstract class BlockEntityAbstractImpetus extends HexBlockEntity implemen @Override public boolean canPlaceItem(int index, ItemStack stack) { - var manamount = extractMana(stack, true); + var manamount = extractManaFromItem(stack, true); return manamount > 0; } - @Override - public void clearContent() { - this.mana = 0; - this.stopCasting(); - this.sync(); - } - - public int extractMana(ItemStack stack, boolean simulate) { + public int extractManaFromItem(ItemStack stack, boolean simulate) { + if (this.mana < 0) + return 0; return ManaHelper.extractMana(stack, remainingManaCapacity(), true, simulate); } public void insertMana(ItemStack stack) { - var manamount = extractMana(stack, false); - if (manamount > 0) { - this.mana += manamount; - this.sync(); + if (getMana() >= 0 && !stack.isEmpty() && stack.getItem() == HexItems.CREATIVE_UNLOCKER) { + setInfiniteMana(); + stack.shrink(1); + } else { + var manamount = extractManaFromItem(stack, false); + if (manamount > 0) { + this.mana += manamount; + this.sync(); + } } } + public void setInfiniteMana() { + this.mana = -1; + this.sync(); + } + public int remainingManaCapacity() { + if (this.mana < 0) + return 0; return MAX_CAPACITY - this.mana; } } 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 1861a03d..9547313d 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 @@ -368,6 +368,9 @@ class CastingHarness private constructor( val tile = this.ctx.world.getBlockEntity(this.ctx.spellCircle.impetusPos) if (tile is BlockEntityAbstractImpetus) { val manaAvailable = tile.mana + if (manaAvailable < 0) + return 0 + val manaToTake = min(costLeft, manaAvailable) costLeft -= manaToTake tile.mana = manaAvailable - manaToTake diff --git a/Common/src/main/java/at/petrak/hexcasting/common/items/magic/ItemCreativeUnlocker.java b/Common/src/main/java/at/petrak/hexcasting/common/items/magic/ItemCreativeUnlocker.java index 33c46cef..7232871b 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/items/magic/ItemCreativeUnlocker.java +++ b/Common/src/main/java/at/petrak/hexcasting/common/items/magic/ItemCreativeUnlocker.java @@ -35,6 +35,18 @@ public class ItemCreativeUnlocker extends Item implements ManaHolderItem { && stack.getHoverName().getString().toLowerCase(Locale.ROOT).contains("debug"); } + public static Component infiniteMedia(Level level) { + String prefix = "item.hexcasting.creative_unlocker."; + + String emphasis = Language.getInstance().getOrDefault(prefix + "for_emphasis"); + MutableComponent emphasized = new TextComponent(""); + for (int i = 0; i < emphasis.length(); i++) { + emphasized.append(rainbow(new TextComponent("" + emphasis.charAt(i)), i, level)); + } + + return emphasized; + } + private static final String TAG_EXTRACTIONS = "extractions"; public ItemCreativeUnlocker(Properties properties) { @@ -154,11 +166,7 @@ public class ItemCreativeUnlocker extends Item implements ManaHolderItem { TooltipFlag isAdvanced) { String prefix = "item.hexcasting.creative_unlocker."; - String emphasis = Language.getInstance().getOrDefault(prefix + "for_emphasis"); - MutableComponent emphasized = new TextComponent(""); - for (int i = 0; i < emphasis.length(); i++) { - emphasized.append(rainbow(new TextComponent("" + emphasis.charAt(i)), i, level)); - } + Component emphasized = infiniteMedia(level); MutableComponent modName = new TranslatableComponent(prefix + "mod_name").withStyle( (s) -> s.withColor(HEX_COLOR)); diff --git a/Fabric/src/main/java/at/petrak/hexcasting/fabric/storage/FabricImpetusStorage.kt b/Fabric/src/main/java/at/petrak/hexcasting/fabric/storage/FabricImpetusStorage.kt index b1edda89..b2369c7c 100644 --- a/Fabric/src/main/java/at/petrak/hexcasting/fabric/storage/FabricImpetusStorage.kt +++ b/Fabric/src/main/java/at/petrak/hexcasting/fabric/storage/FabricImpetusStorage.kt @@ -26,7 +26,7 @@ class FabricImpetusStorage(val impetus: BlockEntityAbstractImpetus) : SingleSlot fun insertStack(stack: ItemStack, transaction: TransactionContext) { val copied = stack.copy() - val extractable = impetus.extractMana(stack, false) + val extractable = impetus.extractManaFromItem(stack, false) manaToTake -= extractable val taken = 64 - stack.count itemsConsumed += taken.toLong() diff --git a/Forge/src/main/java/at/petrak/hexcasting/forge/cap/ForgeImpetusCapability.java b/Forge/src/main/java/at/petrak/hexcasting/forge/cap/ForgeImpetusCapability.java index c05f03a7..f624a21c 100644 --- a/Forge/src/main/java/at/petrak/hexcasting/forge/cap/ForgeImpetusCapability.java +++ b/Forge/src/main/java/at/petrak/hexcasting/forge/cap/ForgeImpetusCapability.java @@ -29,7 +29,7 @@ public record ForgeImpetusCapability(BlockEntityAbstractImpetus impetus) impleme if (!simulate) { impetus.insertMana(stack); } else { - impetus.extractMana(stack, false); // Mana goes nowhere, since nothing is actually being done + impetus.extractManaFromItem(stack, false); // Mana goes nowhere, since nothing is actually being done } return stack; From e05720d80e38811ed83d08b769cb011648d6ca4b Mon Sep 17 00:00:00 2001 From: "yrsegal@gmail.com" Date: Sun, 24 Jul 2022 20:22:31 -0400 Subject: [PATCH 018/117] Fix #110 port of 2e76655d210ec7fedffe8fe04fb4aded161aa09c --- .../common/casting/operators/spells/great/OpTeleport.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 fa7e4ba6..c2dea123 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 @@ -51,7 +51,7 @@ object OpTeleport : SpellOperator { } } - if (teleportee is ServerPlayer) { + if (teleportee is ServerPlayer && teleportee == ctx.caster) { // Drop items conditionally, based on distance teleported. // MOST IMPORTANT: Never drop main hand item, since if it's a trinket, it will get duplicated later. From 54f00073156d865154119e25647f6d3a60679ba8 Mon Sep 17 00:00:00 2001 From: "yrsegal@gmail.com" Date: Sun, 24 Jul 2022 20:23:18 -0400 Subject: [PATCH 019/117] Fix modulo having format error port of 8f6bddb25c078e9bbd79c86146aeab2e3c2045b9 --- Common/src/main/resources/assets/hexcasting/lang/en_us.json | 2 +- 1 file changed, 1 insertion(+), 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 4f9b3b4f..6e0e1b0d 100644 --- a/Common/src/main/resources/assets/hexcasting/lang/en_us.json +++ b/Common/src/main/resources/assets/hexcasting/lang/en_us.json @@ -754,7 +754,7 @@ "hexcasting.page.math.ceil": "\"Ceilings\" a number, raising it to the next integer value if it has a fractional component.", "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.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.", From 96e4569b240414032a4856b430b7408e73739c00 Mon Sep 17 00:00:00 2001 From: "yrsegal@gmail.com" Date: Sun, 24 Jul 2022 20:30:58 -0400 Subject: [PATCH 020/117] add more block protection hooks --- .../operators/spells/OpDestroyWater.kt | 51 +++++----- .../operators/spells/OpEdifySapling.kt | 11 +-- .../casting/operators/spells/OpExtinguish.kt | 94 ++++++++++--------- .../casting/operators/spells/OpIgnite.kt | 9 +- 4 files changed, 90 insertions(+), 75 deletions(-) diff --git a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/spells/OpDestroyWater.kt b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/spells/OpDestroyWater.kt index 7337faff..666bcd0a 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/spells/OpDestroyWater.kt +++ b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/spells/OpDestroyWater.kt @@ -3,6 +3,7 @@ package at.petrak.hexcasting.common.casting.operators.spells import at.petrak.hexcasting.api.misc.ManaConstants import at.petrak.hexcasting.api.spell.* import at.petrak.hexcasting.api.spell.casting.CastingContext +import at.petrak.hexcasting.xplat.IXplatAbstractions import net.minecraft.core.BlockPos import net.minecraft.core.Direction import net.minecraft.core.particles.ParticleTypes @@ -58,27 +59,34 @@ object OpDestroyWater : SpellOperator { val fluid = ctx.world.getFluidState(here) if (fluid != Fluids.EMPTY.defaultFluidState()) { val blockstate = ctx.world.getBlockState(here) - val material = blockstate.material - val success = - if (blockstate.block is BucketPickup && !(blockstate.block as BucketPickup).pickupBlock( - ctx.world, - here, - blockstate - ).isEmpty - ) { - true - } else if (blockstate.block is LiquidBlock) { - ctx.world.setBlock(here, Blocks.AIR.defaultBlockState(), 3) - true - } else if (material == Material.WATER_PLANT || material == Material.REPLACEABLE_WATER_PLANT) { - val blockentity: BlockEntity? = - if (blockstate.hasBlockEntity()) ctx.world.getBlockEntity(here) else null - Block.dropResources(blockstate, ctx.world, here, blockentity) - ctx.world.setBlock(here, Blocks.AIR.defaultBlockState(), 3) - true - } else { - false - } + if (IXplatAbstractions.INSTANCE.isBreakingAllowed( + ctx.world, + here, + blockstate, + ctx.caster + ) + ) { + val material = blockstate.material + val success = + if (blockstate.block is BucketPickup && !(blockstate.block as BucketPickup).pickupBlock( + ctx.world, + here, + blockstate + ).isEmpty + ) { + true + } else if (blockstate.block is LiquidBlock) { + ctx.world.setBlock(here, Blocks.AIR.defaultBlockState(), 3) + true + } else if (material == Material.WATER_PLANT || material == Material.REPLACEABLE_WATER_PLANT) { + val blockentity: BlockEntity? = + if (blockstate.hasBlockEntity()) ctx.world.getBlockEntity(here) else null + Block.dropResources(blockstate, ctx.world, here, blockentity) + ctx.world.setBlock(here, Blocks.AIR.defaultBlockState(), 3) + true + } else { + false + } if (success) { ctx.world.sendParticles( @@ -98,6 +106,7 @@ object OpDestroyWater : SpellOperator { } } } + } } } 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 aa285d63..bce25a16 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,14 +1,11 @@ package at.petrak.hexcasting.common.casting.operators.spells import at.petrak.hexcasting.api.misc.ManaConstants -import at.petrak.hexcasting.api.spell.getChecked -import at.petrak.hexcasting.api.spell.ParticleSpray -import at.petrak.hexcasting.api.spell.RenderedSpell -import at.petrak.hexcasting.api.spell.SpellDatum -import at.petrak.hexcasting.api.spell.SpellOperator +import at.petrak.hexcasting.api.spell.* import at.petrak.hexcasting.api.spell.casting.CastingContext import at.petrak.hexcasting.api.spell.mishaps.MishapBadBlock import at.petrak.hexcasting.common.misc.AkashicTreeGrower +import at.petrak.hexcasting.xplat.IXplatAbstractions import net.minecraft.core.BlockPos import net.minecraft.tags.BlockTags import net.minecraft.world.phys.Vec3 @@ -37,7 +34,9 @@ object OpEdifySapling : SpellOperator { private data class Spell(val pos: BlockPos) : RenderedSpell { override fun cast(ctx: CastingContext) { - if (!ctx.world.mayInteract(ctx.caster, pos)) + val blockstate = ctx.world.getBlockState(pos) + if (!ctx.world.mayInteract(ctx.caster, pos) || + !IXplatAbstractions.INSTANCE.isBreakingAllowed(ctx.world, pos, blockstate, ctx.caster)) return val bs = ctx.world.getBlockState(pos) 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 30df546f..d48ade8b 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,6 +4,7 @@ import at.petrak.hexcasting.api.misc.ManaConstants import at.petrak.hexcasting.api.spell.* import at.petrak.hexcasting.api.spell.casting.CastingContext import at.petrak.hexcasting.ktxt.UseOnContext +import at.petrak.hexcasting.xplat.IXplatAbstractions import net.minecraft.core.BlockPos import net.minecraft.core.Direction import net.minecraft.core.particles.ParticleTypes @@ -56,53 +57,56 @@ object OpExtinguish : SpellOperator { ) { // never seen this pos in my life val blockstate = ctx.world.getBlockState(here) - val success = - when (blockstate.block) { - is BaseFireBlock -> { - ctx.world.setBlock(here, Blocks.AIR.defaultBlockState(), 3); true + if (IXplatAbstractions.INSTANCE.isBreakingAllowed(ctx.world, here, blockstate, ctx.caster)) { + val success = + when (blockstate.block) { + is BaseFireBlock -> { + ctx.world.setBlock(here, Blocks.AIR.defaultBlockState(), 3); true + } + is CampfireBlock -> { + if (blockstate.getValue(CampfireBlock.LIT)) { // check if campfire is lit before putting it out + val wilson = + Items.WOODEN_SHOVEL // summon shovel from the ether to do our bidding + val hereVec = Vec3.atCenterOf(here) + wilson.useOn( + UseOnContext( + ctx.world, + null, + InteractionHand.MAIN_HAND, + ItemStack(wilson), + BlockHitResult(hereVec, Direction.UP, here, false) + ) + ); true + } else false + } + is AbstractCandleBlock -> { + if (blockstate.getValue(AbstractCandleBlock.LIT)) { // same check for candles + AbstractCandleBlock.extinguish(null, blockstate, ctx.world, here); true + } else false + } + is NetherPortalBlock -> { + ctx.world.setBlock(here, Blocks.AIR.defaultBlockState(), 3); true + } + else -> false } - is CampfireBlock -> { - if (blockstate.getValue(CampfireBlock.LIT)) { // check if campfire is lit before putting it out - val wilson = Items.WOODEN_SHOVEL // summon shovel from the ether to do our bidding - val hereVec = Vec3.atCenterOf(here) - wilson.useOn( - UseOnContext( - ctx.world, - null, - InteractionHand.MAIN_HAND, - ItemStack(wilson), - BlockHitResult(hereVec, Direction.UP, here, false) - ) - ); true - } else false - } - is AbstractCandleBlock -> { - if (blockstate.getValue(AbstractCandleBlock.LIT)) { // same check for candles - AbstractCandleBlock.extinguish(null, blockstate, ctx.world, here); true - } else false - } - is NetherPortalBlock -> { - ctx.world.setBlock(here, Blocks.AIR.defaultBlockState(), 3); true - } - else -> false - } - if (success) { - ctx.world.sendParticles( - ParticleTypes.SMOKE, - here.x + 0.5 + Math.random() * 0.4 - 0.2, - here.y + 0.5 + Math.random() * 0.4 - 0.2, - here.z + 0.5 + Math.random() * 0.4 - 0.2, - 2, - 0.0, - 0.05, - 0.0, - 0.0 - ) - successes++ - } - for (dir in Direction.values()) { - todo.add(here.relative(dir)) + if (success) { + ctx.world.sendParticles( + ParticleTypes.SMOKE, + here.x + 0.5 + Math.random() * 0.4 - 0.2, + here.y + 0.5 + Math.random() * 0.4 - 0.2, + here.z + 0.5 + Math.random() * 0.4 - 0.2, + 2, + 0.0, + 0.05, + 0.0, + 0.0 + ) + successes++ + } + for (dir in Direction.values()) { + todo.add(here.relative(dir)) + } } } } 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 793a2a5d..0262b4c0 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 @@ -5,6 +5,7 @@ import at.petrak.hexcasting.api.misc.ManaConstants import at.petrak.hexcasting.api.spell.* import at.petrak.hexcasting.api.spell.casting.CastingContext import at.petrak.hexcasting.ktxt.UseOnContext +import at.petrak.hexcasting.xplat.IXplatAbstractions import net.minecraft.core.BlockPos import net.minecraft.core.Direction import net.minecraft.world.InteractionHand @@ -33,11 +34,13 @@ object OpIgnite : SpellOperator { private data class Spell(val target: Vec3) : RenderedSpell { override fun cast(ctx: CastingContext) { val pos = BlockPos(target) - if (!ctx.world.mayInteract(ctx.caster, pos)) - return // steal petra code that steals bucket code val maxwell = Items.FIRE_CHARGE + + if (!ctx.world.mayInteract(ctx.caster, pos) || !IXplatAbstractions.INSTANCE.isPlacingAllowed(ctx.world, pos, ItemStack(maxwell), ctx.caster)) + return + if (maxwell is FireChargeItem) { // help maxwell.useOn( @@ -45,7 +48,7 @@ object OpIgnite : SpellOperator { ctx.world, null, InteractionHand.MAIN_HAND, - ItemStack(maxwell.asItem()), + ItemStack(maxwell), BlockHitResult(target, Direction.UP, pos, false) ) ) From ffdf67544415e48e04ead2025b249c2582768c2e Mon Sep 17 00:00:00 2001 From: gattsuru Date: Sun, 24 Jul 2022 21:46:28 -0400 Subject: [PATCH 021/117] Requested change. --- Common/src/main/resources/assets/hexcasting/lang/en_us.json | 2 +- 1 file changed, 1 insertion(+), 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 a80983fa..1ef23bb5 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.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/$s per point of explosion power.", "hexcasting.page.basic_spell.explode.fire.1": "Remove a number and vector from the stack, then create a fiery explosion at the given location with the given power.", "hexcasting.page.basic_spell.explode.fire.2": "Costs one $(l:items/amethyst)$(item)Amethyst Dust/$, plus about 3 extra $(l:items/amethyst)$(item)Amethyst Dust/$s per point of explosion power. Otherwise, the same as $(l:patterns/spells/basic#hexcasting:explode)$(action)Explosion/$, except with fire.", - "hexcasting.page.basic_spell.add_motion": "Remove an entity and direction from the stack, then give a shove to the given entity in the given direction. The strength of the impulse is determined by the length of the vector.$(br)Costs units of $(l:items/amethyst)$(item)Amethyst Dust/$ equal to the square of the length of the vector, plus one for every Impulse after the first in a spell.", + "hexcasting.page.basic_spell.add_motion": "Remove an entity and direction from the stack, then give a shove to the given entity in the given direction. The strength of the impulse is determined by the length of the vector.$(br)Costs units of $(l:items/amethyst)$(item)Amethyst Dust/$ equal to the square of the length of the vector, plus one for every Impulse besides the first in a spell.", "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/$.", From 4ed6f299e7925c864769a4f4e0ffd138c87ab577 Mon Sep 17 00:00:00 2001 From: "yrsegal@gmail.com" Date: Mon, 25 Jul 2022 10:56:23 -0400 Subject: [PATCH 022/117] trinkets/curios integration --- .../circle/BlockEntityAbstractImpetus.java | 7 ++- .../client/ScryingLensOverlayRegistry.java | 14 ++--- .../client/HexAdditionalRenderers.java | 22 +------ .../client/RegisterClientStuff.java | 24 +++---- .../BlockEntityStoredPlayerImpetus.java | 5 +- .../hexcasting/common/items/ItemLens.java | 63 ++++++++++--------- .../petrak/hexcasting/interop/HexInterop.java | 7 +++ .../xplat/IClientXplatAbstractions.java | 2 + Fabric/build.gradle | 1 + Fabric/gradle.properties | 1 + .../fabric/FabricHexClientInitializer.kt | 3 + .../hexcasting/fabric/FabricHexInitializer.kt | 2 + .../interop/trinkets/LensTrinketRenderer.java | 51 +++++++++++++++ .../interop/trinkets/TrinketsApiInterop.java | 29 +++++++++ .../fabric/xplat/FabricClientXplatImpl.java | 10 +++ .../fabric/xplat/FabricXplatImpl.java | 4 ++ .../resources/data/trinkets/entities/hex.json | 8 +++ .../data/trinkets/tags/items/head/face.json | 6 ++ Fabric/src/main/resources/fabric.mod.json | 3 +- Forge/build.gradle | 7 +++ Forge/gradle.properties | 2 + .../forge/ForgeHexClientInitializer.java | 3 + .../hexcasting/forge/ForgeHexInitializer.java | 13 ++++ .../interop/curios/CuriosApiInterop.java | 36 +++++++++++ .../forge/interop/curios/CuriosRenderers.java | 30 +++++++++ .../interop/curios/LensCurioRenderer.java | 54 ++++++++++++++++ .../forge/xplat/ForgeClientXplatImpl.java | 5 ++ .../forge/xplat/ForgeXplatImpl.java | 5 +- .../data/curios/tags/items/head.json | 6 ++ 29 files changed, 348 insertions(+), 75 deletions(-) create mode 100644 Fabric/src/main/java/at/petrak/hexcasting/fabric/interop/trinkets/LensTrinketRenderer.java create mode 100644 Fabric/src/main/java/at/petrak/hexcasting/fabric/interop/trinkets/TrinketsApiInterop.java create mode 100644 Fabric/src/main/resources/data/trinkets/entities/hex.json create mode 100644 Fabric/src/main/resources/data/trinkets/tags/items/head/face.json create mode 100644 Forge/src/main/java/at/petrak/hexcasting/forge/interop/curios/CuriosApiInterop.java create mode 100644 Forge/src/main/java/at/petrak/hexcasting/forge/interop/curios/CuriosRenderers.java create mode 100644 Forge/src/main/java/at/petrak/hexcasting/forge/interop/curios/LensCurioRenderer.java create mode 100644 Forge/src/main/resources/data/curios/tags/items/head.json 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 6b4b792b..56015bdd 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 @@ -116,7 +116,7 @@ public abstract class BlockEntityAbstractImpetus extends HexBlockEntity implemen public void applyScryingLensOverlay(List> lines, BlockState state, BlockPos pos, LocalPlayer observer, ClientLevel world, - Direction hitFace, InteractionHand lensHand) { + Direction hitFace) { if (world.getBlockEntity(pos) instanceof BlockEntityAbstractImpetus beai) { if (beai.getMana() < 0) { lines.add(new Pair<>(new ItemStack(HexItems.AMETHYST_DUST), ItemCreativeUnlocker.infiniteMedia(world))); @@ -533,6 +533,11 @@ public abstract class BlockEntityAbstractImpetus extends HexBlockEntity implemen return false; } + @Override + public void clearContent() { + // NO-OP + } + @Override public boolean canPlaceItem(int index, ItemStack stack) { var manamount = extractManaFromItem(stack, true); 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 d5d95f20..6c111641 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 @@ -10,7 +10,6 @@ import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; import net.minecraft.network.chat.Component; import net.minecraft.resources.ResourceLocation; -import net.minecraft.world.InteractionHand; import net.minecraft.world.item.ItemStack; import net.minecraft.world.level.block.Block; import net.minecraft.world.level.block.Blocks; @@ -18,7 +17,6 @@ import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.phys.BlockHitResult; import net.minecraft.world.phys.HitResult; import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; import java.util.List; import java.util.Map; @@ -116,16 +114,16 @@ public final class ScryingLensOverlayRegistry { */ public static @NotNull List> getLines(BlockState state, BlockPos pos, LocalPlayer observer, ClientLevel world, - Direction hitFace, @Nullable InteractionHand lensHand) { + Direction hitFace) { List> lines = Lists.newArrayList(); var idLookedup = ID_LOOKUP.get(IXplatAbstractions.INSTANCE.getID(state.getBlock())); if (idLookedup != null) { - idLookedup.addLines(lines, state, pos, observer, world, hitFace, lensHand); + idLookedup.addLines(lines, state, pos, observer, world, hitFace); } for (var pair : PREDICATE_LOOKUP) { - if (pair.getFirst().test(state, pos, observer, world, hitFace, lensHand)) { - pair.getSecond().addLines(lines, state, pos, observer, world, hitFace, lensHand); + if (pair.getFirst().test(state, pos, observer, world, hitFace)) { + pair.getSecond().addLines(lines, state, pos, observer, world, hitFace); } } @@ -142,7 +140,7 @@ public final class ScryingLensOverlayRegistry { void addLines(List> lines, BlockState state, BlockPos pos, LocalPlayer observer, ClientLevel world, - Direction hitFace, @Nullable InteractionHand lensHand); + Direction hitFace); } /** @@ -152,6 +150,6 @@ public final class ScryingLensOverlayRegistry { public interface OverlayPredicate { boolean test(BlockState state, BlockPos pos, LocalPlayer observer, ClientLevel world, - Direction hitFace, @Nullable InteractionHand lensHand); + Direction hitFace); } } diff --git a/Common/src/main/java/at/petrak/hexcasting/client/HexAdditionalRenderers.java b/Common/src/main/java/at/petrak/hexcasting/client/HexAdditionalRenderers.java index f8aa0d5e..c7c70932 100644 --- a/Common/src/main/java/at/petrak/hexcasting/client/HexAdditionalRenderers.java +++ b/Common/src/main/java/at/petrak/hexcasting/client/HexAdditionalRenderers.java @@ -2,7 +2,7 @@ package at.petrak.hexcasting.client; import at.petrak.hexcasting.api.client.ScryingLensOverlayRegistry; import at.petrak.hexcasting.api.player.Sentinel; -import at.petrak.hexcasting.common.lib.HexItems; +import at.petrak.hexcasting.common.items.ItemLens; import at.petrak.hexcasting.xplat.IXplatAbstractions; import com.google.common.collect.Lists; import com.mojang.blaze3d.platform.GlStateManager; @@ -22,8 +22,6 @@ import net.minecraft.locale.Language; import net.minecraft.network.chat.FormattedText; import net.minecraft.network.chat.Style; import net.minecraft.util.Mth; -import net.minecraft.world.InteractionHand; -import net.minecraft.world.entity.EquipmentSlot; import net.minecraft.world.item.ItemStack; import net.minecraft.world.phys.BlockHitResult; import net.minecraft.world.phys.HitResult; @@ -157,22 +155,8 @@ public class HexAdditionalRenderers { return; } - boolean foundLens = false; - InteractionHand lensHand = null; - for (var hand : InteractionHand.values()) { - if (player.getItemInHand(hand).is(HexItems.SCRYING_LENS)) { - lensHand = hand; - foundLens = true; - break; - } - } - if (!foundLens && player.getItemBySlot(EquipmentSlot.HEAD).is(HexItems.SCRYING_LENS)) { - foundLens = true; - } - - if (!foundLens) { + if (!ItemLens.hasLensHUD(player)) return; - } var hitRes = mc.hitResult; if (hitRes != null && hitRes.getType() == HitResult.Type.BLOCK) { @@ -180,7 +164,7 @@ public class HexAdditionalRenderers { var pos = bhr.getBlockPos(); var bs = level.getBlockState(pos); - var lines = ScryingLensOverlayRegistry.getLines(bs, pos, player, level, bhr.getDirection(), lensHand); + var lines = ScryingLensOverlayRegistry.getLines(bs, pos, player, level, bhr.getDirection()); int totalHeight = 8; List>> actualLines = Lists.newArrayList(); 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 0faac5ba..77f0ce01 100644 --- a/Common/src/main/java/at/petrak/hexcasting/client/RegisterClientStuff.java +++ b/Common/src/main/java/at/petrak/hexcasting/client/RegisterClientStuff.java @@ -109,15 +109,15 @@ public class RegisterClientStuff { private static void addScryingLensStuff() { ScryingLensOverlayRegistry.addPredicateDisplayer( - (state, pos, observer, world, direction, lensHand) -> state.getBlock() instanceof BlockAbstractImpetus, - (lines, state, pos, observer, world, direction, lensHand) -> { + (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, lensHand); + beai.applyScryingLensOverlay(lines, state, pos, observer, world, direction); } }); ScryingLensOverlayRegistry.addDisplayer(Blocks.NOTE_BLOCK, - (lines, state, pos, observer, world, direction, lensHand) -> { + (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); @@ -139,7 +139,7 @@ public class RegisterClientStuff { }); ScryingLensOverlayRegistry.addDisplayer(HexBlocks.AKASHIC_BOOKSHELF, - (lines, state, pos, observer, world, direction, lensHand) -> { + (lines, state, pos, observer, world, direction) -> { if (world.getBlockEntity(pos) instanceof BlockEntityAkashicBookshelf tile) { var recordPos = tile.getRecordPos(); var pattern = tile.getPattern(); @@ -156,7 +156,7 @@ public class RegisterClientStuff { }); ScryingLensOverlayRegistry.addDisplayer(HexBlocks.AKASHIC_RECORD, - (lines, state, pos, observer, world, direction, lensHand) -> { + (lines, state, pos, observer, world, direction) -> { if (world.getBlockEntity(pos) instanceof BlockEntityAkashicRecord tile) { int count = tile.getCount(); @@ -168,7 +168,7 @@ public class RegisterClientStuff { }); ScryingLensOverlayRegistry.addDisplayer(Blocks.COMPARATOR, - (lines, state, pos, observer, world, direction, lensHand) -> { + (lines, state, pos, observer, world, direction) -> { int comparatorValue = ScryingLensOverlayRegistry.getComparatorValue(true); lines.add(new Pair<>( new ItemStack(Items.REDSTONE), @@ -185,15 +185,15 @@ public class RegisterClientStuff { }); ScryingLensOverlayRegistry.addDisplayer(Blocks.REPEATER, - (lines, state, pos, observer, world, direction, lensHand) -> lines.add(new Pair<>( + (lines, state, pos, observer, world, direction) -> lines.add(new Pair<>( new ItemStack(Items.CLOCK), new TextComponent(String.valueOf(state.getValue(RepeaterBlock.DELAY))) .withStyle(ChatFormatting.YELLOW)))); ScryingLensOverlayRegistry.addPredicateDisplayer( - (state, pos, observer, world, direction, lensHand) -> state.isSignalSource() && !state.is( + (state, pos, observer, world, direction) -> state.isSignalSource() && !state.is( Blocks.COMPARATOR), - (lines, state, pos, observer, world, direction, lensHand) -> { + (lines, state, pos, observer, world, direction) -> { int signalStrength = 0; if (state.getBlock() instanceof RedStoneWireBlock) { signalStrength = state.getValue(RedStoneWireBlock.POWER); @@ -210,8 +210,8 @@ public class RegisterClientStuff { }); ScryingLensOverlayRegistry.addPredicateDisplayer( - (state, pos, observer, world, direction, lensHand) -> state.hasAnalogOutputSignal(), - (lines, state, pos, observer, world, direction, lensHand) -> { + (state, pos, observer, world, direction) -> state.hasAnalogOutputSignal(), + (lines, state, pos, observer, world, direction) -> { int comparatorValue = ScryingLensOverlayRegistry.getComparatorValue(false); lines.add( new Pair<>( diff --git a/Common/src/main/java/at/petrak/hexcasting/common/blocks/entity/BlockEntityStoredPlayerImpetus.java b/Common/src/main/java/at/petrak/hexcasting/common/blocks/entity/BlockEntityStoredPlayerImpetus.java index aef5bf48..44f05a1a 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/blocks/entity/BlockEntityStoredPlayerImpetus.java +++ b/Common/src/main/java/at/petrak/hexcasting/common/blocks/entity/BlockEntityStoredPlayerImpetus.java @@ -14,7 +14,6 @@ import net.minecraft.nbt.NbtUtils; import net.minecraft.nbt.Tag; import net.minecraft.network.chat.Component; import net.minecraft.network.chat.TranslatableComponent; -import net.minecraft.world.InteractionHand; import net.minecraft.world.entity.player.Player; import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.Items; @@ -82,8 +81,8 @@ public class BlockEntityStoredPlayerImpetus extends BlockEntityAbstractImpetus { public void applyScryingLensOverlay(List> lines, BlockState state, BlockPos pos, LocalPlayer observer, ClientLevel world, - Direction hitFace, InteractionHand lensHand) { - super.applyScryingLensOverlay(lines, state, pos, observer, world, hitFace, lensHand); + Direction hitFace) { + super.applyScryingLensOverlay(lines, state, pos, observer, world, hitFace); var name = this.getPlayerName(); if (name != null) { diff --git a/Common/src/main/java/at/petrak/hexcasting/common/items/ItemLens.java b/Common/src/main/java/at/petrak/hexcasting/common/items/ItemLens.java index 29aa56fe..3869e489 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/items/ItemLens.java +++ b/Common/src/main/java/at/petrak/hexcasting/common/items/ItemLens.java @@ -1,27 +1,24 @@ package at.petrak.hexcasting.common.items; import at.petrak.hexcasting.annotations.SoftImplement; +import at.petrak.hexcasting.common.lib.HexItems; import at.petrak.hexcasting.common.network.MsgUpdateComparatorVisualsAck; import at.petrak.hexcasting.xplat.IXplatAbstractions; import com.mojang.datafixers.util.Pair; import net.minecraft.core.BlockPos; import net.minecraft.core.BlockSource; import net.minecraft.core.dispenser.OptionalDispenseItemBehavior; +import net.minecraft.server.level.ServerLevel; import net.minecraft.server.level.ServerPlayer; import net.minecraft.sounds.SoundEvent; import net.minecraft.sounds.SoundEvents; -import net.minecraft.stats.Stats; -import net.minecraft.world.InteractionHand; -import net.minecraft.world.InteractionResultHolder; import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.EquipmentSlot; -import net.minecraft.world.entity.Mob; import net.minecraft.world.entity.player.Player; import net.minecraft.world.item.ArmorItem; import net.minecraft.world.item.Item; import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.Wearable; -import net.minecraft.world.level.Level; import net.minecraft.world.level.block.Blocks; import net.minecraft.world.level.block.DispenserBlock; import net.minecraft.world.level.block.state.properties.BlockStateProperties; @@ -30,11 +27,34 @@ import net.minecraft.world.phys.HitResult; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; +import java.util.ArrayList; +import java.util.List; import java.util.Map; import java.util.WeakHashMap; +import java.util.function.Predicate; public class ItemLens extends Item implements Wearable { + private static final List> HAS_HUD_PREDICATE = new ArrayList<>(); + static { + addLensHUDPredicate(player -> player.getItemBySlot(EquipmentSlot.MAINHAND).is(HexItems.SCRYING_LENS)); + addLensHUDPredicate(player -> player.getItemBySlot(EquipmentSlot.OFFHAND).is(HexItems.SCRYING_LENS)); + addLensHUDPredicate(player -> player.getItemBySlot(EquipmentSlot.HEAD).is(HexItems.SCRYING_LENS)); + } + + public static boolean hasLensHUD(Player player) { + for (Predicate predicate : HAS_HUD_PREDICATE) { + if (predicate.test(player)) { + return true; + } + } + return false; + } + + public static void addLensHUDPredicate(Predicate predicate) { + HAS_HUD_PREDICATE.add(predicate); + } + public ItemLens(Properties pProperties) { super(pProperties); DispenserBlock.registerBehavior(this, new OptionalDispenseItemBehavior() { @@ -53,38 +73,21 @@ public class ItemLens extends Item implements Wearable { return EquipmentSlot.HEAD; } - @Override - public InteractionResultHolder use(Level world, Player player, InteractionHand hand) { - ItemStack itemstack = player.getItemInHand(hand); - EquipmentSlot equipmentslot = Mob.getEquipmentSlotForItem(itemstack); - ItemStack stack = player.getItemBySlot(equipmentslot); - if (stack.isEmpty()) { - player.setItemSlot(equipmentslot, itemstack.copy()); - if (!world.isClientSide()) { - player.awardStat(Stats.ITEM_USED.get(this)); - } - - itemstack.setCount(0); - return InteractionResultHolder.sidedSuccess(itemstack, world.isClientSide()); - } else { - return InteractionResultHolder.fail(itemstack); + public static void tickAllPlayers(ServerLevel world) { + for (ServerPlayer player : world.players()) { + tickLens(player); } } - @Override - public void inventoryTick(ItemStack pStack, Level pLevel, Entity pEntity, int pSlotId, boolean pIsSelected) { - if (!pLevel.isClientSide() && pEntity instanceof ServerPlayer player) { - if (pStack == player.getItemBySlot(EquipmentSlot.HEAD) || - pStack == player.getItemBySlot(EquipmentSlot.MAINHAND) || - pStack == player.getItemBySlot(EquipmentSlot.OFFHAND)) { - sendComparatorDataToClient(player); - } + public static void tickLens(Entity pEntity) { + if (!pEntity.getLevel().isClientSide() && pEntity instanceof ServerPlayer player && hasLensHUD(player)) { + sendComparatorDataToClient(player); } } private static final Map> comparatorDataMap = new WeakHashMap<>(); - private void sendComparatorDataToClient(ServerPlayer player) { + private static void sendComparatorDataToClient(ServerPlayer player) { double reachAttribute = IXplatAbstractions.INSTANCE.getReachDistance(player); double distance = player.isCreative() ? reachAttribute : reachAttribute - 0.5; var hitResult = player.pick(distance, 0, false); @@ -104,7 +107,7 @@ public class ItemLens extends Item implements Wearable { } } - private void syncComparatorValue(ServerPlayer player, BlockPos pos, int value) { + private static void syncComparatorValue(ServerPlayer player, BlockPos pos, int value) { var previous = comparatorDataMap.get(player); if (value == -1) { if (previous != null) { 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 4377a363..53cd3094 100644 --- a/Common/src/main/java/at/petrak/hexcasting/interop/HexInterop.java +++ b/Common/src/main/java/at/petrak/hexcasting/interop/HexInterop.java @@ -1,6 +1,7 @@ package at.petrak.hexcasting.interop; import at.petrak.hexcasting.interop.pehkui.PehkuiInterop; +import at.petrak.hexcasting.xplat.IClientXplatAbstractions; import at.petrak.hexcasting.xplat.IXplatAbstractions; import at.petrak.hexcasting.xplat.Platform; import vazkii.patchouli.api.PatchouliAPI; @@ -13,10 +14,12 @@ public class HexInterop { public static final String PEHKUI_ID = "pehkui"; public static final class Forge { + public static final String CURIOS_API_ID = "curios"; } public static final class Fabric { public static final String GRAVITY_CHANGER_API_ID = "gravitychanger"; + public static final String TRINKETS_API_ID = "trinkets"; } public static void init() { @@ -30,6 +33,10 @@ public class HexInterop { xplat.initPlatformSpecific(); } + public static void clientInit() { + IClientXplatAbstractions.INSTANCE.initPlatformSpecific(); + } + private static void initPatchouli() { var integrations = List.of(PEHKUI_ID); diff --git a/Common/src/main/java/at/petrak/hexcasting/xplat/IClientXplatAbstractions.java b/Common/src/main/java/at/petrak/hexcasting/xplat/IClientXplatAbstractions.java index b849e5b8..7b9b1326 100644 --- a/Common/src/main/java/at/petrak/hexcasting/xplat/IClientXplatAbstractions.java +++ b/Common/src/main/java/at/petrak/hexcasting/xplat/IClientXplatAbstractions.java @@ -27,6 +27,8 @@ public interface IClientXplatAbstractions { void setRenderLayer(Block block, RenderType type); + void initPlatformSpecific(); + void registerEntityRenderer(EntityType type, EntityRendererProvider renderer); void registerParticleType(ParticleType type, diff --git a/Fabric/build.gradle b/Fabric/build.gradle index 0dbdf09c..0f60e4e1 100644 --- a/Fabric/build.gradle +++ b/Fabric/build.gradle @@ -85,6 +85,7 @@ dependencies { exclude(group: "net.fabricmc.fabric-api") } + modImplementation "dev.emi:trinkets:$trinketsVersion" modImplementation "dev.emi:emi:${emiVersion}" modImplementation "maven.modrinth:gravity-api:$gravityApiVersion" diff --git a/Fabric/gradle.properties b/Fabric/gradle.properties index 8912af00..82438c20 100644 --- a/Fabric/gradle.properties +++ b/Fabric/gradle.properties @@ -10,3 +10,4 @@ reiVersion=8.0.442 emiVersion=0.1.0+1.18.2 gravityApiVersion=0.7.7+fabric clothConfigVersion=6.1.48 +trinketsVersion=3.3.1 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 ac58d762..8a3859b6 100644 --- a/Fabric/src/main/java/at/petrak/hexcasting/fabric/FabricHexClientInitializer.kt +++ b/Fabric/src/main/java/at/petrak/hexcasting/fabric/FabricHexClientInitializer.kt @@ -6,6 +6,7 @@ import at.petrak.hexcasting.client.RegisterClientStuff import at.petrak.hexcasting.client.ShiftScrollListener 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.ClientTickEvents import net.fabricmc.fabric.api.client.rendering.v1.BlockEntityRendererRegistry @@ -50,5 +51,7 @@ object FabricHexClientInitializer : ClientModInitializer { BlockEntityRendererRegistry.register(type, berp) } }) + + HexInterop.clientInit() } } 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 479fb8b8..bdf941af 100644 --- a/Fabric/src/main/java/at/petrak/hexcasting/fabric/FabricHexInitializer.kt +++ b/Fabric/src/main/java/at/petrak/hexcasting/fabric/FabricHexInitializer.kt @@ -9,6 +9,7 @@ import at.petrak.hexcasting.common.casting.RegisterPatterns 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.loot.HexLootHandler import at.petrak.hexcasting.common.misc.Brainsweeping @@ -72,6 +73,7 @@ object FabricHexInitializer : ModInitializer { } ServerTickEvents.END_WORLD_TICK.register(PlayerPositionRecorder::updateAllPlayers) + ServerTickEvents.END_WORLD_TICK.register(ItemLens::tickAllPlayers) CommandRegistrationCallback.EVENT.register { dp, _ -> HexCommands.register(dp) } diff --git a/Fabric/src/main/java/at/petrak/hexcasting/fabric/interop/trinkets/LensTrinketRenderer.java b/Fabric/src/main/java/at/petrak/hexcasting/fabric/interop/trinkets/LensTrinketRenderer.java new file mode 100644 index 00000000..30b8a208 --- /dev/null +++ b/Fabric/src/main/java/at/petrak/hexcasting/fabric/interop/trinkets/LensTrinketRenderer.java @@ -0,0 +1,51 @@ +package at.petrak.hexcasting.fabric.interop.trinkets; + +import at.petrak.hexcasting.common.lib.HexItems; +import com.mojang.blaze3d.vertex.PoseStack; +import com.mojang.math.Vector3f; +import dev.emi.trinkets.api.SlotReference; +import dev.emi.trinkets.api.client.TrinketRenderer; +import net.minecraft.client.Minecraft; +import net.minecraft.client.model.EntityModel; +import net.minecraft.client.model.PlayerModel; +import net.minecraft.client.player.AbstractClientPlayer; +import net.minecraft.client.renderer.MultiBufferSource; +import net.minecraft.client.renderer.block.model.ItemTransforms; +import net.minecraft.client.renderer.texture.OverlayTexture; +import net.minecraft.world.entity.LivingEntity; +import net.minecraft.world.item.ItemStack; + +/** + * @author WireSegal + * Created at 9:50 AM on 7/25/22. + */ +public class LensTrinketRenderer implements TrinketRenderer { + @Override + public void render(ItemStack stack, SlotReference slotReference, EntityModel model, + PoseStack matrices, MultiBufferSource multiBufferSource, int light, LivingEntity entity, + float limbAngle, float limbDistance, float tickDelta, float animationProgress, + float headYaw, float headPitch) { + if (stack.is(HexItems.SCRYING_LENS) && + model instanceof PlayerModel playerModel && + entity instanceof AbstractClientPlayer player) { + + // from https://github.com/Creators-of-Create/Create/blob/ee33823ed0b5084af10ed131a1626ce71db4c07e/src/main/java/com/simibubi/create/compat/curios/GogglesCurioRenderer.java + + // Translate and rotate with our head + matrices.pushPose(); + TrinketRenderer.followBodyRotations(entity, playerModel); + TrinketRenderer.translateToFace(matrices, playerModel, player, headYaw, headPitch); + + // Translate and scale to our head + matrices.translate(0, 0, 0.3); + matrices.mulPose(Vector3f.ZP.rotationDegrees(180.0f)); + matrices.scale(0.625f, 0.625f, 0.625f); + + // Render + Minecraft.getInstance().getItemRenderer().renderStatic(stack, ItemTransforms.TransformType.HEAD, + light, OverlayTexture.NO_OVERLAY, matrices, multiBufferSource, 0); + matrices.popPose(); + } + } + +} diff --git a/Fabric/src/main/java/at/petrak/hexcasting/fabric/interop/trinkets/TrinketsApiInterop.java b/Fabric/src/main/java/at/petrak/hexcasting/fabric/interop/trinkets/TrinketsApiInterop.java new file mode 100644 index 00000000..a6187d08 --- /dev/null +++ b/Fabric/src/main/java/at/petrak/hexcasting/fabric/interop/trinkets/TrinketsApiInterop.java @@ -0,0 +1,29 @@ +package at.petrak.hexcasting.fabric.interop.trinkets; + +import at.petrak.hexcasting.common.items.ItemLens; +import at.petrak.hexcasting.common.lib.HexItems; +import dev.emi.trinkets.api.TrinketComponent; +import dev.emi.trinkets.api.TrinketsApi; +import dev.emi.trinkets.api.client.TrinketRendererRegistry; +import net.fabricmc.api.EnvType; +import net.fabricmc.api.Environment; + +import java.util.Optional; + +public class TrinketsApiInterop { + public static void init() { + ItemLens.addLensHUDPredicate(player -> { + Optional optional = TrinketsApi.getTrinketComponent(player); + if (optional.isPresent()) { + TrinketComponent component = optional.get(); + return component.isEquipped(HexItems.SCRYING_LENS); + } + return false; + }); + } + + @Environment(EnvType.CLIENT) + public static void clientInit() { + TrinketRendererRegistry.registerRenderer(HexItems.SCRYING_LENS, new LensTrinketRenderer()); + } +} diff --git a/Fabric/src/main/java/at/petrak/hexcasting/fabric/xplat/FabricClientXplatImpl.java b/Fabric/src/main/java/at/petrak/hexcasting/fabric/xplat/FabricClientXplatImpl.java index 76899f3f..4c60abb3 100644 --- a/Fabric/src/main/java/at/petrak/hexcasting/fabric/xplat/FabricClientXplatImpl.java +++ b/Fabric/src/main/java/at/petrak/hexcasting/fabric/xplat/FabricClientXplatImpl.java @@ -2,7 +2,10 @@ package at.petrak.hexcasting.fabric.xplat; import at.petrak.hexcasting.common.network.IMessage; import at.petrak.hexcasting.fabric.client.ExtendedTexture; +import at.petrak.hexcasting.fabric.interop.trinkets.TrinketsApiInterop; +import at.petrak.hexcasting.interop.HexInterop; import at.petrak.hexcasting.xplat.IClientXplatAbstractions; +import at.petrak.hexcasting.xplat.IXplatAbstractions; import net.fabricmc.fabric.api.blockrenderlayer.v1.BlockRenderLayerMap; import net.fabricmc.fabric.api.client.networking.v1.ClientPlayNetworking; import net.fabricmc.fabric.api.client.particle.v1.ParticleFactoryRegistry; @@ -43,6 +46,13 @@ public class FabricClientXplatImpl implements IClientXplatAbstractions { BlockRenderLayerMap.INSTANCE.putBlock(block, type); } + @Override + public void initPlatformSpecific() { + if (IXplatAbstractions.INSTANCE.isModPresent(HexInterop.Fabric.TRINKETS_API_ID)) { + TrinketsApiInterop.clientInit(); + } + } + @Override public void registerEntityRenderer(EntityType type, EntityRendererProvider renderer) { 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 af8f3e6b..c57f7100 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 @@ -14,6 +14,7 @@ import at.petrak.hexcasting.common.lib.HexItems; import at.petrak.hexcasting.common.network.IMessage; import at.petrak.hexcasting.fabric.cc.HexCardinalComponents; import at.petrak.hexcasting.fabric.interop.gravity.GravityApiInterop; +import at.petrak.hexcasting.fabric.interop.trinkets.TrinketsApiInterop; import at.petrak.hexcasting.fabric.recipe.FabricUnsealedIngredient; import at.petrak.hexcasting.interop.HexInterop; import at.petrak.hexcasting.interop.pehkui.PehkuiInterop; @@ -98,6 +99,9 @@ public class FabricXplatImpl implements IXplatAbstractions { if (this.isModPresent(HexInterop.Fabric.GRAVITY_CHANGER_API_ID)) { GravityApiInterop.init(); } + if (this.isModPresent(HexInterop.Fabric.TRINKETS_API_ID)) { + TrinketsApiInterop.init(); + } } @Override diff --git a/Fabric/src/main/resources/data/trinkets/entities/hex.json b/Fabric/src/main/resources/data/trinkets/entities/hex.json new file mode 100644 index 00000000..6f53a620 --- /dev/null +++ b/Fabric/src/main/resources/data/trinkets/entities/hex.json @@ -0,0 +1,8 @@ +{ + "entities": [ + "player" + ], + "slots": [ + "head/face" + ] +} diff --git a/Fabric/src/main/resources/data/trinkets/tags/items/head/face.json b/Fabric/src/main/resources/data/trinkets/tags/items/head/face.json new file mode 100644 index 00000000..9fae8ae7 --- /dev/null +++ b/Fabric/src/main/resources/data/trinkets/tags/items/head/face.json @@ -0,0 +1,6 @@ +{ + "replace": false, + "values": [ + "hexcasting:lens" + ] +} diff --git a/Fabric/src/main/resources/fabric.mod.json b/Fabric/src/main/resources/fabric.mod.json index 3482c873..9c5f83d6 100644 --- a/Fabric/src/main/resources/fabric.mod.json +++ b/Fabric/src/main/resources/fabric.mod.json @@ -55,7 +55,8 @@ }, "suggests": { "gravitychanger": "0.7.7+fabric", - "pehkui": "3.3.2+1.14.4-1.19" + "pehkui": "3.3.2+1.14.4-1.19", + "trinkets": "3.3.1" }, "custom": { diff --git a/Forge/build.gradle b/Forge/build.gradle index ed6a3cea..3150cb41 100644 --- a/Forge/build.gradle +++ b/Forge/build.gradle @@ -119,6 +119,10 @@ repositories { name = "ModMaven" url = "https://modmaven.dev" } + maven { + //location of the maven for curios api + url = "https://maven.theillusivec4.top/" + } } dependencies { @@ -138,6 +142,9 @@ dependencies { compileOnly fg.deobf("mezz.jei:jei-$minecraftVersion:$jeiVersion:api") runtimeOnly fg.deobf("mezz.jei:jei-$minecraftVersion:$jeiVersion") + compileOnly fg.deobf("top.theillusivec4.curios:curios-forge:$minecraftVersion-$curiosVersion:api") + runtimeOnly fg.deobf("top.theillusivec4.curios:curios-forge:$minecraftVersion-$curiosVersion") + // aughh testCompileOnly fg.deobf("at.petra-k.paucal:paucal-forge-$minecraftVersion:$paucalVersion") testCompileOnly fg.deobf("vazkii.patchouli:Patchouli:$minecraftVersion-$patchouliVersion") diff --git a/Forge/gradle.properties b/Forge/gradle.properties index ad1f412f..9a6739a9 100644 --- a/Forge/gradle.properties +++ b/Forge/gradle.properties @@ -1 +1,3 @@ forgeVersion=40.1.0 + +curiosVersion=5.0.7.0 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 dbe92623..8b3f2b21 100644 --- a/Forge/src/main/java/at/petrak/hexcasting/forge/ForgeHexClientInitializer.java +++ b/Forge/src/main/java/at/petrak/hexcasting/forge/ForgeHexClientInitializer.java @@ -5,6 +5,7 @@ import at.petrak.hexcasting.client.HexAdditionalRenderers; import at.petrak.hexcasting.client.RegisterClientStuff; import at.petrak.hexcasting.client.ShiftScrollListener; import at.petrak.hexcasting.client.shader.HexShaders; +import at.petrak.hexcasting.interop.HexInterop; import net.minecraftforge.client.event.*; import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.event.TickEvent; @@ -47,6 +48,8 @@ public class ForgeHexClientInitializer { var cancel = ShiftScrollListener.onScrollInGameplay(e.getScrollDelta()); e.setCanceled(cancel); }); + + HexInterop.clientInit(); } @SubscribeEvent 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 e1a281ca..ef1fc043 100644 --- a/Forge/src/main/java/at/petrak/hexcasting/forge/ForgeHexInitializer.java +++ b/Forge/src/main/java/at/petrak/hexcasting/forge/ForgeHexInitializer.java @@ -12,6 +12,7 @@ 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.loot.HexLootHandler; import at.petrak.hexcasting.common.misc.Brainsweeping; @@ -20,6 +21,8 @@ import at.petrak.hexcasting.common.recipe.HexRecipeSerializers; 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.interop.curios.CuriosApiInterop; +import at.petrak.hexcasting.forge.interop.curios.CuriosRenderers; import at.petrak.hexcasting.forge.network.ForgePacketHandler; import at.petrak.hexcasting.forge.network.MsgBrainsweepAck; import at.petrak.hexcasting.forge.recipe.ForgeUnsealedIngredient; @@ -37,6 +40,7 @@ import net.minecraft.world.item.Item; import net.minecraft.world.item.ItemStack; import net.minecraft.world.level.block.entity.BlockEntity; import net.minecraft.world.level.block.state.BlockState; +import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.common.ForgeConfigSpec; import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.common.ToolActions; @@ -51,6 +55,8 @@ import net.minecraftforge.event.entity.player.PlayerEvent; import net.minecraftforge.event.entity.player.PlayerInteractEvent; import net.minecraftforge.event.world.BlockEvent; import net.minecraftforge.eventbus.api.IEventBus; +import net.minecraftforge.fml.DistExecutor; +import net.minecraftforge.fml.ModList; import net.minecraftforge.fml.ModLoadingContext; import net.minecraftforge.fml.common.Mod; import net.minecraftforge.fml.config.ModConfig; @@ -160,6 +166,7 @@ public class ForgeHexInitializer { evBus.addListener((LivingEvent.LivingUpdateEvent evt) -> { OpFlight.INSTANCE.tickDownFlight(evt.getEntityLiving()); + ItemLens.tickLens(evt.getEntityLiving()); }); evBus.addListener((TickEvent.WorldTickEvent evt) -> { @@ -208,6 +215,12 @@ public class ForgeHexInitializer { 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)); + } } // aaaauughhg diff --git a/Forge/src/main/java/at/petrak/hexcasting/forge/interop/curios/CuriosApiInterop.java b/Forge/src/main/java/at/petrak/hexcasting/forge/interop/curios/CuriosApiInterop.java new file mode 100644 index 00000000..2f3ebcd7 --- /dev/null +++ b/Forge/src/main/java/at/petrak/hexcasting/forge/interop/curios/CuriosApiInterop.java @@ -0,0 +1,36 @@ +package at.petrak.hexcasting.forge.interop.curios; + +import at.petrak.hexcasting.common.items.ItemLens; +import at.petrak.hexcasting.common.lib.HexItems; +import at.petrak.hexcasting.interop.HexInterop; +import net.minecraftforge.fml.InterModComms; +import net.minecraftforge.fml.event.lifecycle.FMLClientSetupEvent; +import net.minecraftforge.fml.event.lifecycle.InterModEnqueueEvent; +import top.theillusivec4.curios.api.CuriosCapability; +import top.theillusivec4.curios.api.SlotTypeMessage; +import top.theillusivec4.curios.api.SlotTypePreset; +import top.theillusivec4.curios.api.type.inventory.ICurioStacksHandler; + +import java.util.concurrent.atomic.AtomicBoolean; + +public class CuriosApiInterop { + + public static void init() { + ItemLens.addLensHUDPredicate(player -> { + AtomicBoolean hasLens = new AtomicBoolean(false); + player.getCapability(CuriosCapability.INVENTORY).ifPresent(handler -> { + ICurioStacksHandler stacksHandler = handler.getCurios().get("head"); + if(stacksHandler != null) hasLens.set(stacksHandler.getStacks().getStackInSlot(0).is(HexItems.SCRYING_LENS)); + }); + return hasLens.get(); + }); + } + + public static void onInterModEnqueue(final InterModEnqueueEvent event) { + InterModComms.sendTo(HexInterop.Forge.CURIOS_API_ID, SlotTypeMessage.REGISTER_TYPE, () -> SlotTypePreset.HEAD.getMessageBuilder().build()); + } + + public static void onClientSetup(final FMLClientSetupEvent event) { + CuriosRenderers.register(); + } +} diff --git a/Forge/src/main/java/at/petrak/hexcasting/forge/interop/curios/CuriosRenderers.java b/Forge/src/main/java/at/petrak/hexcasting/forge/interop/curios/CuriosRenderers.java new file mode 100644 index 00000000..f0552fc1 --- /dev/null +++ b/Forge/src/main/java/at/petrak/hexcasting/forge/interop/curios/CuriosRenderers.java @@ -0,0 +1,30 @@ +package at.petrak.hexcasting.forge.interop.curios; + +import at.petrak.hexcasting.common.lib.HexItems; +import net.minecraft.client.Minecraft; +import net.minecraft.client.model.HumanoidModel; +import net.minecraft.client.model.geom.PartPose; +import net.minecraft.client.model.geom.builders.CubeDeformation; +import net.minecraft.client.model.geom.builders.CubeListBuilder; +import net.minecraft.client.model.geom.builders.LayerDefinition; +import net.minecraft.client.model.geom.builders.MeshDefinition; +import net.minecraftforge.api.distmarker.Dist; +import net.minecraftforge.api.distmarker.OnlyIn; +import net.minecraftforge.client.event.EntityRenderersEvent; +import top.theillusivec4.curios.api.client.CuriosRendererRegistry; + +@OnlyIn(Dist.CLIENT) +public class CuriosRenderers { + public static void register() { + CuriosRendererRegistry.register(HexItems.SCRYING_LENS, () -> new LensCurioRenderer(Minecraft.getInstance().getEntityModels().bakeLayer(LensCurioRenderer.LAYER))); + } + + public static void onLayerRegister(final EntityRenderersEvent.RegisterLayerDefinitions event) { + event.registerLayerDefinition(LensCurioRenderer.LAYER, () -> { + CubeListBuilder builder = new CubeListBuilder(); + MeshDefinition mesh = HumanoidModel.createMesh(CubeDeformation.NONE, 0); + mesh.getRoot().addOrReplaceChild("head", builder, PartPose.ZERO); + return LayerDefinition.create(mesh, 1, 1); + }); + } +} diff --git a/Forge/src/main/java/at/petrak/hexcasting/forge/interop/curios/LensCurioRenderer.java b/Forge/src/main/java/at/petrak/hexcasting/forge/interop/curios/LensCurioRenderer.java new file mode 100644 index 00000000..376731df --- /dev/null +++ b/Forge/src/main/java/at/petrak/hexcasting/forge/interop/curios/LensCurioRenderer.java @@ -0,0 +1,54 @@ +package at.petrak.hexcasting.forge.interop.curios; + +import at.petrak.hexcasting.api.HexAPI; +import com.mojang.blaze3d.vertex.PoseStack; +import com.mojang.math.Vector3f; +import net.minecraft.client.Minecraft; +import net.minecraft.client.model.EntityModel; +import net.minecraft.client.model.HumanoidModel; +import net.minecraft.client.model.geom.ModelLayerLocation; +import net.minecraft.client.model.geom.ModelPart; +import net.minecraft.client.renderer.MultiBufferSource; +import net.minecraft.client.renderer.block.model.ItemTransforms; +import net.minecraft.client.renderer.entity.RenderLayerParent; +import net.minecraft.client.renderer.texture.OverlayTexture; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.world.entity.LivingEntity; +import net.minecraft.world.item.ItemStack; +import top.theillusivec4.curios.api.SlotContext; +import top.theillusivec4.curios.api.client.ICurioRenderer; + +public class LensCurioRenderer implements ICurioRenderer { + public static final ModelLayerLocation LAYER = new ModelLayerLocation(new ResourceLocation(HexAPI.MOD_ID, "lens"), "lens"); + + private final HumanoidModel model; + + public LensCurioRenderer(ModelPart part) { + this.model = new HumanoidModel<>(part); + } + + @Override + public > void render(ItemStack stack, SlotContext slotContext, PoseStack matrixStack, RenderLayerParent renderLayerParent, MultiBufferSource renderTypeBuffer, int light, float limbSwing, float limbSwingAmount, float partialTicks, float ageInTicks, float netHeadYaw, float headPitch) { + // https://github.com/Creators-of-Create/Create/blob/ee33823ed0b5084af10ed131a1626ce71db4c07e/src/main/java/com/simibubi/create/compat/curios/GogglesCurioRenderer.java + + // Prepare values for transformation + model.setupAnim(slotContext.entity(), limbSwing, limbSwingAmount, ageInTicks, netHeadYaw, headPitch); + model.prepareMobModel(slotContext.entity(), limbSwing, limbSwingAmount, partialTicks); + ICurioRenderer.followHeadRotations(slotContext.entity(), model.head); + + // Translate and rotate with our head + matrixStack.pushPose(); + matrixStack.translate(model.head.x / 16.0, model.head.y / 16.0, model.head.z / 16.0); + matrixStack.mulPose(Vector3f.YP.rotation(model.head.yRot)); + matrixStack.mulPose(Vector3f.XP.rotation(model.head.xRot)); + + // Translate and scale to our head + matrixStack.translate(0, -0.25, 0); + matrixStack.mulPose(Vector3f.ZP.rotationDegrees(180.0f)); + matrixStack.scale(0.625f, 0.625f, 0.625f); + + // Render + Minecraft.getInstance().getItemRenderer().renderStatic(stack, ItemTransforms.TransformType.HEAD, light, OverlayTexture.NO_OVERLAY, matrixStack, renderTypeBuffer, 0); + matrixStack.popPose(); + } +} diff --git a/Forge/src/main/java/at/petrak/hexcasting/forge/xplat/ForgeClientXplatImpl.java b/Forge/src/main/java/at/petrak/hexcasting/forge/xplat/ForgeClientXplatImpl.java index a3013b1c..9107e1c7 100644 --- a/Forge/src/main/java/at/petrak/hexcasting/forge/xplat/ForgeClientXplatImpl.java +++ b/Forge/src/main/java/at/petrak/hexcasting/forge/xplat/ForgeClientXplatImpl.java @@ -37,6 +37,11 @@ public class ForgeClientXplatImpl implements IClientXplatAbstractions { ItemBlockRenderTypes.setRenderLayer(block, type); } + @Override + public void initPlatformSpecific() { + // NO-OP + } + @Override public void registerEntityRenderer(EntityType type, EntityRendererProvider renderer) { 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 f1a24096..8e7e9a26 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 @@ -17,6 +17,7 @@ import at.petrak.hexcasting.common.lib.HexItems; import at.petrak.hexcasting.common.network.IMessage; import at.petrak.hexcasting.forge.cap.CapSyncers; import at.petrak.hexcasting.forge.cap.HexCapabilities; +import at.petrak.hexcasting.forge.interop.curios.CuriosApiInterop; import at.petrak.hexcasting.forge.network.ForgePacketHandler; import at.petrak.hexcasting.forge.network.MsgBrainsweepAck; import at.petrak.hexcasting.forge.recipe.ForgeUnsealedIngredient; @@ -99,7 +100,9 @@ public class ForgeXplatImpl implements IXplatAbstractions { @Override public void initPlatformSpecific() { - // NO-OP + if (this.isModPresent(HexInterop.Forge.CURIOS_API_ID)) { + CuriosApiInterop.init(); + } } @Override diff --git a/Forge/src/main/resources/data/curios/tags/items/head.json b/Forge/src/main/resources/data/curios/tags/items/head.json new file mode 100644 index 00000000..9fae8ae7 --- /dev/null +++ b/Forge/src/main/resources/data/curios/tags/items/head.json @@ -0,0 +1,6 @@ +{ + "replace": false, + "values": [ + "hexcasting:lens" + ] +} From e677e5431349b9c993f241a254b7fcf313bdc3e8 Mon Sep 17 00:00:00 2001 From: gattsuru Date: Mon, 25 Jul 2022 12:55:43 -0400 Subject: [PATCH 023/117] Improve Comments and Readability for AkashicTreeGrower init --- .../at/petrak/hexcasting/common/misc/AkashicTreeGrower.java | 3 ++- .../at/petrak/hexcasting/fabric/FabricHexInitializer.kt | 5 ++++- .../at/petrak/hexcasting/forge/ForgeHexInitializer.java | 6 ++++++ 3 files changed, 12 insertions(+), 2 deletions(-) diff --git a/Common/src/main/java/at/petrak/hexcasting/common/misc/AkashicTreeGrower.java b/Common/src/main/java/at/petrak/hexcasting/common/misc/AkashicTreeGrower.java index 71f56cdc..9cba2f06 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/misc/AkashicTreeGrower.java +++ b/Common/src/main/java/at/petrak/hexcasting/common/misc/AkashicTreeGrower.java @@ -26,7 +26,8 @@ public class AkashicTreeGrower extends AbstractTreeGrower { public static final List>> GROWERS = Lists.newArrayList(); - static { + public void RegisterTreeGrowers() + { GROWERS.add(buildTreeFeature(HexBlocks.AKASHIC_LEAVES1, "1")); GROWERS.add(buildTreeFeature(HexBlocks.AKASHIC_LEAVES2, "2")); GROWERS.add(buildTreeFeature(HexBlocks.AKASHIC_LEAVES3, "3")); 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 d2617383..b0a8325f 100644 --- a/Fabric/src/main/java/at/petrak/hexcasting/fabric/FabricHexInitializer.kt +++ b/Fabric/src/main/java/at/petrak/hexcasting/fabric/FabricHexInitializer.kt @@ -100,7 +100,10 @@ object FabricHexInitializer : ModInitializer { HexLootFunctions.registerSerializers(bind(Registry.LOOT_FUNCTION_TYPE)) - AkashicTreeGrower.INSTANCE + // 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, + // unless the class is called in this initialization step. + AkashicTreeGrower.INSTANCE.RegisterTreeGrowers() // Done with soft implements in forge val flameOn = FlammableBlockRegistry.getDefaultInstance() 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 e1a281ca..4df82313 100644 --- a/Forge/src/main/java/at/petrak/hexcasting/forge/ForgeHexInitializer.java +++ b/Forge/src/main/java/at/petrak/hexcasting/forge/ForgeHexInitializer.java @@ -14,6 +14,7 @@ import at.petrak.hexcasting.common.entities.HexEntities; import at.petrak.hexcasting.common.items.ItemJewelerHammer; import at.petrak.hexcasting.common.lib.*; 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.PlayerPositionRecorder; import at.petrak.hexcasting.common.recipe.HexRecipeSerializers; @@ -104,6 +105,11 @@ public class ForgeHexInitializer { ArgumentTypes.register(HexAPI.MOD_ID + ":pattern", PatternResLocArgument.class, new EmptyArgumentSerializer<>(PatternResLocArgument::id)); HexAdvancementTriggers.registerTriggers(); + + // 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. Explicitly calling here avoids potential + // confusion, or reliance on tricks that may fail under compiler optimization. + AkashicTreeGrower.INSTANCE.RegisterTreeGrowers(); } // https://github.com/VazkiiMods/Botania/blob/1.18.x/Forge/src/main/java/vazkii/botania/forge/ForgeCommonInitializer.java From e083b311012a0258297cd072306f381ffc4625f7 Mon Sep 17 00:00:00 2001 From: "yrsegal@gmail.com" Date: Mon, 25 Jul 2022 13:16:08 -0400 Subject: [PATCH 024/117] cleanups --- .../at/petrak/hexcasting/common/misc/AkashicTreeGrower.java | 3 +-- Common/src/main/resources/assets/hexcasting/lang/en_us.json | 2 +- .../java/at/petrak/hexcasting/fabric/FabricHexInitializer.kt | 2 +- .../java/at/petrak/hexcasting/forge/ForgeHexInitializer.java | 2 +- 4 files changed, 4 insertions(+), 5 deletions(-) diff --git a/Common/src/main/java/at/petrak/hexcasting/common/misc/AkashicTreeGrower.java b/Common/src/main/java/at/petrak/hexcasting/common/misc/AkashicTreeGrower.java index 9cba2f06..bd39c583 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/misc/AkashicTreeGrower.java +++ b/Common/src/main/java/at/petrak/hexcasting/common/misc/AkashicTreeGrower.java @@ -26,8 +26,7 @@ public class AkashicTreeGrower extends AbstractTreeGrower { public static final List>> GROWERS = Lists.newArrayList(); - public void RegisterTreeGrowers() - { + public static void init() { GROWERS.add(buildTreeFeature(HexBlocks.AKASHIC_LEAVES1, "1")); GROWERS.add(buildTreeFeature(HexBlocks.AKASHIC_LEAVES2, "2")); GROWERS.add(buildTreeFeature(HexBlocks.AKASHIC_LEAVES3, "3")); 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 d2c6c272..b1b41ed0 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.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/$s per point of explosion power.", "hexcasting.page.basic_spell.explode.fire.1": "Remove a number and vector from the stack, then create a fiery explosion at the given location with the given power.", "hexcasting.page.basic_spell.explode.fire.2": "Costs one $(l:items/amethyst)$(item)Amethyst Dust/$, plus about 3 extra $(l:items/amethyst)$(item)Amethyst Dust/$s per point of explosion power. Otherwise, the same as $(l:patterns/spells/basic#hexcasting:explode)$(action)Explosion/$, except with fire.", - "hexcasting.page.basic_spell.add_motion": "Remove an entity and direction from the stack, then give a shove to the given entity in the given direction. The strength of the impulse is determined by the length of the vector.$(br)Costs units of $(l:items/amethyst)$(item)Amethyst Dust/$ equal to the square of the length of the vector, plus one for every Impulse besides the first in a spell.", + "hexcasting.page.basic_spell.add_motion": "Remove an entity and direction from the stack, then give a shove to the given entity in the given direction. The strength of the impulse is determined by the length of the vector.$(br)Costs units of $(l:items/amethyst)$(item)Amethyst Dust/$ equal to the square of the length of the vector, plus one for every Impulse except the first targeting an entity.", "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/$.", 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 2f0226e8..95b7fd49 100644 --- a/Fabric/src/main/java/at/petrak/hexcasting/fabric/FabricHexInitializer.kt +++ b/Fabric/src/main/java/at/petrak/hexcasting/fabric/FabricHexInitializer.kt @@ -105,7 +105,7 @@ object FabricHexInitializer : ModInitializer { // 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, // unless the class is called in this initialization step. - AkashicTreeGrower.INSTANCE.RegisterTreeGrowers() + AkashicTreeGrower.init() // Done with soft implements in forge val flameOn = FlammableBlockRegistry.getDefaultInstance() 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 b4e18115..fbf7ead9 100644 --- a/Forge/src/main/java/at/petrak/hexcasting/forge/ForgeHexInitializer.java +++ b/Forge/src/main/java/at/petrak/hexcasting/forge/ForgeHexInitializer.java @@ -115,7 +115,7 @@ public class ForgeHexInitializer { // 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. Explicitly calling here avoids potential // confusion, or reliance on tricks that may fail under compiler optimization. - AkashicTreeGrower.INSTANCE.RegisterTreeGrowers(); + AkashicTreeGrower.init(); } // https://github.com/VazkiiMods/Botania/blob/1.18.x/Forge/src/main/java/vazkii/botania/forge/ForgeCommonInitializer.java From fe6703f778b82c3c1c0fcaed150d45edb474e5e5 Mon Sep 17 00:00:00 2001 From: gattsuru Date: Mon, 25 Jul 2022 14:09:37 -0400 Subject: [PATCH 025/117] Fix Forge Init --- .../at/petrak/hexcasting/forge/ForgeHexInitializer.java | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) 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 fbf7ead9..7bb48b40 100644 --- a/Forge/src/main/java/at/petrak/hexcasting/forge/ForgeHexInitializer.java +++ b/Forge/src/main/java/at/petrak/hexcasting/forge/ForgeHexInitializer.java @@ -111,11 +111,6 @@ public class ForgeHexInitializer { ArgumentTypes.register(HexAPI.MOD_ID + ":pattern", PatternResLocArgument.class, new EmptyArgumentSerializer<>(PatternResLocArgument::id)); HexAdvancementTriggers.registerTriggers(); - - // 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. Explicitly calling here avoids potential - // confusion, or reliance on tricks that may fail under compiler optimization. - AkashicTreeGrower.init(); } // https://github.com/VazkiiMods/Botania/blob/1.18.x/Forge/src/main/java/vazkii/botania/forge/ForgeCommonInitializer.java @@ -143,6 +138,10 @@ public class ForgeHexInitializer { 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(); })); From 508dde11ef15bf5cb163c6127e8bc945d80c90fa Mon Sep 17 00:00:00 2001 From: "yrsegal@gmail.com" Date: Mon, 25 Jul 2022 20:11:06 -0400 Subject: [PATCH 026/117] the lens sees the bees --- .../client/ScryingLensOverlayRegistry.java | 42 +++++++++++++++++-- .../client/RegisterClientStuff.java | 11 +++++ .../hexcasting/common/items/ItemLens.java | 38 +++++++++++------ .../MsgUpdateComparatorVisualsAck.java | 16 +++---- .../assets/hexcasting/lang/en_us.json | 2 + 5 files changed, 87 insertions(+), 22 deletions(-) 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 6c111641..6ff8fd7c 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 @@ -11,6 +11,7 @@ import net.minecraft.core.Direction; import net.minecraft.network.chat.Component; import net.minecraft.resources.ResourceLocation; import net.minecraft.world.item.ItemStack; +import net.minecraft.world.level.block.BeehiveBlock; import net.minecraft.world.level.block.Block; import net.minecraft.world.level.block.Blocks; import net.minecraft.world.level.block.state.BlockState; @@ -37,14 +38,21 @@ public final class ScryingLensOverlayRegistry { // implemented as a map to allow for weak dereferencing private static final Map> comparatorData = new WeakHashMap<>(); + private static final Map> beeData = new WeakHashMap<>(); - public static void receiveComparatorValue(BlockPos pos, int value) { + public static void receiveComparatorAndBeeValue(BlockPos pos, int comparator, int bee) { LocalPlayer player = Minecraft.getInstance().player; if (player != null) { - if (pos == null || value == -1) { + if (pos == null || comparator == -1) { comparatorData.remove(player); } else { - comparatorData.put(player, new Pair<>(pos, value)); + comparatorData.put(player, new Pair<>(pos, comparator)); + } + + if (pos == null || bee == -1) { + beeData.remove(player); + } else { + beeData.put(player, new Pair<>(pos, bee)); } } } @@ -78,6 +86,34 @@ public final class ScryingLensOverlayRegistry { return comparatorValue.getSecond(); } + public static int getBeeValue() { + var mc = Minecraft.getInstance(); + var player = mc.player; + var level = mc.level; + var result = mc.hitResult; + + if (player == null || level == null || result == null || result.getType() != HitResult.Type.BLOCK) { + return -1; + } + + var beeValue = beeData.get(player); + if (beeValue == null) { + return -1; + } + + var pos = ((BlockHitResult) result).getBlockPos(); + if (!pos.equals(beeValue.getFirst())) { + return -1; + } + + var state = mc.level.getBlockState(pos); + if (!(state.getBlock() instanceof BeehiveBlock)) { + return -1; + } + + return beeValue.getSecond(); + } + /** * Add the block to display things when the player is holding a lens and looking at it. * 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 77f0ce01..855600f0 100644 --- a/Common/src/main/java/at/petrak/hexcasting/client/RegisterClientStuff.java +++ b/Common/src/main/java/at/petrak/hexcasting/client/RegisterClientStuff.java @@ -190,6 +190,17 @@ public class RegisterClientStuff { new TextComponent(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 ? new TextComponent("") : + new TranslatableComponent( + "hexcasting.tooltip.lens.bee" + (count == 1 ? ".single" : ""), + count + ))); + }); + ScryingLensOverlayRegistry.addPredicateDisplayer( (state, pos, observer, world, direction) -> state.isSignalSource() && !state.is( Blocks.COMPARATOR), diff --git a/Common/src/main/java/at/petrak/hexcasting/common/items/ItemLens.java b/Common/src/main/java/at/petrak/hexcasting/common/items/ItemLens.java index 3869e489..9bc36f03 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/items/ItemLens.java +++ b/Common/src/main/java/at/petrak/hexcasting/common/items/ItemLens.java @@ -19,8 +19,10 @@ import net.minecraft.world.item.ArmorItem; import net.minecraft.world.item.Item; import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.Wearable; +import net.minecraft.world.level.block.BeehiveBlock; import net.minecraft.world.level.block.Blocks; import net.minecraft.world.level.block.DispenserBlock; +import net.minecraft.world.level.block.entity.BeehiveBlockEntity; import net.minecraft.world.level.block.state.properties.BlockStateProperties; import net.minecraft.world.phys.BlockHitResult; import net.minecraft.world.phys.HitResult; @@ -86,6 +88,7 @@ public class ItemLens extends Item implements Wearable { } private static final Map> comparatorDataMap = new WeakHashMap<>(); + private static final Map> beeDataMap = new WeakHashMap<>(); private static void sendComparatorDataToClient(ServerPlayer player) { double reachAttribute = IXplatAbstractions.INSTANCE.getReachDistance(player); @@ -94,29 +97,40 @@ public class ItemLens extends Item implements Wearable { if (hitResult.getType() == HitResult.Type.BLOCK) { var pos = ((BlockHitResult) hitResult).getBlockPos(); var state = player.level.getBlockState(pos); + + int bee = -1; + + if (state.getBlock() instanceof BeehiveBlock && player.level.getBlockEntity(pos) instanceof BeehiveBlockEntity bees) { + bee = bees.getOccupantCount(); + } + if (state.is(Blocks.COMPARATOR)) { syncComparatorValue(player, pos, - state.getDirectSignal(player.level, pos, state.getValue(BlockStateProperties.HORIZONTAL_FACING))); + state.getDirectSignal(player.level, pos, state.getValue(BlockStateProperties.HORIZONTAL_FACING)), bee); } else if (state.hasAnalogOutputSignal()) { - syncComparatorValue(player, pos, state.getAnalogOutputSignal(player.level, pos)); + syncComparatorValue(player, pos, state.getAnalogOutputSignal(player.level, pos), bee); } else { - syncComparatorValue(player, null, -1); + syncComparatorValue(player, null, -1, bee); } } else { - syncComparatorValue(player, null, -1); + syncComparatorValue(player, null, -1, -1); } } - private static void syncComparatorValue(ServerPlayer player, BlockPos pos, int value) { - var previous = comparatorDataMap.get(player); - if (value == -1) { - if (previous != null) { + private static void syncComparatorValue(ServerPlayer player, BlockPos pos, int comparator, int bee) { + var previousComparator = comparatorDataMap.get(player); + var previousBee = beeDataMap.get(player); + if (comparator == -1 && bee == -1) { + if (previousComparator != null || previousBee != null) { comparatorDataMap.remove(player); - IXplatAbstractions.INSTANCE.sendPacketToPlayer(player, new MsgUpdateComparatorVisualsAck(null, -1)); + beeDataMap.remove(player); + IXplatAbstractions.INSTANCE.sendPacketToPlayer(player, new MsgUpdateComparatorVisualsAck(null, -1, -1)); } - } else if (previous == null || (!pos.equals(previous.getFirst()) || value != previous.getSecond())) { - comparatorDataMap.put(player, new Pair<>(pos, value)); - IXplatAbstractions.INSTANCE.sendPacketToPlayer(player, new MsgUpdateComparatorVisualsAck(pos, value)); + } else if (previousComparator == null || !pos.equals(previousComparator.getFirst()) || comparator != previousComparator.getSecond() || + previousBee == null || !pos.equals(previousBee.getFirst()) || bee != previousBee.getSecond()) { + comparatorDataMap.put(player, new Pair<>(pos, comparator)); + beeDataMap.put(player, new Pair<>(pos, bee)); + IXplatAbstractions.INSTANCE.sendPacketToPlayer(player, new MsgUpdateComparatorVisualsAck(pos, comparator, bee)); } } diff --git a/Common/src/main/java/at/petrak/hexcasting/common/network/MsgUpdateComparatorVisualsAck.java b/Common/src/main/java/at/petrak/hexcasting/common/network/MsgUpdateComparatorVisualsAck.java index 2d534b50..31835cc0 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/network/MsgUpdateComparatorVisualsAck.java +++ b/Common/src/main/java/at/petrak/hexcasting/common/network/MsgUpdateComparatorVisualsAck.java @@ -12,7 +12,7 @@ import static at.petrak.hexcasting.api.HexAPI.modLoc; /** * Sent server->client when a player is looking at a block through a lens whose comparator value is not the same as what they last saw. */ -public record MsgUpdateComparatorVisualsAck(BlockPos pos, int value) implements IMessage { +public record MsgUpdateComparatorVisualsAck(BlockPos pos, int comparator, int bee) implements IMessage { public static final ResourceLocation ID = modLoc("cmp"); @Override @@ -23,15 +23,17 @@ public record MsgUpdateComparatorVisualsAck(BlockPos pos, int value) implements public static MsgUpdateComparatorVisualsAck deserialize(ByteBuf buffer) { var buf = new FriendlyByteBuf(buffer); - int value = buf.readInt(); - BlockPos pos = value == -1 ? null : buf.readBlockPos(); + int comparator = buf.readInt(); + int bee = buf.readInt(); + BlockPos pos = comparator == -1 && bee == -1 ? null : buf.readBlockPos(); - return new MsgUpdateComparatorVisualsAck(pos, value); + return new MsgUpdateComparatorVisualsAck(pos, comparator, bee); } public void serialize(FriendlyByteBuf buf) { - buf.writeInt(this.value); - if (this.value != -1) { + buf.writeInt(this.comparator); + buf.writeInt(this.bee); + if (this.comparator != -1 || this.bee != -1) { buf.writeBlockPos(this.pos); } } @@ -40,7 +42,7 @@ public record MsgUpdateComparatorVisualsAck(BlockPos pos, int value) implements Minecraft.getInstance().execute(new Runnable() { @Override public void run() { - ScryingLensOverlayRegistry.receiveComparatorValue(msg.pos(), msg.value()); + ScryingLensOverlayRegistry.receiveComparatorAndBeeValue(msg.pos(), msg.comparator(), msg.bee()); } }); } 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 6e0e1b0d..50cbab60 100644 --- a/Common/src/main/resources/assets/hexcasting/lang/en_us.json +++ b/Common/src/main/resources/assets/hexcasting/lang/en_us.json @@ -130,6 +130,8 @@ "hexcasting.tooltip.lens.akashic.bookshelf.location": "Record at %s", "hexcasting.tooltip.lens.akashic.record.count": "%s iotas stored", "hexcasting.tooltip.lens.akashic.record.count.single": "%s iota stored", + "hexcasting.tooltip.lens.bee": "%s bees", + "hexcasting.tooltip.lens.bee.single": "%s bee", "hexcasting.tooltip.brainsweep.min_level": "Level %s or higher", "hexcasting.tooltip.brainsweep.level": "Level %s", "hexcasting.tooltip.brainsweep.product": "Mindless Body", From 868086009fccb0412f0e85c387cf0bb78f842c40 Mon Sep 17 00:00:00 2001 From: "yrsegal@gmail.com" Date: Tue, 26 Jul 2022 10:29:57 -0400 Subject: [PATCH 027/117] port swindler's cost removal from 1.0 --- .../stack/OpAlwinfyHasAscendedToABeingOfPureMath.kt | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) 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 5eaf531f..5bc48a81 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,11 +1,9 @@ package at.petrak.hexcasting.common.casting.operators.stack -import at.petrak.hexcasting.api.misc.ManaConstants import at.petrak.hexcasting.api.spell.OperationResult import at.petrak.hexcasting.api.spell.Operator import at.petrak.hexcasting.api.spell.SpellDatum import at.petrak.hexcasting.api.spell.casting.CastingContext -import at.petrak.hexcasting.api.spell.casting.OperatorSideEffect import at.petrak.hexcasting.api.spell.casting.SpellContinuation import at.petrak.hexcasting.api.spell.getChecked import at.petrak.hexcasting.api.spell.mishaps.MishapInvalidIota @@ -13,7 +11,6 @@ import at.petrak.hexcasting.api.spell.mishaps.MishapNotEnoughArgs import at.petrak.hexcasting.api.utils.asTranslatedComponent import it.unimi.dsi.fastutil.ints.IntArrayList import kotlin.math.abs -import kotlin.math.ln import kotlin.math.roundToInt // "lehmer code" @@ -58,13 +55,13 @@ object OpAlwinfyHasAscendedToABeingOfPureMath : Operator { editTarget = editTarget.subList(1, editTarget.size) } - val cost = (ln((strides.lastOrNull() ?: 0).toFloat()) * ManaConstants.DUST_UNIT).toInt() +// val cost = (ln((strides.lastOrNull() ?: 0).toFloat()) * ManaConstants.DUST_UNIT).toInt() return OperationResult( continuation, stack, local, - listOf(OperatorSideEffect.ConsumeMana(cost)) + listOf() // OperatorSideEffect.ConsumeMana(cost) ) } From 81e5f8581eb8c8487fa046ca9685430ac38622aa Mon Sep 17 00:00:00 2001 From: gamma-delta <29877714+gamma-delta@users.noreply.github.com> Date: Tue, 26 Jul 2022 11:49:25 -0500 Subject: [PATCH 028/117] close #189 (anything under 1 tick is a no-op) --- .../casting/operators/spells/OpPotionEffect.kt | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) 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 0e305be6..f08ccc31 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 @@ -26,11 +26,15 @@ class OpPotionEffect( val target = args.getChecked(0, argc) if (target is ArmorStand) throw MishapInvalidIota.ofClass(SpellDatum.make(target), 0, LivingEntity::class.java) + val duration = max(args.getChecked(1, argc), 0.0) - ctx.assertEntityInRange(target) + val potency = if (this.allowPotency) args.getChecked(2, argc).coerceIn(1.0, 128.0) - else 1.0 + else + 1.0 + + ctx.assertEntityInRange(target) val cost = this.baseCost * duration * if (potencyCubic) { potency * potency * potency @@ -47,8 +51,10 @@ class OpPotionEffect( private class Spell(val effect: MobEffect, val target: LivingEntity, val duration: Double, val potency: Double) : RenderedSpell { override fun cast(ctx: CastingContext) { - val effectInst = MobEffectInstance(effect, (duration * 20).toInt(), potency.toInt() - 1) - target.addEffect(effectInst) + if (duration > 1.0 / 20.0) { + val effectInst = MobEffectInstance(effect, (duration * 20).toInt(), potency.toInt() - 1) + target.addEffect(effectInst) + } } } } From 33b50f4a828db47ea250c1f290bcb1c19ce97335 Mon Sep 17 00:00:00 2001 From: gamma-delta <29877714+gamma-delta@users.noreply.github.com> Date: Tue, 26 Jul 2022 13:42:52 -0500 Subject: [PATCH 029/117] fix #188 --- .../api/spell/casting/CastingContext.kt | 10 +++++- .../casting/operators/spells/OpBreakBlock.kt | 2 +- .../casting/operators/spells/OpConjure.kt | 2 +- .../casting/operators/spells/OpCreateWater.kt | 9 ++++- .../operators/spells/OpDestroyWater.kt | 34 +++++++++---------- .../operators/spells/OpEdifySapling.kt | 5 +-- .../casting/operators/spells/OpExplode.kt | 3 +- .../casting/operators/spells/OpExtinguish.kt | 6 +--- .../casting/operators/spells/OpIgnite.kt | 8 ++++- .../casting/operators/spells/OpPlaceBlock.kt | 5 +-- .../operators/spells/great/OpBrainsweep.kt | 11 ++++-- .../operators/spells/great/OpCreateLava.kt | 8 ++++- 12 files changed, 68 insertions(+), 35 deletions(-) diff --git a/Common/src/main/java/at/petrak/hexcasting/api/spell/casting/CastingContext.kt b/Common/src/main/java/at/petrak/hexcasting/api/spell/casting/CastingContext.kt index b0114a52..909f187f 100644 --- a/Common/src/main/java/at/petrak/hexcasting/api/spell/casting/CastingContext.kt +++ b/Common/src/main/java/at/petrak/hexcasting/api/spell/casting/CastingContext.kt @@ -16,6 +16,7 @@ import net.minecraft.world.entity.Entity import net.minecraft.world.entity.player.Player import net.minecraft.world.item.Item import net.minecraft.world.item.ItemStack +import net.minecraft.world.level.GameType import net.minecraft.world.phys.Vec3 import java.util.function.Predicate import kotlin.math.min @@ -83,7 +84,8 @@ data class CastingContext( return entitiesGivenMotion.contains(target) } - fun isVecInWorld(vec: Vec3) = world.isInWorldBounds(BlockPos(vec)) && world.worldBorder.isWithinBounds(vec.x, vec.z, 0.5) + fun isVecInWorld(vec: Vec3) = + world.isInWorldBounds(BlockPos(vec)) && world.worldBorder.isWithinBounds(vec.x, vec.z, 0.5) fun isVecInRange(vec: Vec3): Boolean { val sentinel = IXplatAbstractions.INSTANCE.getSentinel(caster) @@ -117,6 +119,12 @@ data class CastingContext( return isVecInRange(entity.position()) } + fun canEditBlockAt(pos: BlockPos): Boolean { + return this.isVecInRange(Vec3.atCenterOf(pos)) + && this.caster.gameMode.gameModeForPlayer != GameType.ADVENTURE + && this.world.mayInteract(this.caster, pos) + } + /** * Return the slot from which to take blocks and items. */ 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 632adad1..8b4e4606 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 @@ -31,7 +31,7 @@ object OpBreakBlock : SpellOperator { override fun cast(ctx: CastingContext) { val pos = BlockPos(v) - if (!ctx.world.mayInteract(ctx.caster, pos)) + if (!ctx.canEditBlockAt(pos)) return val blockstate = ctx.world.getBlockState(pos) diff --git a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/spells/OpConjure.kt b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/spells/OpConjure.kt index 3bc9d21a..8ed35667 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/spells/OpConjure.kt +++ b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/spells/OpConjure.kt @@ -44,7 +44,7 @@ class OpConjure(val light: Boolean) : SpellOperator { override fun cast(ctx: CastingContext) { val pos = BlockPos(target) - if (!ctx.world.mayInteract(ctx.caster, pos)) + if (!ctx.canEditBlockAt(pos)) return val placeContext = DirectionalPlaceContext(ctx.world, pos, Direction.DOWN, ItemStack.EMPTY, Direction.UP) diff --git a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/spells/OpCreateWater.kt b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/spells/OpCreateWater.kt index 58f23cd9..90d03499 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/spells/OpCreateWater.kt +++ b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/spells/OpCreateWater.kt @@ -35,7 +35,14 @@ object OpCreateWater : SpellOperator { override fun cast(ctx: CastingContext) { val pos = BlockPos(target) - if (!ctx.world.mayInteract(ctx.caster, pos)|| !IXplatAbstractions.INSTANCE.isPlacingAllowed(ctx.world, pos, ItemStack(Items.WATER_BUCKET), ctx.caster)) + if (!ctx.canEditBlockAt(pos) + || !IXplatAbstractions.INSTANCE.isPlacingAllowed( + ctx.world, + pos, + ItemStack(Items.WATER_BUCKET), + ctx.caster + ) + ) return val state = ctx.world.getBlockState(pos) diff --git a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/spells/OpDestroyWater.kt b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/spells/OpDestroyWater.kt index 666bcd0a..a58dd9ba 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/spells/OpDestroyWater.kt +++ b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/spells/OpDestroyWater.kt @@ -54,7 +54,7 @@ object OpDestroyWater : SpellOperator { val here = todo.removeFirst() val distFromFocus = ctx.caster.position().distanceToSqr(Vec3.atCenterOf(here)) - if (distFromFocus < Operator.MAX_DISTANCE * Operator.MAX_DISTANCE && seen.add(here) && ctx.world.mayInteract(ctx.caster, here)) { + if (ctx.canEditBlockAt(here) && seen.add(here)) { // never seen this pos in my life val fluid = ctx.world.getFluidState(here) if (fluid != Fluids.EMPTY.defaultFluidState()) { @@ -88,25 +88,25 @@ object OpDestroyWater : SpellOperator { false } - if (success) { - ctx.world.sendParticles( - ParticleTypes.SMOKE, - here.x + 0.5 + Math.random() * 0.4 - 0.2, - here.y + 0.5 + Math.random() * 0.4 - 0.2, - here.z + 0.5 + Math.random() * 0.4 - 0.2, - 2, - 0.0, - 0.05, - 0.0, - 0.0 - ) - successes++ - for (dir in Direction.values()) { - todo.add(here.relative(dir)) + if (success) { + ctx.world.sendParticles( + ParticleTypes.SMOKE, + here.x + 0.5 + Math.random() * 0.4 - 0.2, + here.y + 0.5 + Math.random() * 0.4 - 0.2, + here.z + 0.5 + Math.random() * 0.4 - 0.2, + 2, + 0.0, + 0.05, + 0.0, + 0.0 + ) + successes++ + for (dir in Direction.values()) { + todo.add(here.relative(dir)) + } } } } - } } } 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 bce25a16..ec694637 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 @@ -35,8 +35,9 @@ object OpEdifySapling : SpellOperator { private data class Spell(val pos: BlockPos) : RenderedSpell { override fun cast(ctx: CastingContext) { val blockstate = ctx.world.getBlockState(pos) - if (!ctx.world.mayInteract(ctx.caster, pos) || - !IXplatAbstractions.INSTANCE.isBreakingAllowed(ctx.world, pos, blockstate, ctx.caster)) + if (!ctx.canEditBlockAt(pos) || + !IXplatAbstractions.INSTANCE.isBreakingAllowed(ctx.world, pos, blockstate, ctx.caster) + ) return val bs = ctx.world.getBlockState(pos) 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 8d664d3a..37efc873 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 @@ -30,7 +30,8 @@ class OpExplode(val fire: Boolean) : SpellOperator { private data class Spell(val pos: Vec3, val strength: Double, val fire: Boolean) : RenderedSpell { override fun cast(ctx: CastingContext) { - if (!ctx.world.mayInteract(ctx.caster, BlockPos(pos))) + // TODO: you can use this to explode things *outside* of the worldborder? + if (!ctx.canEditBlockAt(BlockPos(pos))) return ctx.world.explode( 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 d48ade8b..7810b976 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 @@ -50,11 +50,7 @@ object OpExtinguish : SpellOperator { ctx.caster.position().distanceToSqr(Vec3.atCenterOf(here)) val distFromTarget = target.distanceTo(Vec3.atCenterOf(here)) // max distance to prevent runaway shenanigans - if (distFromFocus < Operator.MAX_DISTANCE * Operator.MAX_DISTANCE && seen.add(here) && distFromTarget < 10 && ctx.world.mayInteract( - ctx.caster, - here - ) - ) { + if (ctx.canEditBlockAt(here) && distFromTarget < 10 && seen.add(here)) { // never seen this pos in my life val blockstate = ctx.world.getBlockState(here) if (IXplatAbstractions.INSTANCE.isBreakingAllowed(ctx.world, here, blockstate, ctx.caster)) { 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 0262b4c0..7cb59fe1 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 @@ -38,7 +38,13 @@ object OpIgnite : SpellOperator { // steal petra code that steals bucket code val maxwell = Items.FIRE_CHARGE - if (!ctx.world.mayInteract(ctx.caster, pos) || !IXplatAbstractions.INSTANCE.isPlacingAllowed(ctx.world, pos, ItemStack(maxwell), ctx.caster)) + if (!ctx.canEditBlockAt(pos) || !IXplatAbstractions.INSTANCE.isPlacingAllowed( + ctx.world, + pos, + ItemStack(maxwell), + ctx.caster + ) + ) return if (maxwell is FireChargeItem) { 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 74472103..e67e3e68 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 @@ -29,7 +29,8 @@ object OpPlaceBlock : SpellOperator { val pos = BlockPos(target) - if (!ctx.world.mayInteract(ctx.caster, pos)) + // TODO: does this even work?? why are we returning null?? what does that *do*? + if (!ctx.canEditBlockAt(pos)) return null @@ -54,7 +55,7 @@ object OpPlaceBlock : SpellOperator { override fun cast(ctx: CastingContext) { val pos = BlockPos(vec) - if (!ctx.world.mayInteract(ctx.caster, pos)) + if (!ctx.canEditBlockAt(pos)) return val blockHit = BlockHitResult( 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 4cd97986..b5c8a192 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 @@ -49,9 +49,16 @@ object OpBrainsweep : SpellOperator { ) } - private data class Spell(val pos: BlockPos, val state: BlockState, val sacrifice: Villager, val recipe: BrainsweepRecipe) : RenderedSpell { + private data class Spell( + val pos: BlockPos, + val state: BlockState, + val sacrifice: Villager, + val recipe: BrainsweepRecipe + ) : RenderedSpell { override fun cast(ctx: CastingContext) { - ctx.world.setBlockAndUpdate(pos, BrainsweepRecipe.copyProperties(state, recipe.result)) + if (ctx.canEditBlockAt(pos)) { + ctx.world.setBlockAndUpdate(pos, BrainsweepRecipe.copyProperties(state, recipe.result)) + } Brainsweeping.brainsweep(sacrifice) if (HexConfig.server().doVillagersTakeOffenseAtMindMurder()) { sacrifice.tellWitnessesThatIWasMurdered(ctx.caster) diff --git a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/spells/great/OpCreateLava.kt b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/spells/great/OpCreateLava.kt index 13ca6c01..1a819def 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/spells/great/OpCreateLava.kt +++ b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/spells/great/OpCreateLava.kt @@ -35,7 +35,13 @@ object OpCreateLava : SpellOperator { override fun cast(ctx: CastingContext) { val pos = BlockPos(target) - if (!ctx.world.mayInteract(ctx.caster, pos)|| !IXplatAbstractions.INSTANCE.isPlacingAllowed(ctx.world, pos, ItemStack(Items.LAVA_BUCKET), ctx.caster)) + if (!ctx.canEditBlockAt(pos) || !IXplatAbstractions.INSTANCE.isPlacingAllowed( + ctx.world, + pos, + ItemStack(Items.LAVA_BUCKET), + ctx.caster + ) + ) return val state = ctx.world.getBlockState(pos) From 4d95a57a174e4a4dd178c6d1afbb4a0525b0d6d1 Mon Sep 17 00:00:00 2001 From: gamma-delta <29877714+gamma-delta@users.noreply.github.com> Date: Tue, 26 Jul 2022 23:16:57 -0500 Subject: [PATCH 030/117] version bump and close #190 --- .../at/petrak/hexcasting/api/PatternRegistry.kt | 16 ++++++++-------- gradle.properties | 2 +- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/Common/src/main/java/at/petrak/hexcasting/api/PatternRegistry.kt b/Common/src/main/java/at/petrak/hexcasting/api/PatternRegistry.kt index a7deae5d..f15cab9b 100644 --- a/Common/src/main/java/at/petrak/hexcasting/api/PatternRegistry.kt +++ b/Common/src/main/java/at/petrak/hexcasting/api/PatternRegistry.kt @@ -81,14 +81,6 @@ object PatternRegistry { */ @JvmStatic fun matchPatternAndID(pat: HexPattern, overworld: ServerLevel): Pair { - // Pipeline: - // patterns are registered here every time the game boots - // when we try to look - for (handler in specialHandlers) { - val op = handler.handler.handlePattern(pat) - if (op != null) return op to handler.id - } - // Is it global? val sig = pat.anglesSignature() this.regularPatternLookup[sig]?.let { @@ -105,6 +97,14 @@ object PatternRegistry { return op to it.first } + // Lookup a special handler + // Do this last to prevent conflicts with great spells; this has happened a few times with + // create phial hahaha + for (handler in specialHandlers) { + val op = handler.handler.handlePattern(pat) + if (op != null) return op to handler.id + } + throw MishapInvalidPattern() } diff --git a/gradle.properties b/gradle.properties index a7c9bb1d..f4f31874 100644 --- a/gradle.properties +++ b/gradle.properties @@ -8,7 +8,7 @@ modName=Hex Casting minecraftVersion=1.18.2 kotlinVersion=1.6.21 -modVersion=0.9.1 +modVersion=0.9.2 paucalVersion=0.4.6 patchouliVersion=69 From e6767ae2242ae8ac4df98099df87017acd22ef4a Mon Sep 17 00:00:00 2001 From: gamma-delta <29877714+gamma-delta@users.noreply.github.com> Date: Wed, 27 Jul 2022 11:55:59 -0500 Subject: [PATCH 031/117] close #186 --- .../petrak/hexcasting/api/spell/SpellDatum.kt | 2 +- .../casting/operators/spells/OpBlink.kt | 12 ++---- .../operators/spells/great/OpTeleport.kt | 37 ++++++++++++++++--- .../hexcasting/common/lib/HexEntityTags.java | 15 ++++++++ .../assets/hexcasting/lang/en_us.json | 2 +- .../tags/entity_types/sticky_teleporters.json | 24 ++++++++++++ 6 files changed, 76 insertions(+), 16 deletions(-) create mode 100644 Common/src/main/java/at/petrak/hexcasting/common/lib/HexEntityTags.java create mode 100644 Common/src/main/resources/data/hexcasting/tags/entity_types/sticky_teleporters.json diff --git a/Common/src/main/java/at/petrak/hexcasting/api/spell/SpellDatum.kt b/Common/src/main/java/at/petrak/hexcasting/api/spell/SpellDatum.kt index ed56e42e..dba33627 100644 --- a/Common/src/main/java/at/petrak/hexcasting/api/spell/SpellDatum.kt +++ b/Common/src/main/java/at/petrak/hexcasting/api/spell/SpellDatum.kt @@ -225,7 +225,7 @@ class SpellDatum private constructor(val payload: T) { TAG_PATTERN -> { val pat = HexPattern.fromNBT(nbt.getCompound(TAG_PATTERN)) var angleDesc = pat.anglesSignature() - if (angleDesc.isNotBlank()) angleDesc = " $angleDesc"; + if (angleDesc.isNotBlank()) angleDesc = " $angleDesc" out += "HexPattern(".gold out += "${pat.startDir}$angleDesc".white out += ")".gold 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 81c072a6..d5e1e189 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,9 +5,7 @@ import at.petrak.hexcasting.api.spell.* import at.petrak.hexcasting.api.spell.casting.CastingContext import at.petrak.hexcasting.api.spell.mishaps.MishapImmuneEntity import at.petrak.hexcasting.api.spell.mishaps.MishapLocationTooFarAway -import at.petrak.hexcasting.common.network.MsgBlinkAck -import at.petrak.hexcasting.xplat.IXplatAbstractions -import net.minecraft.server.level.ServerPlayer +import at.petrak.hexcasting.common.casting.operators.spells.great.OpTeleport import net.minecraft.world.entity.Entity import kotlin.math.max import kotlin.math.roundToInt @@ -47,12 +45,8 @@ object OpBlink : SpellOperator { private data class Spell(val target: Entity, val delta: Double) : RenderedSpell { override fun cast(ctx: CastingContext) { - val dvec = target.lookAngle.scale(delta) - target.setPos(target.position().add(dvec)) - if (target is ServerPlayer) { - target.connection.resetPosition() - IXplatAbstractions.INSTANCE.sendPacketToPlayer(target, MsgBlinkAck(dvec)) - } + val delta = target.lookAngle.scale(delta) + OpTeleport.teleportRespectSticky(target, delta) } } } 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 c2dea123..27c7a42c 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 @@ -5,6 +5,7 @@ import at.petrak.hexcasting.api.spell.* import at.petrak.hexcasting.api.spell.casting.CastingContext 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.server.level.ServerPlayer @@ -43,12 +44,8 @@ object OpTeleport : SpellOperator { private data class Spell(val teleportee: Entity, val delta: Vec3) : RenderedSpell { override fun cast(ctx: CastingContext) { val distance = delta.length() - if (distance < 32768.0) { - teleportee.setPos(teleportee.position().add(delta)) - if (teleportee is ServerPlayer) { - IXplatAbstractions.INSTANCE.sendPacketToPlayer(teleportee, MsgBlinkAck(delta)) - } + OpTeleport.teleportRespectSticky(teleportee, delta) } if (teleportee is ServerPlayer && teleportee == ctx.caster) { @@ -79,6 +76,36 @@ object OpTeleport : SpellOperator { // we also don't drop the offhand just to be nice } } + } + fun teleportRespectSticky(teleportee: Entity, delta: Vec3) { + var stickyTeleport = false + // roll our own for loop + // this really would be more readable as a c-style for loop, waugh + var cursor = teleportee.vehicle + var base: Entity? = null + while (cursor != null) { + if (cursor.type.`is`(HexEntityTags.STICKY_TELEPORTERS)) + stickyTeleport = true + base = cursor + cursor = cursor.vehicle + } + + if (stickyTeleport) { + // this handles teleporting the passengers + val target = base!!.position().add(delta) + base.teleportTo(target.x, target.y, target.z) + } else { + // Break it into two stacks + teleportee.stopRiding() + teleportee.firstPassenger?.stopRiding() + teleportee.setPos(teleportee.position().add(delta)) + } + + teleportee.setPos(teleportee.position().add(delta)) + if (teleportee is ServerPlayer) { + teleportee.connection.resetPosition() + IXplatAbstractions.INSTANCE.sendPacketToPlayer(teleportee, MsgBlinkAck(delta)) + } } } 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 new file mode 100644 index 00000000..6e9656c0 --- /dev/null +++ b/Common/src/main/java/at/petrak/hexcasting/common/lib/HexEntityTags.java @@ -0,0 +1,15 @@ +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 TagKey> create(String name) { + return TagKey.create(Registry.ENTITY_TYPE_REGISTRY, modLoc(name)); + } +} 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 50cbab60..5bb728ae 100644 --- a/Common/src/main/resources/assets/hexcasting/lang/en_us.json +++ b/Common/src/main/resources/assets/hexcasting/lang/en_us.json @@ -964,7 +964,7 @@ "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.", + "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.", 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 new file mode 100644 index 00000000..95451c51 --- /dev/null +++ b/Common/src/main/resources/data/hexcasting/tags/entity_types/sticky_teleporters.json @@ -0,0 +1,24 @@ +{ + "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" + ] +} \ No newline at end of file From a5d25eba2ea8d8f86ff3f6215f8df802e7a2dc5e Mon Sep 17 00:00:00 2001 From: "yrsegal@gmail.com" Date: Wed, 27 Jul 2022 23:08:55 -0400 Subject: [PATCH 032/117] this just in: farmers may be delighted --- .../hexcasting/datagen/IXplatIngredients.java | 5 + .../datagen/recipe/HexplatRecipes.java | 32 ++++ .../builders/CompatProcessingOutput.java | 18 ++ .../builders/CreateCrushingRecipeBuilder.java | 39 ++--- .../FarmersDelightCuttingRecipeBuilder.java | 165 ++++++++++++++++++ .../recipe/builders/ItemProcessingOutput.java | 27 +++ .../recipe/builders/ProcessingOutput.java | 7 + .../recipe/builders/ToolIngredient.java | 7 + Fabric/src/generated/resources/.cache/cache | 4 + .../farmersdelight/cutting/akashic_door.json | 17 ++ .../farmersdelight/cutting/akashic_log.json | 21 +++ .../cutting/akashic_trapdoor.json | 17 ++ .../farmersdelight/cutting/akashic_wood.json | 21 +++ .../datagen/HexFabricDataGenerators.java | 19 ++ Forge/src/generated/resources/.cache/cache | 4 + .../farmersdelight/cutting/akashic_door.json | 17 ++ .../farmersdelight/cutting/akashic_log.json | 21 +++ .../cutting/akashic_trapdoor.json | 17 ++ .../farmersdelight/cutting/akashic_wood.json | 21 +++ .../forge/datagen/HexForgeDataGenerators.java | 23 +++ 20 files changed, 481 insertions(+), 21 deletions(-) create mode 100644 Common/src/main/java/at/petrak/hexcasting/datagen/recipe/builders/CompatProcessingOutput.java create mode 100644 Common/src/main/java/at/petrak/hexcasting/datagen/recipe/builders/FarmersDelightCuttingRecipeBuilder.java create mode 100644 Common/src/main/java/at/petrak/hexcasting/datagen/recipe/builders/ItemProcessingOutput.java create mode 100644 Common/src/main/java/at/petrak/hexcasting/datagen/recipe/builders/ProcessingOutput.java create mode 100644 Common/src/main/java/at/petrak/hexcasting/datagen/recipe/builders/ToolIngredient.java create mode 100644 Fabric/src/generated/resources/data/hexcasting/recipes/compat/farmersdelight/cutting/akashic_door.json create mode 100644 Fabric/src/generated/resources/data/hexcasting/recipes/compat/farmersdelight/cutting/akashic_log.json create mode 100644 Fabric/src/generated/resources/data/hexcasting/recipes/compat/farmersdelight/cutting/akashic_trapdoor.json create mode 100644 Fabric/src/generated/resources/data/hexcasting/recipes/compat/farmersdelight/cutting/akashic_wood.json create mode 100644 Forge/src/generated/resources/data/hexcasting/recipes/compat/farmersdelight/cutting/akashic_door.json create mode 100644 Forge/src/generated/resources/data/hexcasting/recipes/compat/farmersdelight/cutting/akashic_log.json create mode 100644 Forge/src/generated/resources/data/hexcasting/recipes/compat/farmersdelight/cutting/akashic_trapdoor.json create mode 100644 Forge/src/generated/resources/data/hexcasting/recipes/compat/farmersdelight/cutting/akashic_wood.json diff --git a/Common/src/main/java/at/petrak/hexcasting/datagen/IXplatIngredients.java b/Common/src/main/java/at/petrak/hexcasting/datagen/IXplatIngredients.java index adacc6bc..0f233b30 100644 --- a/Common/src/main/java/at/petrak/hexcasting/datagen/IXplatIngredients.java +++ b/Common/src/main/java/at/petrak/hexcasting/datagen/IXplatIngredients.java @@ -1,5 +1,6 @@ package at.petrak.hexcasting.datagen; +import at.petrak.hexcasting.datagen.recipe.builders.ToolIngredient; import net.minecraft.world.item.DyeColor; import net.minecraft.world.item.crafting.Ingredient; @@ -23,4 +24,8 @@ public interface IXplatIngredients { EnumMap dyes(); Ingredient stick(); + + ToolIngredient axeStrip(); + + ToolIngredient axeDig(); } 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 4afd5169..59321e00 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 @@ -14,6 +14,7 @@ import at.petrak.hexcasting.common.recipe.ingredient.VillagerIngredient; import at.petrak.hexcasting.datagen.IXplatIngredients; import at.petrak.hexcasting.datagen.recipe.builders.BrainsweepRecipeBuilder; 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; @@ -21,6 +22,7 @@ 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; @@ -384,6 +386,36 @@ public class HexplatRecipes extends PaucalRecipeProvider { .withOutput(HexItems.AMETHYST_DUST, 4) .withOutput(0.5f, HexItems.AMETHYST_DUST) .save(recipes, modLoc("compat/create/crushing/amethyst_shard")); + + // FD compat + + new FarmersDelightCuttingRecipeBuilder() + .withInput(HexBlocks.AKASHIC_LOG) + .withTool(ingredients.axeStrip()) + .withOutput(HexBlocks.AKASHIC_LOG_STRIPPED) + .withOutput("farmersdelight:tree_bark") + .withSound(SoundEvents.AXE_STRIP) + .save(recipes, modLoc("compat/farmersdelight/cutting/akashic_log")); + + new FarmersDelightCuttingRecipeBuilder() + .withInput(HexBlocks.AKASHIC_WOOD) + .withTool(ingredients.axeStrip()) + .withOutput(HexBlocks.AKASHIC_WOOD_STRIPPED) + .withOutput("farmersdelight:tree_bark") + .withSound(SoundEvents.AXE_STRIP) + .save(recipes, modLoc("compat/farmersdelight/cutting/akashic_wood")); + + new FarmersDelightCuttingRecipeBuilder() + .withInput(HexBlocks.AKASHIC_TRAPDOOR) + .withTool(ingredients.axeDig()) + .withOutput(HexBlocks.AKASHIC_PLANKS) + .save(recipes, modLoc("compat/farmersdelight/cutting/akashic_trapdoor")); + + new FarmersDelightCuttingRecipeBuilder() + .withInput(HexBlocks.AKASHIC_DOOR) + .withTool(ingredients.axeDig()) + .withOutput(HexBlocks.AKASHIC_PLANKS) + .save(recipes, modLoc("compat/farmersdelight/cutting/akashic_door")); } private void wandRecipe(Consumer recipes, ItemWand wand, Item plank) { diff --git a/Common/src/main/java/at/petrak/hexcasting/datagen/recipe/builders/CompatProcessingOutput.java b/Common/src/main/java/at/petrak/hexcasting/datagen/recipe/builders/CompatProcessingOutput.java new file mode 100644 index 00000000..443e63be --- /dev/null +++ b/Common/src/main/java/at/petrak/hexcasting/datagen/recipe/builders/CompatProcessingOutput.java @@ -0,0 +1,18 @@ +package at.petrak.hexcasting.datagen.recipe.builders; + +import com.google.gson.JsonObject; + +public record CompatProcessingOutput(String name, int count, float chance) implements ProcessingOutput { + @Override + public JsonObject serialize() { + JsonObject json = new JsonObject(); + json.addProperty("item", name); + if (count != 1) { + json.addProperty("count", count); + } + if (chance != 1) { + json.addProperty("chance", chance); + } + return json; + } +} diff --git a/Common/src/main/java/at/petrak/hexcasting/datagen/recipe/builders/CreateCrushingRecipeBuilder.java b/Common/src/main/java/at/petrak/hexcasting/datagen/recipe/builders/CreateCrushingRecipeBuilder.java index cefe261a..ecf933a7 100644 --- a/Common/src/main/java/at/petrak/hexcasting/datagen/recipe/builders/CreateCrushingRecipeBuilder.java +++ b/Common/src/main/java/at/petrak/hexcasting/datagen/recipe/builders/CreateCrushingRecipeBuilder.java @@ -2,9 +2,7 @@ package at.petrak.hexcasting.datagen.recipe.builders; import com.google.gson.JsonArray; import com.google.gson.JsonObject; -import com.google.gson.JsonParser; import net.minecraft.advancements.CriterionTriggerInstance; -import net.minecraft.core.Registry; import net.minecraft.data.recipes.FinishedRecipe; import net.minecraft.data.recipes.RecipeBuilder; import net.minecraft.resources.ResourceLocation; @@ -78,7 +76,24 @@ public abstract class CreateCrushingRecipeBuilder implements RecipeBuilder { } public CreateCrushingRecipeBuilder withOutput(ItemStack output, float chance) { - this.results.add(new ProcessingOutput(output, chance)); + this.results.add(new ItemProcessingOutput(output, chance)); + return this; + } + + public CreateCrushingRecipeBuilder withOutput(String name) { + return withOutput(1f, name, 1); + } + + public CreateCrushingRecipeBuilder withOutput(String name, int count) { + return withOutput(1f, name, count); + } + + public CreateCrushingRecipeBuilder withOutput(float chance, String name) { + return withOutput(chance, name, 1); + } + + public CreateCrushingRecipeBuilder withOutput(float chance, String name, int count) { + this.results.add(new CompatProcessingOutput(name, count, chance)); return this; } @@ -153,22 +168,4 @@ public abstract class CreateCrushingRecipeBuilder implements RecipeBuilder { } } - private record ProcessingOutput(ItemStack stack, float chance) { - private JsonObject serialize() { - JsonObject json = new JsonObject(); - ResourceLocation resourceLocation = Registry.ITEM.getKey(stack.getItem()); - json.addProperty("item", resourceLocation.toString()); - int count = stack.getCount(); - if (count != 1) { - json.addProperty("count", count); - } - if (stack.hasTag()) { - json.add("nbt", JsonParser.parseString(stack.getTag().toString())); - } - if (chance != 1) { - json.addProperty("chance", chance); - } - return json; - } - } } diff --git a/Common/src/main/java/at/petrak/hexcasting/datagen/recipe/builders/FarmersDelightCuttingRecipeBuilder.java b/Common/src/main/java/at/petrak/hexcasting/datagen/recipe/builders/FarmersDelightCuttingRecipeBuilder.java new file mode 100644 index 00000000..5efb614d --- /dev/null +++ b/Common/src/main/java/at/petrak/hexcasting/datagen/recipe/builders/FarmersDelightCuttingRecipeBuilder.java @@ -0,0 +1,165 @@ +package at.petrak.hexcasting.datagen.recipe.builders; + +import com.google.common.collect.Lists; +import com.google.gson.JsonArray; +import com.google.gson.JsonObject; +import net.minecraft.advancements.CriterionTriggerInstance; +import net.minecraft.core.Registry; +import net.minecraft.data.recipes.FinishedRecipe; +import net.minecraft.data.recipes.RecipeBuilder; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.sounds.SoundEvent; +import net.minecraft.world.item.Item; +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.level.ItemLike; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; + +import java.util.List; +import java.util.function.Consumer; + +public class FarmersDelightCuttingRecipeBuilder implements RecipeBuilder { + private String group = ""; + private final List outputs = Lists.newArrayList(); + private Ingredient input; + private ToolIngredient toolAction; + private SoundEvent sound; + + @Override + public FarmersDelightCuttingRecipeBuilder unlockedBy(String s, CriterionTriggerInstance criterionTriggerInstance) { + return this; + } + + @Override + public @NotNull FarmersDelightCuttingRecipeBuilder group(@Nullable String name) { + group = name; + return this; + } + + @Override + public Item getResult() { + return Items.AIR; // Irrelevant, we implement serialization ourselves + } + + public FarmersDelightCuttingRecipeBuilder withInput(ItemLike item) { + return withInput(Ingredient.of(item)); + } + + public FarmersDelightCuttingRecipeBuilder withInput(ItemStack stack) { + return withInput(Ingredient.of(stack)); + } + + public FarmersDelightCuttingRecipeBuilder withInput(Ingredient ingredient) { + this.input = ingredient; + return this; + } + + public FarmersDelightCuttingRecipeBuilder withOutput(ItemLike output) { + return withOutput(1f, output, 1); + } + + public FarmersDelightCuttingRecipeBuilder withOutput(float chance, ItemLike output) { + return withOutput(chance, output, 1); + } + + public FarmersDelightCuttingRecipeBuilder withOutput(ItemLike output, int count) { + return withOutput(1f, output, count); + } + + public FarmersDelightCuttingRecipeBuilder withOutput(float chance, ItemLike output, int count) { + return withOutput(new ItemStack(output, count), chance); + } + + public FarmersDelightCuttingRecipeBuilder withOutput(ItemStack output, float chance) { + this.outputs.add(new ItemProcessingOutput(output, chance)); + return this; + } + + public FarmersDelightCuttingRecipeBuilder withOutput(String name) { + return withOutput(1f, name, 1); + } + + public FarmersDelightCuttingRecipeBuilder withOutput(String name, int count) { + return withOutput(1f, name, count); + } + + public FarmersDelightCuttingRecipeBuilder withOutput(float chance, String name) { + return withOutput(chance, name, 1); + } + + public FarmersDelightCuttingRecipeBuilder withOutput(float chance, String name, int count) { + this.outputs.add(new CompatProcessingOutput(name, count, chance)); + return this; + } + + public FarmersDelightCuttingRecipeBuilder withTool(ToolIngredient ingredient) { + this.toolAction = ingredient; + return this; + } + + public FarmersDelightCuttingRecipeBuilder withSound(SoundEvent sound) { + this.sound = sound; + return this; + } + + @Override + public void save(Consumer consumer, ResourceLocation resourceLocation) { + consumer.accept(new CuttingRecipe(resourceLocation)); + } + + public class CuttingRecipe implements FinishedRecipe { + + private final ResourceLocation id; + + public CuttingRecipe(ResourceLocation id) { + this.id = id; + } + + @Override + public void serializeRecipeData(@NotNull JsonObject json) { + json.addProperty("type", "farmersdelight:cutting"); + + if (!group.isEmpty()) { + json.addProperty("group", group); + } + + JsonArray jsonIngredients = new JsonArray(); + JsonArray jsonOutputs = new JsonArray(); + + jsonIngredients.add(input.toJson()); + + outputs.forEach(o -> jsonOutputs.add(o.serialize())); + + json.add("ingredients", jsonIngredients); + json.add("tool", toolAction.serialize()); + json.add("result", jsonOutputs); + + if (sound != null) { + json.addProperty("sound", Registry.SOUND_EVENT.getKey(sound).toString()); + } + } + + @Override + public @NotNull ResourceLocation getId() { + return id; + } + + @Override + public @NotNull RecipeSerializer getType() { + return RecipeSerializer.SHAPELESS_RECIPE; // Irrelevant, we implement serialization ourselves + } + + @Override + public JsonObject serializeAdvancement() { + return null; + } + + @Override + public ResourceLocation getAdvancementId() { + return null; + } + } +} diff --git a/Common/src/main/java/at/petrak/hexcasting/datagen/recipe/builders/ItemProcessingOutput.java b/Common/src/main/java/at/petrak/hexcasting/datagen/recipe/builders/ItemProcessingOutput.java new file mode 100644 index 00000000..9e799a07 --- /dev/null +++ b/Common/src/main/java/at/petrak/hexcasting/datagen/recipe/builders/ItemProcessingOutput.java @@ -0,0 +1,27 @@ +package at.petrak.hexcasting.datagen.recipe.builders; + +import com.google.gson.JsonObject; +import com.google.gson.JsonParser; +import net.minecraft.core.Registry; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.world.item.ItemStack; + +public record ItemProcessingOutput(ItemStack stack, float chance) implements ProcessingOutput { + @Override + public JsonObject serialize() { + JsonObject json = new JsonObject(); + ResourceLocation resourceLocation = Registry.ITEM.getKey(stack.getItem()); + json.addProperty("item", resourceLocation.toString()); + int count = stack.getCount(); + if (count != 1) { + json.addProperty("count", count); + } + if (stack.hasTag()) { + json.add("nbt", JsonParser.parseString(stack.getTag().toString())); + } + if (chance != 1) { + json.addProperty("chance", chance); + } + return json; + } +} diff --git a/Common/src/main/java/at/petrak/hexcasting/datagen/recipe/builders/ProcessingOutput.java b/Common/src/main/java/at/petrak/hexcasting/datagen/recipe/builders/ProcessingOutput.java new file mode 100644 index 00000000..f25cf0e1 --- /dev/null +++ b/Common/src/main/java/at/petrak/hexcasting/datagen/recipe/builders/ProcessingOutput.java @@ -0,0 +1,7 @@ +package at.petrak.hexcasting.datagen.recipe.builders; + +import com.google.gson.JsonObject; + +public interface ProcessingOutput { + JsonObject serialize(); +} diff --git a/Common/src/main/java/at/petrak/hexcasting/datagen/recipe/builders/ToolIngredient.java b/Common/src/main/java/at/petrak/hexcasting/datagen/recipe/builders/ToolIngredient.java new file mode 100644 index 00000000..a9f5b5ee --- /dev/null +++ b/Common/src/main/java/at/petrak/hexcasting/datagen/recipe/builders/ToolIngredient.java @@ -0,0 +1,7 @@ +package at.petrak.hexcasting.datagen.recipe.builders; + +import com.google.gson.JsonObject; + +public interface ToolIngredient { + JsonObject serialize(); +} diff --git a/Fabric/src/generated/resources/.cache/cache b/Fabric/src/generated/resources/.cache/cache index e872333c..2aafde8b 100644 --- a/Fabric/src/generated/resources/.cache/cache +++ b/Fabric/src/generated/resources/.cache/cache @@ -62,6 +62,7 @@ ad85e0162a7c68d431fd700700906ccbcadf91ce data/hexcasting/recipes/compat/create/c c11dc4388c18dadff5d93126eb0f7ae848d627b9 data/hexcasting/advancements/recipes/brainsweep/brainsweep/directrix_redstone.json 5f3e3813757d8300acad523d45ac7c4d85728399 data/minecraft/tags/items/buttons.json 4066f098ef104eadf6729bb372d9e643c598b477 data/hexcasting/advancements/recipes/hexcasting.creative_tab/akashic_wood_stripped.json +42a8f3ea310d25760b3374c7b7338f445d51a005 data/hexcasting/recipes/compat/farmersdelight/cutting/akashic_door.json 310e2440f26f130c81d32d9fcd93a3384c2b1e72 data/hexcasting/advancements/recipes/hexcasting.creative_tab/dye_colorizer_brown.json 5f3e3813757d8300acad523d45ac7c4d85728399 data/minecraft/tags/blocks/buttons.json 30950c6dd31102cf145f8f7d2979df0736a7ba1e data/hexcasting/advancements/recipes/hexcasting.creative_tab/wand_oak.json @@ -159,6 +160,7 @@ a84bf48a188d7b250db5c971a6d9b63d82279ba3 data/hexcasting/recipes/akashic_wood.js 3f9756b2c5137b285c4faa88ab43c4996b6b2bb6 data/hexcasting/recipes/ancient_scroll_paper_lantern.json c375ba3f7105d6f57ef982f6f4e9326ad88a947d data/hexcasting/loot_tables/blocks/ancient_scroll_paper_lantern.json b596d96eebb4f7bad5930f4eebc589f292b59c98 data/hexcasting/tags/blocks/akashic_planks.json +e60c478db2f8552e8c1e9ee5d361658dd8eafaa4 data/hexcasting/recipes/compat/farmersdelight/cutting/akashic_wood.json a27a2514fd3acb6cf0a4f2a6b176ca4c2a3ee064 data/hexcasting/advancements/recipes/hexcasting.creative_tab/dye_colorizer_cyan.json 1d19457c9843d97d2ed59199d9077940d9e5e46a data/hexcasting/recipes/akashic_button.json b596d96eebb4f7bad5930f4eebc589f292b59c98 data/minecraft/tags/blocks/planks.json @@ -238,6 +240,7 @@ db8a00478e1c4b0f9b143b5946d1ba25e489591d data/hexcasting/recipes/dynamic/seal_fo 076dd8bb2ce1508293384fa93fa138a369d10751 data/hexcasting/advancements/recipes/hexcasting.creative_tab/dye_colorizer_green.json 3147422bed290cb47ea3763dbdc6f0e96eed5c2a data/hexcasting/loot_tables/inject/scroll_loot_few.json aab3082b3303f358cc265fb10bc9bbe08c96eef0 data/hexcasting/recipes/trinket.json +c15a0780a2cd9c92dad948479049ab8495a33635 data/hexcasting/recipes/compat/farmersdelight/cutting/akashic_trapdoor.json c3aed1dbaa46e084711a116d1bb4522df9a7405a data/hexcasting/advancements/recipes/hexcasting.creative_tab/dye_colorizer_light_blue.json 3a376402af89128dc37adaa0a72b6de66d58309d data/hexcasting/recipes/dynamic/seal_spellbook.json 2ec90cd941acad6eabfb38d21466ef8e9b9bf2c1 data/hexcasting/recipes/wand_jungle.json @@ -250,6 +253,7 @@ f3c6b6917e504e1c3d5d8875f7cce6f311e791d2 data/hexcasting/tags/items/akashic_logs c64f5e56ca18eb68d2e58827920ca0e3ae4617ca data/hexcasting/recipes/dye_colorizer_blue.json 5f3e3813757d8300acad523d45ac7c4d85728399 data/minecraft/tags/blocks/wooden_buttons.json e125117befadda0785e370969a8e04eff070d057 data/hexcasting/loot_tables/blocks/amethyst_sconce.json +37461a314331d79691c48cd13b6540260021cba4 data/hexcasting/recipes/compat/farmersdelight/cutting/akashic_log.json 4da41a82a17f58c9342944f214e745696c1d8ed7 data/hexcasting/loot_tables/blocks/impetus_storedplayer.json 67d4c536be3762833a4af33cd7cdfc68eb4ad629 data/hexcasting/advancements/recipes/hexcasting.creative_tab/wand_dark_oak.json 22ad2496732633bb5539a1fa761051d7add48055 data/hexcasting/advancements/recipes/hexcasting.creative_tab/slate.json diff --git a/Fabric/src/generated/resources/data/hexcasting/recipes/compat/farmersdelight/cutting/akashic_door.json b/Fabric/src/generated/resources/data/hexcasting/recipes/compat/farmersdelight/cutting/akashic_door.json new file mode 100644 index 00000000..4f66808a --- /dev/null +++ b/Fabric/src/generated/resources/data/hexcasting/recipes/compat/farmersdelight/cutting/akashic_door.json @@ -0,0 +1,17 @@ +{ + "type": "farmersdelight:cutting", + "ingredients": [ + { + "item": "hexcasting:akashic_door" + } + ], + "tool": { + "type": "farmersdelight:tool", + "tag": "fabric:tools/axes" + }, + "result": [ + { + "item": "hexcasting:akashic_planks" + } + ] +} \ No newline at end of file diff --git a/Fabric/src/generated/resources/data/hexcasting/recipes/compat/farmersdelight/cutting/akashic_log.json b/Fabric/src/generated/resources/data/hexcasting/recipes/compat/farmersdelight/cutting/akashic_log.json new file mode 100644 index 00000000..cae5afbf --- /dev/null +++ b/Fabric/src/generated/resources/data/hexcasting/recipes/compat/farmersdelight/cutting/akashic_log.json @@ -0,0 +1,21 @@ +{ + "type": "farmersdelight:cutting", + "ingredients": [ + { + "item": "hexcasting:akashic_log" + } + ], + "tool": { + "type": "farmersdelight:tool", + "tag": "fabric:tools/axes" + }, + "result": [ + { + "item": "hexcasting:akashic_log_stripped" + }, + { + "item": "farmersdelight:tree_bark" + } + ], + "sound": "minecraft:item.axe.strip" +} \ No newline at end of file diff --git a/Fabric/src/generated/resources/data/hexcasting/recipes/compat/farmersdelight/cutting/akashic_trapdoor.json b/Fabric/src/generated/resources/data/hexcasting/recipes/compat/farmersdelight/cutting/akashic_trapdoor.json new file mode 100644 index 00000000..96dd858d --- /dev/null +++ b/Fabric/src/generated/resources/data/hexcasting/recipes/compat/farmersdelight/cutting/akashic_trapdoor.json @@ -0,0 +1,17 @@ +{ + "type": "farmersdelight:cutting", + "ingredients": [ + { + "item": "hexcasting:akashic_trapdoor" + } + ], + "tool": { + "type": "farmersdelight:tool", + "tag": "fabric:tools/axes" + }, + "result": [ + { + "item": "hexcasting:akashic_planks" + } + ] +} \ No newline at end of file diff --git a/Fabric/src/generated/resources/data/hexcasting/recipes/compat/farmersdelight/cutting/akashic_wood.json b/Fabric/src/generated/resources/data/hexcasting/recipes/compat/farmersdelight/cutting/akashic_wood.json new file mode 100644 index 00000000..6e293322 --- /dev/null +++ b/Fabric/src/generated/resources/data/hexcasting/recipes/compat/farmersdelight/cutting/akashic_wood.json @@ -0,0 +1,21 @@ +{ + "type": "farmersdelight:cutting", + "ingredients": [ + { + "item": "hexcasting:akashic_wood" + } + ], + "tool": { + "type": "farmersdelight:tool", + "tag": "fabric:tools/axes" + }, + "result": [ + { + "item": "hexcasting:akashic_wood_stripped" + }, + { + "item": "farmersdelight:tree_bark" + } + ], + "sound": "minecraft:item.axe.strip" +} \ 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 84dfa5bc..343f34b6 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 @@ -6,8 +6,10 @@ 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.ToolIngredient; import at.petrak.hexcasting.fabric.datagen.builders.FabricCreateCrushingRecipeBuilder; import at.petrak.hexcasting.xplat.IXplatAbstractions; +import com.google.gson.JsonObject; import net.fabricmc.fabric.api.datagen.v1.DataGeneratorEntrypoint; import net.fabricmc.fabric.api.datagen.v1.FabricDataGenerator; import net.minecraft.core.Registry; @@ -113,6 +115,23 @@ public class HexFabricDataGenerators implements DataGeneratorEntrypoint { new Ingredient.TagValue(tag("wood_sticks")) )); } + + private final ToolIngredient AXE_INGREDIENT = () -> { + JsonObject object = new JsonObject(); + object.addProperty("type", "farmersdelight:tool"); + object.addProperty("tag", "fabric:tools/axes"); + return object; + }; + + @Override + public ToolIngredient axeStrip() { + return AXE_INGREDIENT; + } + + @Override + public ToolIngredient axeDig() { + return AXE_INGREDIENT; + } }; private static TagKey tag(String s) { diff --git a/Forge/src/generated/resources/.cache/cache b/Forge/src/generated/resources/.cache/cache index f112b1d8..17ee2a24 100644 --- a/Forge/src/generated/resources/.cache/cache +++ b/Forge/src/generated/resources/.cache/cache @@ -157,6 +157,10 @@ d7f85ce9d46aacc7ec89dc7aa0f88a331ccfbae7 data/hexcasting/recipes/brainsweep/akas ab5d271371323d93ff6eed18179ee4f7fd8c939c data/hexcasting/recipes/brainsweep/impetus_rightclick.json d5c6f9a31a8310ec440fc8c14da8988f0d166586 data/hexcasting/recipes/brainsweep/impetus_storedplayer.json ad85e0162a7c68d431fd700700906ccbcadf91ce data/hexcasting/recipes/compat/create/crushing/amethyst_shard.json +27665eed65acfdb692027afe52588b30cec085ea data/hexcasting/recipes/compat/farmersdelight/cutting/akashic_door.json +1ed27f68186cb70984eeeae13365fc3c3149ebc3 data/hexcasting/recipes/compat/farmersdelight/cutting/akashic_log.json +4c842bb202b181cc861544a08a4ad53f399aaa30 data/hexcasting/recipes/compat/farmersdelight/cutting/akashic_trapdoor.json +e339675f24dd528d429a1386666d69fc8f23c426 data/hexcasting/recipes/compat/farmersdelight/cutting/akashic_wood.json bc140b6c5d999b4bc5d12c302297f56bde3b161c data/hexcasting/recipes/cypher.json 8c22db477365a800ce1e715aeaad896550467047 data/hexcasting/recipes/dye_colorizer_black.json c64f5e56ca18eb68d2e58827920ca0e3ae4617ca data/hexcasting/recipes/dye_colorizer_blue.json diff --git a/Forge/src/generated/resources/data/hexcasting/recipes/compat/farmersdelight/cutting/akashic_door.json b/Forge/src/generated/resources/data/hexcasting/recipes/compat/farmersdelight/cutting/akashic_door.json new file mode 100644 index 00000000..296c6338 --- /dev/null +++ b/Forge/src/generated/resources/data/hexcasting/recipes/compat/farmersdelight/cutting/akashic_door.json @@ -0,0 +1,17 @@ +{ + "type": "farmersdelight:cutting", + "ingredients": [ + { + "item": "hexcasting:akashic_door" + } + ], + "tool": { + "type": "farmersdelight:tool_action", + "action": "axe_dig" + }, + "result": [ + { + "item": "hexcasting:akashic_planks" + } + ] +} \ No newline at end of file diff --git a/Forge/src/generated/resources/data/hexcasting/recipes/compat/farmersdelight/cutting/akashic_log.json b/Forge/src/generated/resources/data/hexcasting/recipes/compat/farmersdelight/cutting/akashic_log.json new file mode 100644 index 00000000..eb1a75d3 --- /dev/null +++ b/Forge/src/generated/resources/data/hexcasting/recipes/compat/farmersdelight/cutting/akashic_log.json @@ -0,0 +1,21 @@ +{ + "type": "farmersdelight:cutting", + "ingredients": [ + { + "item": "hexcasting:akashic_log" + } + ], + "tool": { + "type": "farmersdelight:tool_action", + "action": "axe_strip" + }, + "result": [ + { + "item": "hexcasting:akashic_log_stripped" + }, + { + "item": "farmersdelight:tree_bark" + } + ], + "sound": "minecraft:item.axe.strip" +} \ No newline at end of file diff --git a/Forge/src/generated/resources/data/hexcasting/recipes/compat/farmersdelight/cutting/akashic_trapdoor.json b/Forge/src/generated/resources/data/hexcasting/recipes/compat/farmersdelight/cutting/akashic_trapdoor.json new file mode 100644 index 00000000..86da1e84 --- /dev/null +++ b/Forge/src/generated/resources/data/hexcasting/recipes/compat/farmersdelight/cutting/akashic_trapdoor.json @@ -0,0 +1,17 @@ +{ + "type": "farmersdelight:cutting", + "ingredients": [ + { + "item": "hexcasting:akashic_trapdoor" + } + ], + "tool": { + "type": "farmersdelight:tool_action", + "action": "axe_dig" + }, + "result": [ + { + "item": "hexcasting:akashic_planks" + } + ] +} \ No newline at end of file diff --git a/Forge/src/generated/resources/data/hexcasting/recipes/compat/farmersdelight/cutting/akashic_wood.json b/Forge/src/generated/resources/data/hexcasting/recipes/compat/farmersdelight/cutting/akashic_wood.json new file mode 100644 index 00000000..ce7beb5c --- /dev/null +++ b/Forge/src/generated/resources/data/hexcasting/recipes/compat/farmersdelight/cutting/akashic_wood.json @@ -0,0 +1,21 @@ +{ + "type": "farmersdelight:cutting", + "ingredients": [ + { + "item": "hexcasting:akashic_wood" + } + ], + "tool": { + "type": "farmersdelight:tool_action", + "action": "axe_strip" + }, + "result": [ + { + "item": "hexcasting:akashic_wood_stripped" + }, + { + "item": "farmersdelight:tree_bark" + } + ], + "sound": "minecraft:item.axe.strip" +} \ No newline at end of file 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 8dcc2e1d..b0de4f11 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 @@ -3,11 +3,13 @@ package at.petrak.hexcasting.forge.datagen; import at.petrak.hexcasting.api.HexAPI; import at.petrak.hexcasting.datagen.*; import at.petrak.hexcasting.datagen.recipe.HexplatRecipes; +import at.petrak.hexcasting.datagen.recipe.builders.ToolIngredient; import at.petrak.hexcasting.forge.datagen.builders.ForgeCreateCrushingRecipeBuilder; import at.petrak.hexcasting.forge.datagen.xplat.HexBlockStatesAndModels; import at.petrak.hexcasting.forge.datagen.xplat.HexItemModels; import at.petrak.hexcasting.xplat.IXplatAbstractions; import at.petrak.paucal.api.forge.datagen.PaucalForgeDatagenWrappers; +import com.google.gson.JsonObject; import net.minecraft.data.DataGenerator; import net.minecraft.resources.ResourceLocation; import net.minecraft.tags.ItemTags; @@ -16,6 +18,7 @@ import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.Items; import net.minecraft.world.item.crafting.Ingredient; import net.minecraftforge.common.Tags; +import net.minecraftforge.common.ToolActions; import net.minecraftforge.common.data.ExistingFileHelper; import net.minecraftforge.eventbus.api.SubscribeEvent; import net.minecraftforge.forge.event.lifecycle.GatherDataEvent; @@ -119,5 +122,25 @@ public class HexForgeDataGenerators { new Ingredient.TagValue(ItemTags.create(new ResourceLocation("forge", "rods/wooden"))) )); } + + @Override + public ToolIngredient axeStrip() { + return () -> { + JsonObject object = new JsonObject(); + object.addProperty("type", "farmersdelight:tool_action"); + object.addProperty("action", ToolActions.AXE_STRIP.name()); + return object; + }; + } + + @Override + public ToolIngredient axeDig() { + return () -> { + JsonObject object = new JsonObject(); + object.addProperty("type", "farmersdelight:tool_action"); + object.addProperty("action", ToolActions.AXE_DIG.name()); + return object; + }; + } }; } From 4ceb5416fbe4d15cf3979d1a532a0ed322bed584 Mon Sep 17 00:00:00 2001 From: "yrsegal@gmail.com" Date: Sun, 31 Jul 2022 09:15:59 -0400 Subject: [PATCH 033/117] fix inconsistencies with teleport updating --- .../casting/operators/spells/great/OpTeleport.kt | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 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 27c7a42c..868e8ac2 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 @@ -91,21 +91,29 @@ object OpTeleport : SpellOperator { cursor = cursor.vehicle } + val playersToUpdate = mutableListOf() + if (stickyTeleport) { // this handles teleporting the passengers val target = base!!.position().add(delta) base.teleportTo(target.x, target.y, target.z) + base.indirectPassengers + .filterIsInstance() + .forEach(playersToUpdate::add) } else { // Break it into two stacks teleportee.stopRiding() - teleportee.firstPassenger?.stopRiding() + teleportee.passengers.forEach(Entity::stopRiding) teleportee.setPos(teleportee.position().add(delta)) + if (teleportee is ServerPlayer) { + playersToUpdate.add(teleportee) + } } teleportee.setPos(teleportee.position().add(delta)) - if (teleportee is ServerPlayer) { - teleportee.connection.resetPosition() - IXplatAbstractions.INSTANCE.sendPacketToPlayer(teleportee, MsgBlinkAck(delta)) + for (player in playersToUpdate) { + player.connection.resetPosition() + IXplatAbstractions.INSTANCE.sendPacketToPlayer(player, MsgBlinkAck(delta)) } } } From 513037bb1a568f54aba724d32465121454471471 Mon Sep 17 00:00:00 2001 From: "yrsegal@gmail.com" Date: Sun, 31 Jul 2022 09:21:00 -0400 Subject: [PATCH 034/117] fix double-tp --- .../common/casting/operators/spells/great/OpTeleport.kt | 1 - 1 file changed, 1 deletion(-) 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 868e8ac2..458d23e4 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 @@ -110,7 +110,6 @@ object OpTeleport : SpellOperator { } } - teleportee.setPos(teleportee.position().add(delta)) for (player in playersToUpdate) { player.connection.resetPosition() IXplatAbstractions.INSTANCE.sendPacketToPlayer(player, MsgBlinkAck(delta)) From b34d676afb7b68dfb35833b3d9218671587baefd Mon Sep 17 00:00:00 2001 From: "yrsegal@gmail.com" Date: Tue, 2 Aug 2022 18:58:53 -0400 Subject: [PATCH 035/117] fix #206 --- .../en_us/entries/patterns/great_spells/greater_sentinel.json | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) 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 7084b7c1..f855cd80 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 @@ -9,7 +9,9 @@ { "type": "hexcasting:pattern", "op_id": "hexcasting:sentinel/create/great", - "text": "hexcasting.page.greater_sentinel.1" + "text": "hexcasting.page.greater_sentinel.1", + "input": "vector", + "output": "" }, { "type": "patchouli:text", From bd833486b6603116466674242ecbdd7d7c31e365 Mon Sep 17 00:00:00 2001 From: "yrsegal@gmail.com" Date: Sat, 6 Aug 2022 09:38:33 -0400 Subject: [PATCH 036/117] skilletsexual --- .../datagen/IXplatConditionsBuilder.java | 9 + .../hexcasting/datagen/IXplatIngredients.java | 2 + ...{HexplatRecipes.java => HexplatRecipes.kt} | 386 ++++++++++-------- .../builders/CompatIngredientValue.java | 33 ++ .../builders/CreateCrushingRecipeBuilder.java | 10 +- .../src/main/resources/hexplat.accesswidener | 2 + Fabric/gradle.properties | 2 +- Fabric/src/generated/resources/.cache/cache | 16 +- .../recipes/crushing/amethyst_block.json | 10 +- .../recipes/crushing/amethyst_cluster.json | 10 +- .../create/crushing/amethyst_shard.json | 10 +- .../farmersdelight/cutting/akashic_door.json | 8 + .../farmersdelight/cutting/akashic_log.json | 10 +- .../cutting/akashic_trapdoor.json | 8 + .../farmersdelight/cutting/akashic_wood.json | 10 +- .../recipes/pride_colorizer_pansexual.json | 9 +- .../hexcasting/fabric/FabricHexInitializer.kt | 5 +- .../datagen/HexFabricConditionsBuilder.java | 96 +++++ .../datagen/HexFabricDataGenerators.java | 9 +- .../FabricCreateCrushingRecipeBuilder.java | 37 -- .../FabricModConditionalIngredient.java | 105 +++++ .../recipe/FabricUnsealedIngredient.java | 3 +- .../main/resources/fabricasting.accesswidener | 1 + Forge/src/generated/resources/.cache/cache | 16 +- .../recipes/crushing/amethyst_block.json | 45 +- .../recipes/crushing/amethyst_cluster.json | 51 ++- .../create/crushing/amethyst_shard.json | 43 +- .../farmersdelight/cutting/akashic_door.json | 37 +- .../farmersdelight/cutting/akashic_log.json | 47 ++- .../cutting/akashic_trapdoor.json | 37 +- .../farmersdelight/cutting/akashic_wood.json | 47 ++- .../recipes/pride_colorizer_pansexual.json | 9 +- .../hexcasting/forge/ForgeHexInitializer.java | 6 +- .../datagen/HexForgeConditionsBuilder.java | 63 +++ .../forge/datagen/HexForgeDataGenerators.java | 11 +- .../ForgeCreateCrushingRecipeBuilder.java | 40 -- .../recipe/ForgeModConditionalIngredient.java | 105 +++++ .../forge/recipe/ForgeUnsealedIngredient.java | 5 + .../resources/META-INF/accesstransformer.cfg | 2 + 39 files changed, 952 insertions(+), 403 deletions(-) create mode 100644 Common/src/main/java/at/petrak/hexcasting/datagen/IXplatConditionsBuilder.java rename Common/src/main/java/at/petrak/hexcasting/datagen/recipe/{HexplatRecipes.java => HexplatRecipes.kt} (65%) create mode 100644 Common/src/main/java/at/petrak/hexcasting/datagen/recipe/builders/CompatIngredientValue.java create mode 100644 Fabric/src/main/java/at/petrak/hexcasting/fabric/datagen/HexFabricConditionsBuilder.java delete mode 100644 Fabric/src/main/java/at/petrak/hexcasting/fabric/datagen/builders/FabricCreateCrushingRecipeBuilder.java create mode 100644 Fabric/src/main/java/at/petrak/hexcasting/fabric/recipe/FabricModConditionalIngredient.java create mode 100644 Forge/src/main/java/at/petrak/hexcasting/forge/datagen/HexForgeConditionsBuilder.java delete mode 100644 Forge/src/main/java/at/petrak/hexcasting/forge/datagen/builders/ForgeCreateCrushingRecipeBuilder.java create mode 100644 Forge/src/main/java/at/petrak/hexcasting/forge/recipe/ForgeModConditionalIngredient.java diff --git a/Common/src/main/java/at/petrak/hexcasting/datagen/IXplatConditionsBuilder.java b/Common/src/main/java/at/petrak/hexcasting/datagen/IXplatConditionsBuilder.java new file mode 100644 index 00000000..d283711f --- /dev/null +++ b/Common/src/main/java/at/petrak/hexcasting/datagen/IXplatConditionsBuilder.java @@ -0,0 +1,9 @@ +package at.petrak.hexcasting.datagen; + +import net.minecraft.data.recipes.RecipeBuilder; + +public interface IXplatConditionsBuilder extends RecipeBuilder { + IXplatConditionsBuilder whenModLoaded(String modid); + + IXplatConditionsBuilder whenModMissing(String modid); +} diff --git a/Common/src/main/java/at/petrak/hexcasting/datagen/IXplatIngredients.java b/Common/src/main/java/at/petrak/hexcasting/datagen/IXplatIngredients.java index 0f233b30..274de8b9 100644 --- a/Common/src/main/java/at/petrak/hexcasting/datagen/IXplatIngredients.java +++ b/Common/src/main/java/at/petrak/hexcasting/datagen/IXplatIngredients.java @@ -25,6 +25,8 @@ public interface IXplatIngredients { Ingredient stick(); + Ingredient whenModIngredient(Ingredient defaultIngredient, String modid, Ingredient modIngredient); + ToolIngredient axeStrip(); ToolIngredient axeDig(); 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.kt similarity index 65% rename from Common/src/main/java/at/petrak/hexcasting/datagen/recipe/HexplatRecipes.java rename to Common/src/main/java/at/petrak/hexcasting/datagen/recipe/HexplatRecipes.kt index 59321e00..3a23a697 100644 --- a/Common/src/main/java/at/petrak/hexcasting/datagen/recipe/HexplatRecipes.java +++ b/Common/src/main/java/at/petrak/hexcasting/datagen/recipe/HexplatRecipes.kt @@ -1,71 +1,66 @@ -package at.petrak.hexcasting.datagen.recipe; +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.common.items.ItemWand; -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.VillagerIngredient; -import at.petrak.hexcasting.datagen.IXplatIngredients; -import at.petrak.hexcasting.datagen.recipe.builders.BrainsweepRecipeBuilder; -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 at.petrak.hexcasting.api.HexAPI +import at.petrak.hexcasting.api.advancements.OvercastTrigger +import at.petrak.hexcasting.api.mod.HexItemTags +import at.petrak.hexcasting.common.items.ItemWand +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.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 -import java.util.function.Consumer; -import java.util.function.Supplier; +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) -public class HexplatRecipes extends PaucalRecipeProvider { - public DataGenerator generator; - public IXplatIngredients ingredients; - public Supplier createCrushing; + wandRecipe(recipes, HexItems.WAND_OAK, Items.OAK_PLANKS) + wandRecipe(recipes, HexItems.WAND_BIRCH, Items.BIRCH_PLANKS) + wandRecipe(recipes, HexItems.WAND_SPRUCE, Items.SPRUCE_PLANKS) + wandRecipe(recipes, HexItems.WAND_JUNGLE, Items.JUNGLE_PLANKS) + wandRecipe(recipes, HexItems.WAND_DARK_OAK, Items.DARK_OAK_PLANKS) + wandRecipe(recipes, HexItems.WAND_ACACIA, Items.ACACIA_PLANKS) + wandRecipe(recipes, HexItems.WAND_CRIMSON, Items.CRIMSON_PLANKS) + wandRecipe(recipes, HexItems.WAND_WARPED, Items.WARPED_PLANKS) + wandRecipe(recipes, HexItems.WAND_AKASHIC, HexBlocks.AKASHIC_PLANKS.asItem()) - public HexplatRecipes(DataGenerator pGenerator, IXplatIngredients ingredients, Supplier createCrushing) { - super(pGenerator, HexAPI.MOD_ID); - this.generator = pGenerator; - this.ingredients = ingredients; - this.createCrushing = createCrushing; - } - - protected void makeRecipes(Consumer recipes) { - specialRecipe(recipes, SealFocusRecipe.SERIALIZER); - specialRecipe(recipes, SealSpellbookRecipe.SERIALIZER); - - wandRecipe(recipes, HexItems.WAND_OAK, Items.OAK_PLANKS); - wandRecipe(recipes, HexItems.WAND_BIRCH, Items.BIRCH_PLANKS); - wandRecipe(recipes, HexItems.WAND_SPRUCE, Items.SPRUCE_PLANKS); - wandRecipe(recipes, HexItems.WAND_JUNGLE, Items.JUNGLE_PLANKS); - wandRecipe(recipes, HexItems.WAND_DARK_OAK, Items.DARK_OAK_PLANKS); - wandRecipe(recipes, HexItems.WAND_ACACIA, Items.ACACIA_PLANKS); - wandRecipe(recipes, HexItems.WAND_CRIMSON, Items.CRIMSON_PLANKS); - wandRecipe(recipes, HexItems.WAND_WARPED, Items.WARPED_PLANKS); - wandRecipe(recipes, HexItems.WAND_AKASHIC, HexBlocks.AKASHIC_PLANKS.asItem()); - - ringCornered(HexItems.FOCUS, 1, ingredients.glowstoneDust(), - ingredients.leather(), Ingredient.of(HexItems.CHARGED_AMETHYST)) + ringCornered(HexItems.FOCUS, 1, + ingredients.glowstoneDust(), + ingredients.leather(), + Ingredient.of(HexItems.CHARGED_AMETHYST)) .unlockedBy("has_item", hasItem(HexItemTags.WANDS)) - .save(recipes); + .save(recipes) ShapedRecipeBuilder.shaped(HexItems.SPELLBOOK) .define('N', ingredients.goldNugget()) @@ -77,17 +72,19 @@ public class HexplatRecipes extends PaucalRecipeProvider { .pattern("NFA") .pattern("NBA") .unlockedBy("has_focus", hasItem(HexItems.FOCUS)) - .unlockedBy("has_chorus", hasItem(Items.CHORUS_FRUIT)).save(recipes); + .unlockedBy("has_chorus", hasItem(Items.CHORUS_FRUIT)).save(recipes) - ringCornerless(HexItems.CYPHER, 1, + ringCornerless( + HexItems.CYPHER, 1, ingredients.copperIngot(), Ingredient.of(HexItems.AMETHYST_DUST)) - .unlockedBy("has_item", hasItem(HexItemTags.WANDS)).save(recipes); + .unlockedBy("has_item", hasItem(HexItemTags.WANDS)).save(recipes) - ringCornerless(HexItems.TRINKET, 1, + ringCornerless( + HexItems.TRINKET, 1, ingredients.ironIngot(), Ingredient.of(Items.AMETHYST_SHARD)) - .unlockedBy("has_item", hasItem(HexItemTags.WANDS)).save(recipes); + .unlockedBy("has_item", hasItem(HexItemTags.WANDS)).save(recipes) ShapedRecipeBuilder.shaped(HexItems.ARTIFACT) .define('F', ingredients.goldIngot()) @@ -97,10 +94,10 @@ public class HexplatRecipes extends PaucalRecipeProvider { .pattern(" F ") .pattern("FAF") .pattern(" D ") - .unlockedBy("has_item", hasItem(HexItemTags.WANDS)).save(recipes); + .unlockedBy("has_item", hasItem(HexItemTags.WANDS)).save(recipes) ringCornerless(HexItems.SCRYING_LENS, 1, Items.GLASS, HexItems.AMETHYST_DUST) - .unlockedBy("has_item", hasItem(HexItemTags.WANDS)).save(recipes); + .unlockedBy("has_item", hasItem(HexItemTags.WANDS)).save(recipes) ShapedRecipeBuilder.shaped(HexItems.ABACUS) .define('S', Items.STICK) @@ -109,7 +106,7 @@ public class HexplatRecipes extends PaucalRecipeProvider { .pattern("WAW") .pattern("SAS") .pattern("WAW") - .unlockedBy("has_item", hasItem(HexItemTags.WANDS)).save(recipes); + .unlockedBy("has_item", hasItem(HexItemTags.WANDS)).save(recipes) // Why am I like this ShapedRecipeBuilder.shaped(HexItems.SUBMARINE_SANDWICH) @@ -120,35 +117,39 @@ public class HexplatRecipes extends PaucalRecipeProvider { .pattern(" SA") .pattern(" C ") .pattern(" B ") - .unlockedBy("has_item", hasItem(Items.AMETHYST_SHARD)).save(recipes); + .unlockedBy("has_item", hasItem(Items.AMETHYST_SHARD)).save(recipes) - for (var dye : DyeColor.values()) { - var item = HexItems.DYE_COLORIZERS.get(dye); + 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); + .unlockedBy("has_item", hasItem(HexItems.AMETHYST_DUST)).save(recipes) } - gayRecipe(recipes, ItemPrideColorizer.Type.AGENDER, Items.GLASS); - gayRecipe(recipes, ItemPrideColorizer.Type.AROACE, Items.WHEAT_SEEDS); - gayRecipe(recipes, ItemPrideColorizer.Type.AROMANTIC, Items.ARROW); - gayRecipe(recipes, ItemPrideColorizer.Type.ASEXUAL, Items.BREAD); - gayRecipe(recipes, ItemPrideColorizer.Type.BISEXUAL, Items.WHEAT); - gayRecipe(recipes, ItemPrideColorizer.Type.DEMIBOY, Items.RAW_IRON); - gayRecipe(recipes, ItemPrideColorizer.Type.DEMIGIRL, Items.RAW_COPPER); - gayRecipe(recipes, ItemPrideColorizer.Type.GAY, Items.STONE_BRICK_WALL); - gayRecipe(recipes, ItemPrideColorizer.Type.GENDERFLUID, Items.WATER_BUCKET); - gayRecipe(recipes, ItemPrideColorizer.Type.GENDERQUEER, Items.GLASS_BOTTLE); - gayRecipe(recipes, ItemPrideColorizer.Type.INTERSEX, Items.AZALEA); - gayRecipe(recipes, ItemPrideColorizer.Type.LESBIAN, Items.HONEYCOMB); - gayRecipe(recipes, ItemPrideColorizer.Type.NONBINARY, Items.MOSS_BLOCK); - gayRecipe(recipes, ItemPrideColorizer.Type.PANSEXUAL, Items.CARROT); - gayRecipe(recipes, ItemPrideColorizer.Type.PLURAL, Items.REPEATER); - gayRecipe(recipes, ItemPrideColorizer.Type.TRANSGENDER, 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) @@ -157,35 +158,37 @@ public class HexplatRecipes extends PaucalRecipeProvider { .pattern(" C ") .pattern(" D ") .pattern(" B ") - .unlockedBy("has_item", hasItem(HexItems.AMETHYST_DUST)).save(recipes); + .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); + .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); + .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); + .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); + .unlockedBy("has_item", hasItem(HexItems.AMETHYST_DUST)).save(recipes) ShapedRecipeBuilder.shaped(HexItems.JEWELER_HAMMER) .define('I', ingredients.ironIngot()) @@ -195,103 +198,120 @@ public class HexplatRecipes extends PaucalRecipeProvider { .pattern("IAN") .pattern(" S ") .pattern(" S ") - .unlockedBy("has_item", hasItem(Items.AMETHYST_SHARD)).save(recipes); + .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")); + .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")); + .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().get(DyeColor.BROWN)) + .requires(ingredients.dyes()[DyeColor.BROWN]!!) .requires(HexBlocks.SCROLL_PAPER, 8) - .unlockedBy("has_item", hasItem(HexBlocks.SCROLL_PAPER)).save(recipes); + .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().get(DyeColor.BROWN)) + .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")); + .save(recipes, modLoc("ageing_scroll_paper_lantern")) - stack(HexBlocks.SCONCE, 4, Ingredient.of(HexItems.CHARGED_AMETHYST), + stack(HexBlocks.SCONCE, 4, + Ingredient.of(HexItems.CHARGED_AMETHYST), ingredients.copperIngot()) - .unlockedBy("has_item", hasItem(HexItems.CHARGED_AMETHYST)).save(recipes); + .unlockedBy("has_item", hasItem(HexItems.CHARGED_AMETHYST)).save(recipes) ShapelessRecipeBuilder.shapeless(HexBlocks.AKASHIC_PLANKS, 4) .requires(HexItemTags.AKASHIC_LOGS) - .unlockedBy("has_item", hasItem(HexItemTags.AKASHIC_LOGS)).save(recipes); + .unlockedBy("has_item", hasItem(HexItemTags.AKASHIC_LOGS)).save(recipes) + ShapedRecipeBuilder.shaped(HexBlocks.AKASHIC_WOOD, 3) .define('W', HexBlocks.AKASHIC_LOG) .pattern("WW") .pattern("WW") - .unlockedBy("has_item", hasItem(HexBlocks.AKASHIC_LOG)).save(recipes); + .unlockedBy("has_item", hasItem(HexBlocks.AKASHIC_LOG)).save(recipes) + ShapedRecipeBuilder.shaped(HexBlocks.AKASHIC_WOOD_STRIPPED, 3) .define('W', HexBlocks.AKASHIC_LOG_STRIPPED) .pattern("WW") .pattern("WW") - .unlockedBy("has_item", hasItem(HexBlocks.AKASHIC_LOG_STRIPPED)).save(recipes); - ring(HexBlocks.AKASHIC_PANEL, 8, HexItemTags.AKASHIC_PLANKS, null) - .unlockedBy("has_item", hasItem(HexItemTags.AKASHIC_PLANKS)).save(recipes); + .unlockedBy("has_item", hasItem(HexBlocks.AKASHIC_LOG_STRIPPED)).save(recipes) + + ring(HexBlocks.AKASHIC_PANEL, 8, + HexItemTags.AKASHIC_PLANKS, null) + .unlockedBy("has_item", hasItem(HexItemTags.AKASHIC_PLANKS)).save(recipes) + ShapedRecipeBuilder.shaped(HexBlocks.AKASHIC_TILE, 6) .define('W', HexItemTags.AKASHIC_PLANKS) .pattern("WW ") .pattern("W W") .pattern(" WW") - .unlockedBy("has_item", hasItem(HexItemTags.AKASHIC_PLANKS)).save(recipes); + .unlockedBy("has_item", hasItem(HexItemTags.AKASHIC_PLANKS)).save(recipes) + ShapedRecipeBuilder.shaped(HexBlocks.AKASHIC_DOOR, 3) .define('W', HexItemTags.AKASHIC_PLANKS) .pattern("WW") .pattern("WW") .pattern("WW") - .unlockedBy("has_item", hasItem(HexItemTags.AKASHIC_PLANKS)).save(recipes); + .unlockedBy("has_item", hasItem(HexItemTags.AKASHIC_PLANKS)).save(recipes) + ShapedRecipeBuilder.shaped(HexBlocks.AKASHIC_TRAPDOOR, 2) .define('W', HexItemTags.AKASHIC_PLANKS) .pattern("WWW") .pattern("WWW") - .unlockedBy("has_item", hasItem(HexItemTags.AKASHIC_PLANKS)).save(recipes); + .unlockedBy("has_item", hasItem(HexItemTags.AKASHIC_PLANKS)).save(recipes) + ShapedRecipeBuilder.shaped(HexBlocks.AKASHIC_STAIRS, 4) .define('W', HexItemTags.AKASHIC_PLANKS) .pattern("W ") .pattern("WW ") .pattern("WWW") - .unlockedBy("has_item", hasItem(HexItemTags.AKASHIC_PLANKS)).save(recipes); + .unlockedBy("has_item", hasItem(HexItemTags.AKASHIC_PLANKS)).save(recipes) + ShapedRecipeBuilder.shaped(HexBlocks.AKASHIC_SLAB, 6) .define('W', HexItemTags.AKASHIC_PLANKS) .pattern("WWW") - .unlockedBy("has_item", hasItem(HexItemTags.AKASHIC_PLANKS)).save(recipes); + .unlockedBy("has_item", hasItem(HexItemTags.AKASHIC_PLANKS)).save(recipes) + ShapedRecipeBuilder.shaped(HexBlocks.AKASHIC_PRESSURE_PLATE, 1) .define('W', HexItemTags.AKASHIC_PLANKS) .pattern("WW") - .unlockedBy("has_item", hasItem(HexItemTags.AKASHIC_PLANKS)).save(recipes); + .unlockedBy("has_item", hasItem(HexItemTags.AKASHIC_PLANKS)).save(recipes) + ShapelessRecipeBuilder.shapeless(HexBlocks.AKASHIC_BUTTON) .requires(HexItemTags.AKASHIC_PLANKS) - .unlockedBy("has_item", hasItem(HexItemTags.AKASHIC_PLANKS)).save(recipes); + .unlockedBy("has_item", hasItem(HexItemTags.AKASHIC_PLANKS)).save(recipes) - var enlightenment = new OvercastTrigger.Instance(EntityPredicate.Composite.ANY, - MinMaxBounds.Ints.ANY, - // add a little bit of slop here + 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)); - + MinMaxBounds.Doubles.between(0.1, 2.05) + ) ShapedRecipeBuilder.shaped(HexBlocks.EMPTY_IMPETUS) .define('B', Items.IRON_BARS) .define('A', HexItems.CHARGED_AMETHYST) @@ -300,7 +320,7 @@ public class HexplatRecipes extends PaucalRecipeProvider { .pattern("PSS") .pattern("BAB") .pattern("SSP") - .unlockedBy("enlightenment", enlightenment).save(recipes); + .unlockedBy("enlightenment", enlightenment).save(recipes) ShapedRecipeBuilder.shaped(HexBlocks.EMPTY_DIRECTRIX) .define('C', Items.COMPARATOR) @@ -310,16 +330,17 @@ public class HexplatRecipes extends PaucalRecipeProvider { .pattern("CSS") .pattern("OAO") .pattern("SSC") - .unlockedBy("enlightenment", enlightenment).save(recipes); + .unlockedBy("enlightenment", enlightenment).save(recipes) ShapedRecipeBuilder.shaped(HexBlocks.AKASHIC_BOOKSHELF) .define('L', HexItemTags.AKASHIC_LOGS) .define('P', HexItemTags.AKASHIC_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); + .unlockedBy("enlightenment", enlightenment).save(recipes) + ShapedRecipeBuilder.shaped(HexBlocks.AKASHIC_CONNECTOR) .define('L', HexItemTags.AKASHIC_LOGS) .define('P', HexItemTags.AKASHIC_PLANKS) @@ -327,98 +348,112 @@ public class HexplatRecipes extends PaucalRecipeProvider { .pattern("LPL") .pattern("CCC") .pattern("LPL") - .unlockedBy("enlightenment", enlightenment).save(recipes); + .unlockedBy("enlightenment", enlightenment).save(recipes) - new BrainsweepRecipeBuilder(StateIngredientHelper.of(Blocks.AMETHYST_BLOCK), - new VillagerIngredient(null, null, 3), + BrainsweepRecipeBuilder(StateIngredientHelper.of(Blocks.AMETHYST_BLOCK), + VillagerIngredient(null, null, 3), Blocks.BUDDING_AMETHYST.defaultBlockState()) .unlockedBy("enlightenment", enlightenment) - .save(recipes, modLoc("brainsweep/budding_amethyst")); + .save(recipes, modLoc("brainsweep/budding_amethyst")) - new BrainsweepRecipeBuilder(StateIngredientHelper.of(HexBlocks.EMPTY_IMPETUS), - new VillagerIngredient(new ResourceLocation("toolsmith"), null, 2), + BrainsweepRecipeBuilder(StateIngredientHelper.of(HexBlocks.EMPTY_IMPETUS), + VillagerIngredient(ResourceLocation("toolsmith"), null, 2), HexBlocks.IMPETUS_RIGHTCLICK.defaultBlockState()) .unlockedBy("enlightenment", enlightenment) - .save(recipes, modLoc("brainsweep/impetus_rightclick")); - new BrainsweepRecipeBuilder(StateIngredientHelper.of(HexBlocks.EMPTY_IMPETUS), - new VillagerIngredient(new ResourceLocation("fletcher"), null, 2), + .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")); - new BrainsweepRecipeBuilder(StateIngredientHelper.of(HexBlocks.EMPTY_IMPETUS), - new VillagerIngredient(new ResourceLocation("cleric"), null, 2), + .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")); + .save(recipes, modLoc("brainsweep/impetus_storedplayer")) - new BrainsweepRecipeBuilder(StateIngredientHelper.of(HexBlocks.EMPTY_DIRECTRIX), - new VillagerIngredient(new ResourceLocation("mason"), null, 1), + BrainsweepRecipeBuilder(StateIngredientHelper.of(HexBlocks.EMPTY_DIRECTRIX), + VillagerIngredient(ResourceLocation("mason"), null, 1), HexBlocks.DIRECTRIX_REDSTONE.defaultBlockState()) .unlockedBy("enlightenment", enlightenment) - .save(recipes, modLoc("brainsweep/directrix_redstone")); + .save(recipes, modLoc("brainsweep/directrix_redstone")) - new BrainsweepRecipeBuilder(StateIngredientHelper.of(HexBlocks.AKASHIC_CONNECTOR), - new VillagerIngredient(new ResourceLocation("librarian"), null, 5), + BrainsweepRecipeBuilder(StateIngredientHelper.of(HexBlocks.AKASHIC_CONNECTOR), + VillagerIngredient(ResourceLocation("librarian"), null, 5), HexBlocks.AKASHIC_RECORD.defaultBlockState()) .unlockedBy("enlightenment", enlightenment) - .save(recipes, modLoc("brainsweep/akashic_record")); + .save(recipes, modLoc("brainsweep/akashic_record")) // Create compat - - createCrushing.get() + CreateCrushingRecipeBuilder() .withInput(Blocks.AMETHYST_CLUSTER) .duration(150) .withOutput(Items.AMETHYST_SHARD, 7) .withOutput(HexItems.AMETHYST_DUST, 5) .withOutput(0.25f, HexItems.CHARGED_AMETHYST) - .save(recipes, new ResourceLocation("create", "crushing/amethyst_cluster")); + .withConditions() + .whenModLoaded("create") + .save(recipes, ResourceLocation("create", "crushing/amethyst_cluster")) - createCrushing.get() + CreateCrushingRecipeBuilder() .withInput(Blocks.AMETHYST_BLOCK) .duration(150) .withOutput(Items.AMETHYST_SHARD, 3) .withOutput(0.5f, HexItems.AMETHYST_DUST, 4) - .save(recipes, new ResourceLocation("create", "crushing/amethyst_block")); + .withConditions() + .whenModLoaded("create") + .save(recipes, ResourceLocation("create", "crushing/amethyst_block")) - createCrushing.get() + CreateCrushingRecipeBuilder() .withInput(Items.AMETHYST_SHARD) .duration(150) .withOutput(HexItems.AMETHYST_DUST, 4) .withOutput(0.5f, HexItems.AMETHYST_DUST) - .save(recipes, modLoc("compat/create/crushing/amethyst_shard")); + .withConditions() + .whenModLoaded("create") + .save(recipes, modLoc("compat/create/crushing/amethyst_shard")) // FD compat - - new FarmersDelightCuttingRecipeBuilder() + FarmersDelightCuttingRecipeBuilder() .withInput(HexBlocks.AKASHIC_LOG) .withTool(ingredients.axeStrip()) .withOutput(HexBlocks.AKASHIC_LOG_STRIPPED) .withOutput("farmersdelight:tree_bark") .withSound(SoundEvents.AXE_STRIP) - .save(recipes, modLoc("compat/farmersdelight/cutting/akashic_log")); + .withConditions() + .whenModLoaded("farmersdelight") + .save(recipes, modLoc("compat/farmersdelight/cutting/akashic_log")) - new FarmersDelightCuttingRecipeBuilder() + FarmersDelightCuttingRecipeBuilder() .withInput(HexBlocks.AKASHIC_WOOD) .withTool(ingredients.axeStrip()) .withOutput(HexBlocks.AKASHIC_WOOD_STRIPPED) .withOutput("farmersdelight:tree_bark") .withSound(SoundEvents.AXE_STRIP) - .save(recipes, modLoc("compat/farmersdelight/cutting/akashic_wood")); + .withConditions() + .whenModLoaded("farmersdelight") + .save(recipes, modLoc("compat/farmersdelight/cutting/akashic_wood")) - new FarmersDelightCuttingRecipeBuilder() + FarmersDelightCuttingRecipeBuilder() .withInput(HexBlocks.AKASHIC_TRAPDOOR) .withTool(ingredients.axeDig()) .withOutput(HexBlocks.AKASHIC_PLANKS) - .save(recipes, modLoc("compat/farmersdelight/cutting/akashic_trapdoor")); + .withConditions() + .whenModLoaded("farmersdelight") + .save(recipes, modLoc("compat/farmersdelight/cutting/akashic_trapdoor")) - new FarmersDelightCuttingRecipeBuilder() + FarmersDelightCuttingRecipeBuilder() .withInput(HexBlocks.AKASHIC_DOOR) .withTool(ingredients.axeDig()) .withOutput(HexBlocks.AKASHIC_PLANKS) - .save(recipes, modLoc("compat/farmersdelight/cutting/akashic_door")); + .withConditions() + .whenModLoaded("farmersdelight") + .save(recipes, modLoc("compat/farmersdelight/cutting/akashic_door")) } - private void wandRecipe(Consumer recipes, ItemWand wand, Item plank) { + private fun wandRecipe(recipes: Consumer, wand: ItemWand, plank: Item) { ShapedRecipeBuilder.shaped(wand) .define('W', plank) .define('S', Items.STICK) @@ -427,22 +462,25 @@ public class HexplatRecipes extends PaucalRecipeProvider { .pattern(" WS") .pattern("S ") .unlockedBy("has_item", hasItem(HexItems.CHARGED_AMETHYST)) - .save(recipes); + .save(recipes) } - private void gayRecipe(Consumer recipes, ItemPrideColorizer.Type type, Item material) { - var colorizer = HexItems.PRIDE_COLORIZERS.get(type); + 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); + .unlockedBy("has_item", hasItem(HexItems.AMETHYST_DUST)) + .save(recipes) } - protected 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 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/CompatIngredientValue.java b/Common/src/main/java/at/petrak/hexcasting/datagen/recipe/builders/CompatIngredientValue.java new file mode 100644 index 00000000..4feffa64 --- /dev/null +++ b/Common/src/main/java/at/petrak/hexcasting/datagen/recipe/builders/CompatIngredientValue.java @@ -0,0 +1,33 @@ +package at.petrak.hexcasting.datagen.recipe.builders; + +import com.google.gson.JsonObject; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.item.crafting.Ingredient; +import org.jetbrains.annotations.NotNull; + +import java.util.Collection; +import java.util.Collections; +import java.util.stream.Stream; + +public class CompatIngredientValue implements Ingredient.Value { + public final String item; + + public CompatIngredientValue(String name) { + this.item = name; + } + + public @NotNull Collection getItems() { + return Collections.emptyList(); + } + + public @NotNull JsonObject serialize() { + JsonObject jsonObject = new JsonObject(); + jsonObject.addProperty("item", item); + return jsonObject; + } + + public static Ingredient of(String itemName) { + return new Ingredient(Stream.of(new CompatIngredientValue(itemName))); + } +} + diff --git a/Common/src/main/java/at/petrak/hexcasting/datagen/recipe/builders/CreateCrushingRecipeBuilder.java b/Common/src/main/java/at/petrak/hexcasting/datagen/recipe/builders/CreateCrushingRecipeBuilder.java index ecf933a7..95cf6be0 100644 --- a/Common/src/main/java/at/petrak/hexcasting/datagen/recipe/builders/CreateCrushingRecipeBuilder.java +++ b/Common/src/main/java/at/petrak/hexcasting/datagen/recipe/builders/CreateCrushingRecipeBuilder.java @@ -24,7 +24,7 @@ import java.util.function.Consumer; // https://github.com/Creators-of-Create/Create/blob/82be76d8934af03b4e52cad6a9f74a4175ba7b05/src/main/java/com/simibubi/create/foundation/data/recipe/ProcessingRecipeGen.java // https://github.com/Creators-of-Create/Create/blob/82be76d8934af03b4e52cad6a9f74a4175ba7b05/src/main/java/com/simibubi/create/content/contraptions/processing/ProcessingRecipeBuilder.java // https://github.com/Creators-of-Create/Create/blob/82be76d8934af03b4e52cad6a9f74a4175ba7b05/src/main/java/com/simibubi/create/content/contraptions/processing/ProcessingRecipeSerializer.java -public abstract class CreateCrushingRecipeBuilder implements RecipeBuilder { +public class CreateCrushingRecipeBuilder implements RecipeBuilder { private String group = ""; private Ingredient input; private final List results = new ArrayList<>(); @@ -107,12 +107,6 @@ public abstract class CreateCrushingRecipeBuilder implements RecipeBuilder { consumer.accept(new CrushingRecipe(resourceLocation)); } - public abstract void serializeConditions(JsonObject object); - - public abstract CreateCrushingRecipeBuilder whenModLoaded(String modid); - - public abstract CreateCrushingRecipeBuilder whenModMissing(String modid); - public class CrushingRecipe implements FinishedRecipe { private final ResourceLocation id; @@ -143,8 +137,6 @@ public abstract class CreateCrushingRecipeBuilder implements RecipeBuilder { if (processingDuration > 0) { json.addProperty("processingTime", processingDuration); } - - serializeConditions(json); } @Override diff --git a/Common/src/main/resources/hexplat.accesswidener b/Common/src/main/resources/hexplat.accesswidener index 53c99887..478bd440 100644 --- a/Common/src/main/resources/hexplat.accesswidener +++ b/Common/src/main/resources/hexplat.accesswidener @@ -3,3 +3,5 @@ accessible class net/minecraft/client/renderer/RenderType$CompositeRenderType accessible class net/minecraft/client/renderer/RenderType$CompositeState accessible field net/minecraft/client/renderer/RenderType$CompositeState textureState Lnet/minecraft/client/renderer/RenderStateShard$EmptyTextureStateShard; accessible class net/minecraft/client/renderer/RenderStateShard$EmptyTextureStateShard +accessible class net/minecraft/world/item/crafting/Ingredient$Value +accessible method net/minecraft/world/item/crafting/Ingredient (Ljava/util/stream/Stream;)V diff --git a/Fabric/gradle.properties b/Fabric/gradle.properties index 82438c20..0b6172c3 100644 --- a/Fabric/gradle.properties +++ b/Fabric/gradle.properties @@ -4,7 +4,7 @@ fabricLoaderVersion=0.14.5 fiberVersion=0.23.0-2 cardinalComponentsVersion=4.1.4 -serializationHooksVersion=0.1.0+1.18.095e8a6 +serializationHooksVersion=0.3.22 reiVersion=8.0.442 emiVersion=0.1.0+1.18.2 diff --git a/Fabric/src/generated/resources/.cache/cache b/Fabric/src/generated/resources/.cache/cache index 2aafde8b..115eda47 100644 --- a/Fabric/src/generated/resources/.cache/cache +++ b/Fabric/src/generated/resources/.cache/cache @@ -1,6 +1,6 @@ 556d2e6068965e90c307a435b372ae761cd1c606 data/minecraft/tags/items/wooden_doors.json b596d96eebb4f7bad5930f4eebc589f292b59c98 data/minecraft/tags/items/planks.json -568ac8a13b7762b92cc274d74a7c729cc6e16687 data/hexcasting/recipes/pride_colorizer_pansexual.json +39ef3ab2effbae595b45400e7db7a8ad693e0d13 data/hexcasting/recipes/pride_colorizer_pansexual.json c521621c409275e219f72abf5c6089d60408e646 data/hexcasting/loot_tables/blocks/impetus_rightclick.json 023c32e8834eb313c4fa94a84a8f6390ee951ef0 data/hexcasting/advancements/recipes/hexcasting.creative_tab/empty_impetus.json bdf848284137f0116ddf4725b0dda6eaa0cef5fd data/hexcasting/loot_tables/blocks/akashic_wood_stripped.json @@ -55,14 +55,14 @@ f3c6b6917e504e1c3d5d8875f7cce6f311e791d2 data/minecraft/tags/blocks/logs_that_bu 2ad42dd4a4877a23cb7f45e8b75c9f53f58d12f5 data/hexcasting/recipes/wand_acacia.json b0b1c5fff194b92ff8c5d6468e177271fd910abd data/hexcasting/advancements/recipes/hexcasting.creative_tab/dye_colorizer_red.json 9c619750b17ac95e339882ce6c097ba9a000cc82 data/hexcasting/advancements/recipes/hexcasting.creative_tab/pride_colorizer_pansexual.json -ad85e0162a7c68d431fd700700906ccbcadf91ce data/hexcasting/recipes/compat/create/crushing/amethyst_shard.json +21041998b3f1de0b45c731295576fc4b2ec6905a data/hexcasting/recipes/compat/create/crushing/amethyst_shard.json 2d79a41ba8697f9e1fa26b1bff48f33c824d3823 data/minecraft/tags/blocks/wooden_pressure_plates.json 8334a42636f045b4dc34c0fe5b3b3d3902aa4b7e data/hexcasting/recipes/scroll_small.json 584bd8806ef8df5f0e623ed727d6e54a61e60dea data/hexcasting/loot_tables/blocks/slate_block.json c11dc4388c18dadff5d93126eb0f7ae848d627b9 data/hexcasting/advancements/recipes/brainsweep/brainsweep/directrix_redstone.json 5f3e3813757d8300acad523d45ac7c4d85728399 data/minecraft/tags/items/buttons.json 4066f098ef104eadf6729bb372d9e643c598b477 data/hexcasting/advancements/recipes/hexcasting.creative_tab/akashic_wood_stripped.json -42a8f3ea310d25760b3374c7b7338f445d51a005 data/hexcasting/recipes/compat/farmersdelight/cutting/akashic_door.json +ffe8e09c41222b5b909626436dbd7099e01ccc64 data/hexcasting/recipes/compat/farmersdelight/cutting/akashic_door.json 310e2440f26f130c81d32d9fcd93a3384c2b1e72 data/hexcasting/advancements/recipes/hexcasting.creative_tab/dye_colorizer_brown.json 5f3e3813757d8300acad523d45ac7c4d85728399 data/minecraft/tags/blocks/buttons.json 30950c6dd31102cf145f8f7d2979df0736a7ba1e data/hexcasting/advancements/recipes/hexcasting.creative_tab/wand_oak.json @@ -101,7 +101,7 @@ e5ae652aee1567ac2e626fa0f88f160993a6f9a5 data/hexcasting/advancements/recipes/he 7c0107192c0e24ff9f23ab0f59834b6081ca5b33 data/hexcasting/advancements/recipes/hexcasting.creative_tab/wand_crimson.json 1266b263056dd15c862bff27b05a119c4bbc89ee data/hexcasting/advancements/recipes/hexcasting.creative_tab/akashic_door.json a92e5560c774bb81cd9f38bd9378af8695cac622 data/hexcasting/recipes/akashic_stairs.json -59e0c3893a64d84b5fde52291067b3601c43ffc9 data/create/recipes/crushing/amethyst_cluster.json +8a9b22b846968e9120c3a63a9f18694aa5703cab data/create/recipes/crushing/amethyst_cluster.json f3a33396e071f3afd61eadab2aabdb9acf2ae775 data/hexcasting/recipes/slate.json f7bbc60f547a02378ddb1f23395add4822725fed data/hexcasting/recipes/wand_oak.json 0529b25d154715d6b1c030d87e59e6f9d41d91d6 data/hexcasting/recipes/focus.json @@ -160,7 +160,7 @@ a84bf48a188d7b250db5c971a6d9b63d82279ba3 data/hexcasting/recipes/akashic_wood.js 3f9756b2c5137b285c4faa88ab43c4996b6b2bb6 data/hexcasting/recipes/ancient_scroll_paper_lantern.json c375ba3f7105d6f57ef982f6f4e9326ad88a947d data/hexcasting/loot_tables/blocks/ancient_scroll_paper_lantern.json b596d96eebb4f7bad5930f4eebc589f292b59c98 data/hexcasting/tags/blocks/akashic_planks.json -e60c478db2f8552e8c1e9ee5d361658dd8eafaa4 data/hexcasting/recipes/compat/farmersdelight/cutting/akashic_wood.json +4d8667ebdad42e7220009f69a1f6f465a73b2a9a data/hexcasting/recipes/compat/farmersdelight/cutting/akashic_wood.json a27a2514fd3acb6cf0a4f2a6b176ca4c2a3ee064 data/hexcasting/advancements/recipes/hexcasting.creative_tab/dye_colorizer_cyan.json 1d19457c9843d97d2ed59199d9077940d9e5e46a data/hexcasting/recipes/akashic_button.json b596d96eebb4f7bad5930f4eebc589f292b59c98 data/minecraft/tags/blocks/planks.json @@ -223,7 +223,7 @@ c25784941d6416744fb2ca2d43a3203e5c3e7c8a data/minecraft/tags/items/leaves.json ef016ca292fa4edc7496b64e6f2931f4e7d90636 data/hexcasting/recipes/amethyst_dust_packing.json 35a9b4beac7c6eddb990464eaeaebec2a9ab9951 data/hexcasting/loot_tables/inject/scroll_loot_many.json 949f05968c562d5e4d35630ce8e3189a2060dee7 data/hexcasting/advancements/recipes/hexcasting.creative_tab/pride_colorizer_intersex.json -cfda8a0bb9051f9f876cd5b9afcd8a7f6a1e4290 data/create/recipes/crushing/amethyst_block.json +d189977c9c5d2048ba1ba40ee49d182af2836330 data/create/recipes/crushing/amethyst_block.json 02dcee696b1e162f20dbfcf02bdb9e2144a64a27 data/hexcasting/recipes/pride_colorizer_gay.json 7c08784f2de139be380b5299f8ea8b8c78126ed8 data/minecraft/tags/blocks/mineable/axe.json 32e3d36398fa63e017ed6c46e7e19d7ba041c3d9 data/hexcasting/recipes/pride_colorizer_bisexual.json @@ -240,7 +240,7 @@ db8a00478e1c4b0f9b143b5946d1ba25e489591d data/hexcasting/recipes/dynamic/seal_fo 076dd8bb2ce1508293384fa93fa138a369d10751 data/hexcasting/advancements/recipes/hexcasting.creative_tab/dye_colorizer_green.json 3147422bed290cb47ea3763dbdc6f0e96eed5c2a data/hexcasting/loot_tables/inject/scroll_loot_few.json aab3082b3303f358cc265fb10bc9bbe08c96eef0 data/hexcasting/recipes/trinket.json -c15a0780a2cd9c92dad948479049ab8495a33635 data/hexcasting/recipes/compat/farmersdelight/cutting/akashic_trapdoor.json +77afbbd8280136eb11d1aab1219d6057063e8f75 data/hexcasting/recipes/compat/farmersdelight/cutting/akashic_trapdoor.json c3aed1dbaa46e084711a116d1bb4522df9a7405a data/hexcasting/advancements/recipes/hexcasting.creative_tab/dye_colorizer_light_blue.json 3a376402af89128dc37adaa0a72b6de66d58309d data/hexcasting/recipes/dynamic/seal_spellbook.json 2ec90cd941acad6eabfb38d21466ef8e9b9bf2c1 data/hexcasting/recipes/wand_jungle.json @@ -253,7 +253,7 @@ f3c6b6917e504e1c3d5d8875f7cce6f311e791d2 data/hexcasting/tags/items/akashic_logs c64f5e56ca18eb68d2e58827920ca0e3ae4617ca data/hexcasting/recipes/dye_colorizer_blue.json 5f3e3813757d8300acad523d45ac7c4d85728399 data/minecraft/tags/blocks/wooden_buttons.json e125117befadda0785e370969a8e04eff070d057 data/hexcasting/loot_tables/blocks/amethyst_sconce.json -37461a314331d79691c48cd13b6540260021cba4 data/hexcasting/recipes/compat/farmersdelight/cutting/akashic_log.json +b8825decc5079bbe72c8a189e36bda2efefaf26f data/hexcasting/recipes/compat/farmersdelight/cutting/akashic_log.json 4da41a82a17f58c9342944f214e745696c1d8ed7 data/hexcasting/loot_tables/blocks/impetus_storedplayer.json 67d4c536be3762833a4af33cd7cdfc68eb4ad629 data/hexcasting/advancements/recipes/hexcasting.creative_tab/wand_dark_oak.json 22ad2496732633bb5539a1fa761051d7add48055 data/hexcasting/advancements/recipes/hexcasting.creative_tab/slate.json diff --git a/Fabric/src/generated/resources/data/create/recipes/crushing/amethyst_block.json b/Fabric/src/generated/resources/data/create/recipes/crushing/amethyst_block.json index d162220c..4d640f5c 100644 --- a/Fabric/src/generated/resources/data/create/recipes/crushing/amethyst_block.json +++ b/Fabric/src/generated/resources/data/create/recipes/crushing/amethyst_block.json @@ -16,5 +16,13 @@ "chance": 0.5 } ], - "processingTime": 150 + "processingTime": 150, + "fabric:load_conditions": [ + { + "condition": "fabric:all_mods_loaded", + "values": [ + "create" + ] + } + ] } \ No newline at end of file diff --git a/Fabric/src/generated/resources/data/create/recipes/crushing/amethyst_cluster.json b/Fabric/src/generated/resources/data/create/recipes/crushing/amethyst_cluster.json index f326bf4a..dcabb9ec 100644 --- a/Fabric/src/generated/resources/data/create/recipes/crushing/amethyst_cluster.json +++ b/Fabric/src/generated/resources/data/create/recipes/crushing/amethyst_cluster.json @@ -19,5 +19,13 @@ "chance": 0.25 } ], - "processingTime": 150 + "processingTime": 150, + "fabric:load_conditions": [ + { + "condition": "fabric:all_mods_loaded", + "values": [ + "create" + ] + } + ] } \ No newline at end of file diff --git a/Fabric/src/generated/resources/data/hexcasting/recipes/compat/create/crushing/amethyst_shard.json b/Fabric/src/generated/resources/data/hexcasting/recipes/compat/create/crushing/amethyst_shard.json index ffa35cc3..b9ecda86 100644 --- a/Fabric/src/generated/resources/data/hexcasting/recipes/compat/create/crushing/amethyst_shard.json +++ b/Fabric/src/generated/resources/data/hexcasting/recipes/compat/create/crushing/amethyst_shard.json @@ -15,5 +15,13 @@ "chance": 0.5 } ], - "processingTime": 150 + "processingTime": 150, + "fabric:load_conditions": [ + { + "condition": "fabric:all_mods_loaded", + "values": [ + "create" + ] + } + ] } \ No newline at end of file diff --git a/Fabric/src/generated/resources/data/hexcasting/recipes/compat/farmersdelight/cutting/akashic_door.json b/Fabric/src/generated/resources/data/hexcasting/recipes/compat/farmersdelight/cutting/akashic_door.json index 4f66808a..701b7c6f 100644 --- a/Fabric/src/generated/resources/data/hexcasting/recipes/compat/farmersdelight/cutting/akashic_door.json +++ b/Fabric/src/generated/resources/data/hexcasting/recipes/compat/farmersdelight/cutting/akashic_door.json @@ -13,5 +13,13 @@ { "item": "hexcasting:akashic_planks" } + ], + "fabric:load_conditions": [ + { + "condition": "fabric:all_mods_loaded", + "values": [ + "farmersdelight" + ] + } ] } \ No newline at end of file diff --git a/Fabric/src/generated/resources/data/hexcasting/recipes/compat/farmersdelight/cutting/akashic_log.json b/Fabric/src/generated/resources/data/hexcasting/recipes/compat/farmersdelight/cutting/akashic_log.json index cae5afbf..1e13e009 100644 --- a/Fabric/src/generated/resources/data/hexcasting/recipes/compat/farmersdelight/cutting/akashic_log.json +++ b/Fabric/src/generated/resources/data/hexcasting/recipes/compat/farmersdelight/cutting/akashic_log.json @@ -17,5 +17,13 @@ "item": "farmersdelight:tree_bark" } ], - "sound": "minecraft:item.axe.strip" + "sound": "minecraft:item.axe.strip", + "fabric:load_conditions": [ + { + "condition": "fabric:all_mods_loaded", + "values": [ + "farmersdelight" + ] + } + ] } \ No newline at end of file diff --git a/Fabric/src/generated/resources/data/hexcasting/recipes/compat/farmersdelight/cutting/akashic_trapdoor.json b/Fabric/src/generated/resources/data/hexcasting/recipes/compat/farmersdelight/cutting/akashic_trapdoor.json index 96dd858d..90fc66af 100644 --- a/Fabric/src/generated/resources/data/hexcasting/recipes/compat/farmersdelight/cutting/akashic_trapdoor.json +++ b/Fabric/src/generated/resources/data/hexcasting/recipes/compat/farmersdelight/cutting/akashic_trapdoor.json @@ -13,5 +13,13 @@ { "item": "hexcasting:akashic_planks" } + ], + "fabric:load_conditions": [ + { + "condition": "fabric:all_mods_loaded", + "values": [ + "farmersdelight" + ] + } ] } \ No newline at end of file diff --git a/Fabric/src/generated/resources/data/hexcasting/recipes/compat/farmersdelight/cutting/akashic_wood.json b/Fabric/src/generated/resources/data/hexcasting/recipes/compat/farmersdelight/cutting/akashic_wood.json index 6e293322..95286f7e 100644 --- a/Fabric/src/generated/resources/data/hexcasting/recipes/compat/farmersdelight/cutting/akashic_wood.json +++ b/Fabric/src/generated/resources/data/hexcasting/recipes/compat/farmersdelight/cutting/akashic_wood.json @@ -17,5 +17,13 @@ "item": "farmersdelight:tree_bark" } ], - "sound": "minecraft:item.axe.strip" + "sound": "minecraft:item.axe.strip", + "fabric:load_conditions": [ + { + "condition": "fabric:all_mods_loaded", + "values": [ + "farmersdelight" + ] + } + ] } \ No newline at end of file diff --git a/Fabric/src/generated/resources/data/hexcasting/recipes/pride_colorizer_pansexual.json b/Fabric/src/generated/resources/data/hexcasting/recipes/pride_colorizer_pansexual.json index ec18619d..cfac72f2 100644 --- a/Fabric/src/generated/resources/data/hexcasting/recipes/pride_colorizer_pansexual.json +++ b/Fabric/src/generated/resources/data/hexcasting/recipes/pride_colorizer_pansexual.json @@ -10,7 +10,14 @@ "item": "hexcasting:amethyst_dust" }, "C": { - "item": "minecraft:carrot" + "type": "hexcasting:mod_conditional", + "default": { + "item": "minecraft:carrot" + }, + "modid": "farmersdelight", + "if_loaded": { + "item": "farmersdelight:skillet" + } } }, "result": { 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 bdf941af..2517a6df 100644 --- a/Fabric/src/main/java/at/petrak/hexcasting/fabric/FabricHexInitializer.kt +++ b/Fabric/src/main/java/at/petrak/hexcasting/fabric/FabricHexInitializer.kt @@ -1,6 +1,5 @@ package at.petrak.hexcasting.fabric -import at.petrak.hexcasting.api.HexAPI.modLoc import at.petrak.hexcasting.api.advancements.HexAdvancementTriggers import at.petrak.hexcasting.api.mod.HexStatistics import at.petrak.hexcasting.common.blocks.behavior.HexComposting @@ -17,6 +16,7 @@ import at.petrak.hexcasting.common.misc.PlayerPositionRecorder import at.petrak.hexcasting.common.recipe.HexRecipeSerializers import at.petrak.hexcasting.fabric.event.VillagerConversionCallback 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 @@ -90,7 +90,8 @@ object FabricHexInitializer : ModInitializer { HexBlocks.registerBlockItems(bind(Registry.ITEM)) HexBlockEntities.registerTiles(bind(Registry.BLOCK_ENTITY_TYPE)) HexItems.registerItems(bind(Registry.ITEM)) - Registry.register(IngredientDeserializer.REGISTRY, modLoc("unsealed"), 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/Fabric/src/main/java/at/petrak/hexcasting/fabric/datagen/HexFabricConditionsBuilder.java b/Fabric/src/main/java/at/petrak/hexcasting/fabric/datagen/HexFabricConditionsBuilder.java new file mode 100644 index 00000000..f196de36 --- /dev/null +++ b/Fabric/src/main/java/at/petrak/hexcasting/fabric/datagen/HexFabricConditionsBuilder.java @@ -0,0 +1,96 @@ +package at.petrak.hexcasting.fabric.datagen; + +import at.petrak.hexcasting.datagen.IXplatConditionsBuilder; +import com.google.gson.JsonObject; +import net.fabricmc.fabric.api.resource.conditions.v1.ConditionJsonProvider; +import net.fabricmc.fabric.api.resource.conditions.v1.DefaultResourceConditions; +import net.fabricmc.fabric.impl.datagen.FabricDataGenHelper; +import net.minecraft.advancements.CriterionTriggerInstance; +import net.minecraft.data.recipes.FinishedRecipe; +import net.minecraft.data.recipes.RecipeBuilder; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.world.item.Item; +import net.minecraft.world.item.crafting.RecipeSerializer; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; + +import java.util.ArrayList; +import java.util.List; +import java.util.function.Consumer; + +public class HexFabricConditionsBuilder implements IXplatConditionsBuilder { + private final List conditions = new ArrayList<>(); + private final RecipeBuilder parent; + + public HexFabricConditionsBuilder(RecipeBuilder parent) { + this.parent = parent; + } + + @Override + public IXplatConditionsBuilder whenModLoaded(String modid) { + conditions.add(DefaultResourceConditions.allModsLoaded(modid)); + return this; + } + + @Override + public IXplatConditionsBuilder whenModMissing(String modid) { + conditions.add(DefaultResourceConditions.not(DefaultResourceConditions.allModsLoaded(modid))); + return this; + } + + @Override + public RecipeBuilder unlockedBy(@NotNull String string, @NotNull CriterionTriggerInstance criterionTriggerInstance) { + return parent.unlockedBy(string, criterionTriggerInstance); + } + + @Override + public RecipeBuilder group(@Nullable String string) { + return parent.group(string); + } + + @Override + public Item getResult() { + return parent.getResult(); + } + + @Override + @SuppressWarnings("UnstableApiUsage") + public void save(@NotNull Consumer consumer, @NotNull ResourceLocation resourceLocation) { + Consumer withConditions = json -> { + FabricDataGenHelper.addConditions(json, conditions.toArray(new ConditionJsonProvider[0])); + + consumer.accept(new FinishedRecipe() { + @Override + public void serializeRecipeData(@NotNull JsonObject jsonObject) { + json.serializeRecipeData(jsonObject); + ConditionJsonProvider[] conditions = FabricDataGenHelper.consumeConditions(json); + ConditionJsonProvider.write(jsonObject, conditions); + } + + @Override + public ResourceLocation getId() { + return json.getId(); + } + + @Override + public RecipeSerializer getType() { + return json.getType(); + } + + @Nullable + @Override + public JsonObject serializeAdvancement() { + return json.serializeAdvancement(); + } + + @Nullable + @Override + public ResourceLocation getAdvancementId() { + return json.getAdvancementId(); + } + }); + }; + + parent.save(withConditions, resourceLocation); + } +} 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 343f34b6..3dcd23de 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 @@ -7,7 +7,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.ToolIngredient; -import at.petrak.hexcasting.fabric.datagen.builders.FabricCreateCrushingRecipeBuilder; +import at.petrak.hexcasting.fabric.recipe.FabricModConditionalIngredient; import at.petrak.hexcasting.xplat.IXplatAbstractions; import com.google.gson.JsonObject; import net.fabricmc.fabric.api.datagen.v1.DataGeneratorEntrypoint; @@ -26,7 +26,7 @@ public class HexFabricDataGenerators implements DataGeneratorEntrypoint { public void onInitializeDataGenerator(FabricDataGenerator gen) { HexAPI.LOGGER.info("Starting Fabric-specific datagen"); - gen.addProvider(new HexplatRecipes(gen, INGREDIENTS, FabricCreateCrushingRecipeBuilder::new)); + gen.addProvider(new HexplatRecipes(gen, INGREDIENTS, HexFabricConditionsBuilder::new)); var xtags = IXplatAbstractions.INSTANCE.tags(); var blockTagProvider = new HexBlockTagProvider(gen, xtags); @@ -116,6 +116,11 @@ public class HexFabricDataGenerators implements DataGeneratorEntrypoint { )); } + @Override + public Ingredient whenModIngredient(Ingredient defaultIngredient, String modid, Ingredient modIngredient) { + return FabricModConditionalIngredient.of(defaultIngredient, modid, modIngredient); + } + private final ToolIngredient AXE_INGREDIENT = () -> { JsonObject object = new JsonObject(); object.addProperty("type", "farmersdelight:tool"); diff --git a/Fabric/src/main/java/at/petrak/hexcasting/fabric/datagen/builders/FabricCreateCrushingRecipeBuilder.java b/Fabric/src/main/java/at/petrak/hexcasting/fabric/datagen/builders/FabricCreateCrushingRecipeBuilder.java deleted file mode 100644 index 5d0f8467..00000000 --- a/Fabric/src/main/java/at/petrak/hexcasting/fabric/datagen/builders/FabricCreateCrushingRecipeBuilder.java +++ /dev/null @@ -1,37 +0,0 @@ -package at.petrak.hexcasting.fabric.datagen.builders; - -import at.petrak.hexcasting.datagen.recipe.builders.CreateCrushingRecipeBuilder; -import com.google.gson.JsonArray; -import com.google.gson.JsonObject; -import net.fabricmc.fabric.api.resource.conditions.v1.ConditionJsonProvider; -import net.fabricmc.fabric.api.resource.conditions.v1.DefaultResourceConditions; -import net.fabricmc.fabric.api.resource.conditions.v1.ResourceConditions; - -import java.util.ArrayList; -import java.util.List; - -public class FabricCreateCrushingRecipeBuilder extends CreateCrushingRecipeBuilder { - private final List conditions = new ArrayList<>(); - - public FabricCreateCrushingRecipeBuilder whenModLoaded(String modid) { - return withCondition(DefaultResourceConditions.anyModLoaded(modid)); - } - - public FabricCreateCrushingRecipeBuilder whenModMissing(String modid) { - return withCondition(DefaultResourceConditions.not(DefaultResourceConditions.anyModLoaded(modid))); - } - - public FabricCreateCrushingRecipeBuilder withCondition(ConditionJsonProvider condition) { - conditions.add(condition); - return this; - } - - @Override - public void serializeConditions(JsonObject object) { - if (!conditions.isEmpty()) { - JsonArray conds = new JsonArray(); - conditions.forEach(c -> conds.add(c.toJson())); - object.add(ResourceConditions.CONDITIONS_KEY, conds); - } - } -} diff --git a/Fabric/src/main/java/at/petrak/hexcasting/fabric/recipe/FabricModConditionalIngredient.java b/Fabric/src/main/java/at/petrak/hexcasting/fabric/recipe/FabricModConditionalIngredient.java new file mode 100644 index 00000000..a063eb0d --- /dev/null +++ b/Fabric/src/main/java/at/petrak/hexcasting/fabric/recipe/FabricModConditionalIngredient.java @@ -0,0 +1,105 @@ +package at.petrak.hexcasting.fabric.recipe; + +import at.petrak.hexcasting.xplat.IXplatAbstractions; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import io.github.tropheusj.serialization_hooks.ingredient.BaseCustomIngredient; +import io.github.tropheusj.serialization_hooks.ingredient.IngredientDeserializer; +import net.minecraft.network.FriendlyByteBuf; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.item.crafting.Ingredient; +import org.jetbrains.annotations.NotNull; + +import javax.annotation.Nullable; +import java.util.Arrays; +import java.util.Objects; + +import static at.petrak.hexcasting.api.HexAPI.modLoc; + +public class FabricModConditionalIngredient extends BaseCustomIngredient { + public static final ResourceLocation ID = modLoc("mod_conditional"); + + private final Ingredient main; + private final String modid; + private final Ingredient ifModLoaded; + + private final Ingredient toUse; + + protected FabricModConditionalIngredient(Ingredient main, String modid, Ingredient ifModLoaded) { + super(IXplatAbstractions.INSTANCE.isModPresent(modid) ? Arrays.stream(ifModLoaded.values) : Arrays.stream(main.values)); + this.main = main; + this.modid = modid; + this.ifModLoaded = ifModLoaded; + + this.toUse = IXplatAbstractions.INSTANCE.isModPresent(modid) ? ifModLoaded : main; + } + + /** + * Creates a new ingredient matching the given stack + */ + public static FabricModConditionalIngredient of(Ingredient main, String modid, Ingredient ifModLoaded) { + return new FabricModConditionalIngredient(main, modid, ifModLoaded); + } + + @Override + public boolean test(@Nullable ItemStack input) { + return toUse.test(input); + } + + @Override + public @NotNull JsonElement toJson() { + JsonObject json = new JsonObject(); + json.addProperty("type", Objects.toString(ID)); + json.add("default", main.toJson()); + json.addProperty("modid", modid); + json.add("if_loaded", ifModLoaded.toJson()); + return json; + } + + @Override + public IngredientDeserializer getDeserializer() { + return Deserializer.INSTANCE; + } + + public static Ingredient fromNetwork(FriendlyByteBuf friendlyByteBuf) { + return Ingredient.fromNetwork(friendlyByteBuf); // Just send the actual ingredient + } + + public static Ingredient fromJson(JsonElement element) { + if (element == null || element.isJsonNull() || !element.isJsonObject()) + return null; + + JsonObject object = element.getAsJsonObject(); + + if (object.has("type") && object.getAsJsonPrimitive("type").getAsString().equals(ID.toString())) { + if (object.has("modid") && IXplatAbstractions.INSTANCE.isModPresent(object.getAsJsonPrimitive("modid").getAsString())) + return Ingredient.fromJson(object.get("if_loaded")); + else + return Ingredient.fromJson(object.get("default")); + } + + return null; + } + + @Override + public void toNetwork(@NotNull FriendlyByteBuf friendlyByteBuf) { + friendlyByteBuf.writeResourceLocation(ID); + toUse.toNetwork(friendlyByteBuf); + } + + public static class Deserializer implements IngredientDeserializer { + public static final Deserializer INSTANCE = new Deserializer(); + + @Override + public Ingredient fromNetwork(FriendlyByteBuf buffer) { + return FabricModConditionalIngredient.fromNetwork(buffer); + } + + @Nullable + @Override + public Ingredient fromJson(JsonObject object) { + return FabricModConditionalIngredient.fromJson(object); + } + } +} diff --git a/Fabric/src/main/java/at/petrak/hexcasting/fabric/recipe/FabricUnsealedIngredient.java b/Fabric/src/main/java/at/petrak/hexcasting/fabric/recipe/FabricUnsealedIngredient.java index 21704daa..2a55e0f0 100644 --- a/Fabric/src/main/java/at/petrak/hexcasting/fabric/recipe/FabricUnsealedIngredient.java +++ b/Fabric/src/main/java/at/petrak/hexcasting/fabric/recipe/FabricUnsealedIngredient.java @@ -26,7 +26,7 @@ import java.util.Objects; import static at.petrak.hexcasting.api.HexAPI.modLoc; public class FabricUnsealedIngredient extends BaseCustomIngredient { - private static final ResourceLocation ID = modLoc("unsealed"); + public static final ResourceLocation ID = modLoc("unsealed"); private final ItemStack stack; @@ -94,6 +94,7 @@ public class FabricUnsealedIngredient extends BaseCustomIngredient { @Override public void toNetwork(FriendlyByteBuf friendlyByteBuf) { + friendlyByteBuf.writeResourceLocation(ID); friendlyByteBuf.writeItem(stack); } diff --git a/Fabric/src/main/resources/fabricasting.accesswidener b/Fabric/src/main/resources/fabricasting.accesswidener index 19d32353..004416f8 100644 --- a/Fabric/src/main/resources/fabricasting.accesswidener +++ b/Fabric/src/main/resources/fabricasting.accesswidener @@ -3,6 +3,7 @@ extendable class net/minecraft/world/item/crafting/Ingredient accessible class net/minecraft/world/item/crafting/Ingredient$ItemValue accessible class net/minecraft/world/item/crafting/Ingredient$TagValue accessible class net/minecraft/world/item/crafting/Ingredient$Value +accessible field net/minecraft/world/item/crafting/Ingredient values [Lnet/minecraft/world/item/crafting/Ingredient$Value; accessible method net/minecraft/world/item/crafting/Ingredient$ItemValue (Lnet/minecraft/world/item/ItemStack;)V accessible method net/minecraft/world/item/crafting/Ingredient$TagValue (Lnet/minecraft/tags/TagKey;)V accessible method net/minecraft/world/item/crafting/Ingredient (Ljava/util/stream/Stream;)V diff --git a/Forge/src/generated/resources/.cache/cache b/Forge/src/generated/resources/.cache/cache index 17ee2a24..0df6f7df 100644 --- a/Forge/src/generated/resources/.cache/cache +++ b/Forge/src/generated/resources/.cache/cache @@ -1,5 +1,5 @@ -cfda8a0bb9051f9f876cd5b9afcd8a7f6a1e4290 data/create/recipes/crushing/amethyst_block.json -59e0c3893a64d84b5fde52291067b3601c43ffc9 data/create/recipes/crushing/amethyst_cluster.json +b7afb34e0e611ff567a25e46bcd8943fe7d352c0 data/create/recipes/crushing/amethyst_block.json +6c91ac492b7fa487095894963568113c5e0203a7 data/create/recipes/crushing/amethyst_cluster.json 4d4caaea035ae4ee878843dd2455042b299b4e5e data/forge/tags/items/dusts/amethyst.json 05e86742a71afd740f47639be62f93bc9898fcde data/forge/tags/items/gems.json cf0ad981bebbb79414d955fb40fbf537fe88b89d data/hexcasting/advancements/recipes/brainsweep/brainsweep/akashic_record.json @@ -156,11 +156,11 @@ d7f85ce9d46aacc7ec89dc7aa0f88a331ccfbae7 data/hexcasting/recipes/brainsweep/akas 5861845c3cd84021c7c19ac4f5b3bcc8e1bd3916 data/hexcasting/recipes/brainsweep/impetus_look.json ab5d271371323d93ff6eed18179ee4f7fd8c939c data/hexcasting/recipes/brainsweep/impetus_rightclick.json d5c6f9a31a8310ec440fc8c14da8988f0d166586 data/hexcasting/recipes/brainsweep/impetus_storedplayer.json -ad85e0162a7c68d431fd700700906ccbcadf91ce data/hexcasting/recipes/compat/create/crushing/amethyst_shard.json -27665eed65acfdb692027afe52588b30cec085ea data/hexcasting/recipes/compat/farmersdelight/cutting/akashic_door.json -1ed27f68186cb70984eeeae13365fc3c3149ebc3 data/hexcasting/recipes/compat/farmersdelight/cutting/akashic_log.json -4c842bb202b181cc861544a08a4ad53f399aaa30 data/hexcasting/recipes/compat/farmersdelight/cutting/akashic_trapdoor.json -e339675f24dd528d429a1386666d69fc8f23c426 data/hexcasting/recipes/compat/farmersdelight/cutting/akashic_wood.json +0d0067c9639ec00db605a24a9e098a43ada049c8 data/hexcasting/recipes/compat/create/crushing/amethyst_shard.json +6bb3d3093004c4a5671702768d6f4553a35f2fe0 data/hexcasting/recipes/compat/farmersdelight/cutting/akashic_door.json +3975a2c4ababae89dcd087028be1fadb3831e882 data/hexcasting/recipes/compat/farmersdelight/cutting/akashic_log.json +b60ebb134e23687de8d909f02b629559b904135b data/hexcasting/recipes/compat/farmersdelight/cutting/akashic_trapdoor.json +4df73af5a14a33fbbc087090e25fd33702c392a5 data/hexcasting/recipes/compat/farmersdelight/cutting/akashic_wood.json bc140b6c5d999b4bc5d12c302297f56bde3b161c data/hexcasting/recipes/cypher.json 8c22db477365a800ce1e715aeaad896550467047 data/hexcasting/recipes/dye_colorizer_black.json c64f5e56ca18eb68d2e58827920ca0e3ae4617ca data/hexcasting/recipes/dye_colorizer_blue.json @@ -198,7 +198,7 @@ d3ad9a9e92dd125f872d9671930d4e57f24894ed data/hexcasting/recipes/pride_colorizer ac128e72adda8fea0ad63d7e6e18dd9399f53d65 data/hexcasting/recipes/pride_colorizer_intersex.json 1d558c1b63dd3c3e129261f53db5fd6748b59051 data/hexcasting/recipes/pride_colorizer_lesbian.json cd7e618d7c08ffff67683852f799362fb8aaebaf data/hexcasting/recipes/pride_colorizer_nonbinary.json -568ac8a13b7762b92cc274d74a7c729cc6e16687 data/hexcasting/recipes/pride_colorizer_pansexual.json +39ef3ab2effbae595b45400e7db7a8ad693e0d13 data/hexcasting/recipes/pride_colorizer_pansexual.json b2d8fb979a3fbe47404da349318f38ab45bac760 data/hexcasting/recipes/pride_colorizer_plural.json f50c71bbbbf7d77665c9008fcdd9be0d571ce48e data/hexcasting/recipes/pride_colorizer_transgender.json 49508c455626eeca18c957edc0cde016e823f7b0 data/hexcasting/recipes/scroll.json diff --git a/Forge/src/generated/resources/data/create/recipes/crushing/amethyst_block.json b/Forge/src/generated/resources/data/create/recipes/crushing/amethyst_block.json index d162220c..7fde51bf 100644 --- a/Forge/src/generated/resources/data/create/recipes/crushing/amethyst_block.json +++ b/Forge/src/generated/resources/data/create/recipes/crushing/amethyst_block.json @@ -1,20 +1,33 @@ { - "type": "create:crushing", - "ingredients": [ + "type": "forge:conditional", + "recipes": [ { - "item": "minecraft:amethyst_block" + "conditions": [ + { + "modid": "create", + "type": "forge:mod_loaded" + } + ], + "recipe": { + "type": "create:crushing", + "ingredients": [ + { + "item": "minecraft:amethyst_block" + } + ], + "results": [ + { + "item": "minecraft:amethyst_shard", + "count": 3 + }, + { + "item": "hexcasting:amethyst_dust", + "count": 4, + "chance": 0.5 + } + ], + "processingTime": 150 + } } - ], - "results": [ - { - "item": "minecraft:amethyst_shard", - "count": 3 - }, - { - "item": "hexcasting:amethyst_dust", - "count": 4, - "chance": 0.5 - } - ], - "processingTime": 150 + ] } \ No newline at end of file diff --git a/Forge/src/generated/resources/data/create/recipes/crushing/amethyst_cluster.json b/Forge/src/generated/resources/data/create/recipes/crushing/amethyst_cluster.json index f326bf4a..9f41e187 100644 --- a/Forge/src/generated/resources/data/create/recipes/crushing/amethyst_cluster.json +++ b/Forge/src/generated/resources/data/create/recipes/crushing/amethyst_cluster.json @@ -1,23 +1,36 @@ { - "type": "create:crushing", - "ingredients": [ + "type": "forge:conditional", + "recipes": [ { - "item": "minecraft:amethyst_cluster" + "conditions": [ + { + "modid": "create", + "type": "forge:mod_loaded" + } + ], + "recipe": { + "type": "create:crushing", + "ingredients": [ + { + "item": "minecraft:amethyst_cluster" + } + ], + "results": [ + { + "item": "minecraft:amethyst_shard", + "count": 7 + }, + { + "item": "hexcasting:amethyst_dust", + "count": 5 + }, + { + "item": "hexcasting:charged_amethyst", + "chance": 0.25 + } + ], + "processingTime": 150 + } } - ], - "results": [ - { - "item": "minecraft:amethyst_shard", - "count": 7 - }, - { - "item": "hexcasting:amethyst_dust", - "count": 5 - }, - { - "item": "hexcasting:charged_amethyst", - "chance": 0.25 - } - ], - "processingTime": 150 + ] } \ No newline at end of file diff --git a/Forge/src/generated/resources/data/hexcasting/recipes/compat/create/crushing/amethyst_shard.json b/Forge/src/generated/resources/data/hexcasting/recipes/compat/create/crushing/amethyst_shard.json index ffa35cc3..028cefb8 100644 --- a/Forge/src/generated/resources/data/hexcasting/recipes/compat/create/crushing/amethyst_shard.json +++ b/Forge/src/generated/resources/data/hexcasting/recipes/compat/create/crushing/amethyst_shard.json @@ -1,19 +1,32 @@ { - "type": "create:crushing", - "ingredients": [ + "type": "forge:conditional", + "recipes": [ { - "item": "minecraft:amethyst_shard" + "conditions": [ + { + "modid": "create", + "type": "forge:mod_loaded" + } + ], + "recipe": { + "type": "create:crushing", + "ingredients": [ + { + "item": "minecraft:amethyst_shard" + } + ], + "results": [ + { + "item": "hexcasting:amethyst_dust", + "count": 4 + }, + { + "item": "hexcasting:amethyst_dust", + "chance": 0.5 + } + ], + "processingTime": 150 + } } - ], - "results": [ - { - "item": "hexcasting:amethyst_dust", - "count": 4 - }, - { - "item": "hexcasting:amethyst_dust", - "chance": 0.5 - } - ], - "processingTime": 150 + ] } \ No newline at end of file diff --git a/Forge/src/generated/resources/data/hexcasting/recipes/compat/farmersdelight/cutting/akashic_door.json b/Forge/src/generated/resources/data/hexcasting/recipes/compat/farmersdelight/cutting/akashic_door.json index 296c6338..034ea1d8 100644 --- a/Forge/src/generated/resources/data/hexcasting/recipes/compat/farmersdelight/cutting/akashic_door.json +++ b/Forge/src/generated/resources/data/hexcasting/recipes/compat/farmersdelight/cutting/akashic_door.json @@ -1,17 +1,30 @@ { - "type": "farmersdelight:cutting", - "ingredients": [ + "type": "forge:conditional", + "recipes": [ { - "item": "hexcasting:akashic_door" - } - ], - "tool": { - "type": "farmersdelight:tool_action", - "action": "axe_dig" - }, - "result": [ - { - "item": "hexcasting:akashic_planks" + "conditions": [ + { + "modid": "farmersdelight", + "type": "forge:mod_loaded" + } + ], + "recipe": { + "type": "farmersdelight:cutting", + "ingredients": [ + { + "item": "hexcasting:akashic_door" + } + ], + "tool": { + "type": "farmersdelight:tool_action", + "action": "axe_dig" + }, + "result": [ + { + "item": "hexcasting:akashic_planks" + } + ] + } } ] } \ No newline at end of file diff --git a/Forge/src/generated/resources/data/hexcasting/recipes/compat/farmersdelight/cutting/akashic_log.json b/Forge/src/generated/resources/data/hexcasting/recipes/compat/farmersdelight/cutting/akashic_log.json index eb1a75d3..35d3172e 100644 --- a/Forge/src/generated/resources/data/hexcasting/recipes/compat/farmersdelight/cutting/akashic_log.json +++ b/Forge/src/generated/resources/data/hexcasting/recipes/compat/farmersdelight/cutting/akashic_log.json @@ -1,21 +1,34 @@ { - "type": "farmersdelight:cutting", - "ingredients": [ + "type": "forge:conditional", + "recipes": [ { - "item": "hexcasting:akashic_log" + "conditions": [ + { + "modid": "farmersdelight", + "type": "forge:mod_loaded" + } + ], + "recipe": { + "type": "farmersdelight:cutting", + "ingredients": [ + { + "item": "hexcasting:akashic_log" + } + ], + "tool": { + "type": "farmersdelight:tool_action", + "action": "axe_strip" + }, + "result": [ + { + "item": "hexcasting:akashic_log_stripped" + }, + { + "item": "farmersdelight:tree_bark" + } + ], + "sound": "minecraft:item.axe.strip" + } } - ], - "tool": { - "type": "farmersdelight:tool_action", - "action": "axe_strip" - }, - "result": [ - { - "item": "hexcasting:akashic_log_stripped" - }, - { - "item": "farmersdelight:tree_bark" - } - ], - "sound": "minecraft:item.axe.strip" + ] } \ No newline at end of file diff --git a/Forge/src/generated/resources/data/hexcasting/recipes/compat/farmersdelight/cutting/akashic_trapdoor.json b/Forge/src/generated/resources/data/hexcasting/recipes/compat/farmersdelight/cutting/akashic_trapdoor.json index 86da1e84..ff10f76c 100644 --- a/Forge/src/generated/resources/data/hexcasting/recipes/compat/farmersdelight/cutting/akashic_trapdoor.json +++ b/Forge/src/generated/resources/data/hexcasting/recipes/compat/farmersdelight/cutting/akashic_trapdoor.json @@ -1,17 +1,30 @@ { - "type": "farmersdelight:cutting", - "ingredients": [ + "type": "forge:conditional", + "recipes": [ { - "item": "hexcasting:akashic_trapdoor" - } - ], - "tool": { - "type": "farmersdelight:tool_action", - "action": "axe_dig" - }, - "result": [ - { - "item": "hexcasting:akashic_planks" + "conditions": [ + { + "modid": "farmersdelight", + "type": "forge:mod_loaded" + } + ], + "recipe": { + "type": "farmersdelight:cutting", + "ingredients": [ + { + "item": "hexcasting:akashic_trapdoor" + } + ], + "tool": { + "type": "farmersdelight:tool_action", + "action": "axe_dig" + }, + "result": [ + { + "item": "hexcasting:akashic_planks" + } + ] + } } ] } \ No newline at end of file diff --git a/Forge/src/generated/resources/data/hexcasting/recipes/compat/farmersdelight/cutting/akashic_wood.json b/Forge/src/generated/resources/data/hexcasting/recipes/compat/farmersdelight/cutting/akashic_wood.json index ce7beb5c..af981c0e 100644 --- a/Forge/src/generated/resources/data/hexcasting/recipes/compat/farmersdelight/cutting/akashic_wood.json +++ b/Forge/src/generated/resources/data/hexcasting/recipes/compat/farmersdelight/cutting/akashic_wood.json @@ -1,21 +1,34 @@ { - "type": "farmersdelight:cutting", - "ingredients": [ + "type": "forge:conditional", + "recipes": [ { - "item": "hexcasting:akashic_wood" + "conditions": [ + { + "modid": "farmersdelight", + "type": "forge:mod_loaded" + } + ], + "recipe": { + "type": "farmersdelight:cutting", + "ingredients": [ + { + "item": "hexcasting:akashic_wood" + } + ], + "tool": { + "type": "farmersdelight:tool_action", + "action": "axe_strip" + }, + "result": [ + { + "item": "hexcasting:akashic_wood_stripped" + }, + { + "item": "farmersdelight:tree_bark" + } + ], + "sound": "minecraft:item.axe.strip" + } } - ], - "tool": { - "type": "farmersdelight:tool_action", - "action": "axe_strip" - }, - "result": [ - { - "item": "hexcasting:akashic_wood_stripped" - }, - { - "item": "farmersdelight:tree_bark" - } - ], - "sound": "minecraft:item.axe.strip" + ] } \ No newline at end of file diff --git a/Forge/src/generated/resources/data/hexcasting/recipes/pride_colorizer_pansexual.json b/Forge/src/generated/resources/data/hexcasting/recipes/pride_colorizer_pansexual.json index ec18619d..cfac72f2 100644 --- a/Forge/src/generated/resources/data/hexcasting/recipes/pride_colorizer_pansexual.json +++ b/Forge/src/generated/resources/data/hexcasting/recipes/pride_colorizer_pansexual.json @@ -10,7 +10,14 @@ "item": "hexcasting:amethyst_dust" }, "C": { - "item": "minecraft:carrot" + "type": "hexcasting:mod_conditional", + "default": { + "item": "minecraft:carrot" + }, + "modid": "farmersdelight", + "if_loaded": { + "item": "farmersdelight:skillet" + } } }, "result": { 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 ef1fc043..648999dd 100644 --- a/Forge/src/main/java/at/petrak/hexcasting/forge/ForgeHexInitializer.java +++ b/Forge/src/main/java/at/petrak/hexcasting/forge/ForgeHexInitializer.java @@ -25,6 +25,7 @@ import at.petrak.hexcasting.forge.interop.curios.CuriosApiInterop; import at.petrak.hexcasting.forge.interop.curios.CuriosRenderers; import at.petrak.hexcasting.forge.network.ForgePacketHandler; import at.petrak.hexcasting.forge.network.MsgBrainsweepAck; +import at.petrak.hexcasting.forge.recipe.ForgeModConditionalIngredient; import at.petrak.hexcasting.forge.recipe.ForgeUnsealedIngredient; import at.petrak.hexcasting.interop.HexInterop; import at.petrak.hexcasting.xplat.IXplatAbstractions; @@ -71,8 +72,6 @@ import thedarkcolour.kotlinforforge.KotlinModLoadingContext; import java.util.function.BiConsumer; import java.util.function.Consumer; -import static at.petrak.hexcasting.api.HexAPI.modLoc; - @Mod(HexAPI.MOD_ID) public class ForgeHexInitializer { public ForgeHexInitializer() { @@ -144,7 +143,8 @@ public class ForgeHexInitializer { // We have to do these at some point when the registries are still open modBus.addGenericListener(Item.class, (RegistryEvent evt) -> { HexRecipeSerializers.registerTypes(); - CraftingHelper.register(modLoc("unsealed"), ForgeUnsealedIngredient.Serializer.INSTANCE); + 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)); diff --git a/Forge/src/main/java/at/petrak/hexcasting/forge/datagen/HexForgeConditionsBuilder.java b/Forge/src/main/java/at/petrak/hexcasting/forge/datagen/HexForgeConditionsBuilder.java new file mode 100644 index 00000000..8521b99d --- /dev/null +++ b/Forge/src/main/java/at/petrak/hexcasting/forge/datagen/HexForgeConditionsBuilder.java @@ -0,0 +1,63 @@ +package at.petrak.hexcasting.forge.datagen; + +import at.petrak.hexcasting.datagen.IXplatConditionsBuilder; +import net.minecraft.advancements.CriterionTriggerInstance; +import net.minecraft.data.recipes.FinishedRecipe; +import net.minecraft.data.recipes.RecipeBuilder; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.world.item.Item; +import net.minecraftforge.common.crafting.ConditionalRecipe; +import net.minecraftforge.common.crafting.conditions.ICondition; +import net.minecraftforge.common.crafting.conditions.IConditionBuilder; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; + +import java.util.ArrayList; +import java.util.List; +import java.util.function.Consumer; + +public class HexForgeConditionsBuilder implements IXplatConditionsBuilder, IConditionBuilder { + private final List conditions = new ArrayList<>(); + private final RecipeBuilder parent; + + public HexForgeConditionsBuilder(RecipeBuilder parent) { + this.parent = parent; + } + + @Override + public IXplatConditionsBuilder whenModLoaded(String modid) { + conditions.add(modLoaded(modid)); + return this; + } + + @Override + public IXplatConditionsBuilder whenModMissing(String modid) { + conditions.add(not(modLoaded(modid))); + return this; + } + + @Override + public @NotNull RecipeBuilder unlockedBy(@NotNull String string, @NotNull CriterionTriggerInstance criterionTriggerInstance) { + return parent.unlockedBy(string, criterionTriggerInstance); + } + + @Override + public @NotNull RecipeBuilder group(@Nullable String string) { + return parent.group(string); + } + + @Override + public @NotNull Item getResult() { + return parent.getResult(); + } + + @Override + public void save(@NotNull Consumer consumer, @NotNull ResourceLocation resourceLocation) { + var conditionalBuilder = ConditionalRecipe.builder(); + for (ICondition condition : conditions) { + conditionalBuilder.addCondition(condition); + } + conditionalBuilder.addRecipe(recipeConsumer -> parent.save(recipeConsumer, resourceLocation)) + .build(consumer, resourceLocation); + } +} 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 b0de4f11..50b5fa10 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 @@ -4,9 +4,9 @@ import at.petrak.hexcasting.api.HexAPI; import at.petrak.hexcasting.datagen.*; import at.petrak.hexcasting.datagen.recipe.HexplatRecipes; import at.petrak.hexcasting.datagen.recipe.builders.ToolIngredient; -import at.petrak.hexcasting.forge.datagen.builders.ForgeCreateCrushingRecipeBuilder; import at.petrak.hexcasting.forge.datagen.xplat.HexBlockStatesAndModels; import at.petrak.hexcasting.forge.datagen.xplat.HexItemModels; +import at.petrak.hexcasting.forge.recipe.ForgeModConditionalIngredient; import at.petrak.hexcasting.xplat.IXplatAbstractions; import at.petrak.paucal.api.forge.datagen.PaucalForgeDatagenWrappers; import com.google.gson.JsonObject; @@ -58,7 +58,7 @@ public class HexForgeDataGenerators { ExistingFileHelper efh = ev.getExistingFileHelper(); if (ev.includeServer()) { gen.addProvider(new HexLootTables(gen)); - gen.addProvider(new HexplatRecipes(gen, INGREDIENTS, ForgeCreateCrushingRecipeBuilder::new)); + gen.addProvider(new HexplatRecipes(gen, INGREDIENTS, HexForgeConditionsBuilder::new)); var xtags = IXplatAbstractions.INSTANCE.tags(); var blockTagProvider = PaucalForgeDatagenWrappers.addEFHToTagProvider( @@ -70,7 +70,7 @@ public class HexForgeDataGenerators { } } - private static IXplatIngredients INGREDIENTS = new IXplatIngredients() { + private static final IXplatIngredients INGREDIENTS = new IXplatIngredients() { @Override public Ingredient glowstoneDust() { return Ingredient.of(Tags.Items.DUSTS_GLOWSTONE); @@ -123,6 +123,11 @@ public class HexForgeDataGenerators { )); } + @Override + public Ingredient whenModIngredient(Ingredient defaultIngredient, String modid, Ingredient modIngredient) { + return ForgeModConditionalIngredient.of(defaultIngredient, modid, modIngredient); + } + @Override public ToolIngredient axeStrip() { return () -> { diff --git a/Forge/src/main/java/at/petrak/hexcasting/forge/datagen/builders/ForgeCreateCrushingRecipeBuilder.java b/Forge/src/main/java/at/petrak/hexcasting/forge/datagen/builders/ForgeCreateCrushingRecipeBuilder.java deleted file mode 100644 index 57fbf30e..00000000 --- a/Forge/src/main/java/at/petrak/hexcasting/forge/datagen/builders/ForgeCreateCrushingRecipeBuilder.java +++ /dev/null @@ -1,40 +0,0 @@ -package at.petrak.hexcasting.forge.datagen.builders; - -import at.petrak.hexcasting.datagen.recipe.builders.CreateCrushingRecipeBuilder; -import com.google.gson.JsonArray; -import com.google.gson.JsonObject; -import net.minecraftforge.common.crafting.CraftingHelper; -import net.minecraftforge.common.crafting.conditions.ICondition; -import net.minecraftforge.common.crafting.conditions.ModLoadedCondition; -import net.minecraftforge.common.crafting.conditions.NotCondition; - -import java.util.ArrayList; -import java.util.List; - -public class ForgeCreateCrushingRecipeBuilder extends CreateCrushingRecipeBuilder { - private final List conditions = new ArrayList<>(); - - @Override - public ForgeCreateCrushingRecipeBuilder whenModLoaded(String modid) { - return withCondition(new ModLoadedCondition(modid)); - } - - @Override - public ForgeCreateCrushingRecipeBuilder whenModMissing(String modid) { - return withCondition(new NotCondition(new ModLoadedCondition(modid))); - } - - public ForgeCreateCrushingRecipeBuilder withCondition(ICondition condition) { - conditions.add(condition); - return this; - } - - @Override - public void serializeConditions(JsonObject object) { - if (!conditions.isEmpty()) { - JsonArray conds = new JsonArray(); - conditions.forEach(c -> conds.add(CraftingHelper.serialize(c))); - object.add("conditions", conds); - } - } -} diff --git a/Forge/src/main/java/at/petrak/hexcasting/forge/recipe/ForgeModConditionalIngredient.java b/Forge/src/main/java/at/petrak/hexcasting/forge/recipe/ForgeModConditionalIngredient.java new file mode 100644 index 00000000..ebd81652 --- /dev/null +++ b/Forge/src/main/java/at/petrak/hexcasting/forge/recipe/ForgeModConditionalIngredient.java @@ -0,0 +1,105 @@ +package at.petrak.hexcasting.forge.recipe; + +import at.petrak.hexcasting.xplat.IXplatAbstractions; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import net.minecraft.network.FriendlyByteBuf; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.item.crafting.Ingredient; +import net.minecraftforge.common.crafting.AbstractIngredient; +import net.minecraftforge.common.crafting.IIngredientSerializer; +import org.jetbrains.annotations.NotNull; + +import javax.annotation.Nullable; +import java.util.Arrays; +import java.util.Objects; + +import static at.petrak.hexcasting.api.HexAPI.modLoc; + +public class ForgeModConditionalIngredient extends AbstractIngredient { + public static final ResourceLocation ID = modLoc("mod_conditional"); + + private final Ingredient main; + private final String modid; + private final Ingredient ifModLoaded; + + private final Ingredient toUse; + + protected ForgeModConditionalIngredient(Ingredient main, String modid, Ingredient ifModLoaded) { + super(IXplatAbstractions.INSTANCE.isModPresent(modid) ? Arrays.stream(ifModLoaded.values) : Arrays.stream(main.values)); + this.main = main; + this.modid = modid; + this.ifModLoaded = ifModLoaded; + + this.toUse = IXplatAbstractions.INSTANCE.isModPresent(modid) ? ifModLoaded : main; + } + + /** + * Creates a new ingredient matching the given stack + */ + public static ForgeModConditionalIngredient of(Ingredient main, String modid, Ingredient ifModLoaded) { + return new ForgeModConditionalIngredient(main, modid, ifModLoaded); + } + + @Override + public boolean test(@Nullable ItemStack input) { + return toUse.test(input); + } + + @Override + public boolean isSimple() { + return toUse.isSimple(); + } + + @Override + public @NotNull JsonElement toJson() { + JsonObject json = new JsonObject(); + json.addProperty("type", Objects.toString(ID)); + json.add("default", main.toJson()); + json.addProperty("modid", modid); + json.add("if_loaded", ifModLoaded.toJson()); + return json; + } + + @Override + public @NotNull IIngredientSerializer getSerializer() { + return Serializer.INSTANCE; + } + + public static @NotNull Ingredient fromNetwork(FriendlyByteBuf friendlyByteBuf) { + return Ingredient.fromNetwork(friendlyByteBuf); // Just send the actual ingredient + } + + public static Ingredient fromJson(JsonObject object) { + if (object.has("type") && object.getAsJsonPrimitive("type").getAsString().equals(ID.toString())) { + if (object.has("modid") && IXplatAbstractions.INSTANCE.isModPresent(object.getAsJsonPrimitive("modid").getAsString())) + return Ingredient.fromJson(object.get("if_loaded")); + else + return Ingredient.fromJson(object.get("default")); + } + + return Ingredient.of(); + } + + public static class Serializer implements IIngredientSerializer { + public static final Serializer INSTANCE = new Serializer(); + + @Override + public @NotNull Ingredient parse(@NotNull FriendlyByteBuf buffer) { + return fromNetwork(buffer); + } + + @Override + public @NotNull Ingredient parse(@NotNull JsonObject json) { + return fromJson(json); + } + + @Override + public void write(@NotNull FriendlyByteBuf buffer, @NotNull Ingredient ingredient) { + if (ingredient instanceof ForgeModConditionalIngredient conditionalIngredient) + conditionalIngredient.toUse.toNetwork(buffer); + // It shouldn't be possible to not be a ForgeModConditionalIngredient here + } + } +} 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 ec83826d..e8bf7587 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 @@ -10,6 +10,7 @@ import at.petrak.hexcasting.xplat.IXplatAbstractions; import com.google.gson.JsonElement; import com.google.gson.JsonObject; import net.minecraft.network.FriendlyByteBuf; +import net.minecraft.resources.ResourceLocation; import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.crafting.Ingredient; import net.minecraftforge.common.crafting.AbstractIngredient; @@ -22,7 +23,11 @@ import javax.annotation.Nullable; import java.util.Arrays; import java.util.Objects; +import static at.petrak.hexcasting.api.HexAPI.modLoc; + public class ForgeUnsealedIngredient extends AbstractIngredient { + public static final ResourceLocation ID = modLoc("unsealed"); + private final ItemStack stack; protected ForgeUnsealedIngredient(ItemStack stack) { diff --git a/Forge/src/main/resources/META-INF/accesstransformer.cfg b/Forge/src/main/resources/META-INF/accesstransformer.cfg index 523d6dd0..0004e92f 100644 --- a/Forge/src/main/resources/META-INF/accesstransformer.cfg +++ b/Forge/src/main/resources/META-INF/accesstransformer.cfg @@ -1,2 +1,4 @@ public net.minecraft.client.renderer.RenderType$CompositeRenderType public net.minecraft.client.renderer.RenderType$CompositeState f_110576_ # textureState +public net.minecraft.world.item.crafting.Ingredient (Ljava/util/stream/Stream;)V +public net.minecraft.world.item.crafting.Ingredient f_43902_ # values From f281d4d5611236fe9b1a8b8eb95bbe486fe7a6cf Mon Sep 17 00:00:00 2001 From: "yrsegal@gmail.com" Date: Sat, 6 Aug 2022 11:00:52 -0400 Subject: [PATCH 037/117] fix #211 --- .../at/petrak/hexcasting/client/entity/WallScrollRenderer.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Common/src/main/java/at/petrak/hexcasting/client/entity/WallScrollRenderer.java b/Common/src/main/java/at/petrak/hexcasting/client/entity/WallScrollRenderer.java index e5d8dfc3..a470185a 100644 --- a/Common/src/main/java/at/petrak/hexcasting/client/entity/WallScrollRenderer.java +++ b/Common/src/main/java/at/petrak/hexcasting/client/entity/WallScrollRenderer.java @@ -125,7 +125,7 @@ public class WallScrollRenderer extends EntityRenderer { if (wallScroll.getShowsStrokeOrder()) { var spotFrac = 0.8f * wallScroll.blockSize; - var animTime = wallScroll.tickCount; + var animTime = wallScroll.tickCount + partialTicks; var pointCircuit = (animTime * HexConfig.client().patternPointSpeedMultiplier()) % (points.size() + 10); if (pointCircuit < points.size() - 1) { From d83c7accc7e7aba82e730927ff56dde2ee88ae6a Mon Sep 17 00:00:00 2001 From: "yrsegal@gmail.com" Date: Sat, 6 Aug 2022 11:11:23 -0400 Subject: [PATCH 038/117] fix #210 --- .../at/petrak/hexcasting/common/lib/HexItems.java | 2 +- .../hexcasting/forge/interop/jei/HexJEIPlugin.java | 11 +++++++++++ 2 files changed, 12 insertions(+), 1 deletion(-) 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 6e068812..ae960fed 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 @@ -65,7 +65,7 @@ public class HexItems { public static final ItemSlate SLATE = make("slate", new ItemSlate(HexBlocks.SLATE, props())); public static final ItemManaBattery BATTERY = make("battery", - new ItemManaBattery(new Item.Properties().stacksTo(1))); + new ItemManaBattery(unstackable())); public static final EnumMap DYE_COLORIZERS = Util.make(() -> { var out = new EnumMap(DyeColor.class); 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 0bc3a65b..6fd814d9 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 @@ -6,10 +6,12 @@ import at.petrak.hexcasting.common.recipe.BrainsweepRecipe; import at.petrak.hexcasting.common.recipe.HexRecipeSerializers; import mezz.jei.api.IModPlugin; import mezz.jei.api.JeiPlugin; +import mezz.jei.api.ingredients.subtypes.IIngredientSubtypeInterpreter; import mezz.jei.api.recipe.RecipeType; import mezz.jei.api.registration.IRecipeCatalystRegistration; import mezz.jei.api.registration.IRecipeCategoryRegistration; import mezz.jei.api.registration.IRecipeRegistration; +import mezz.jei.api.registration.ISubtypeRegistration; import net.minecraft.client.Minecraft; import net.minecraft.resources.ResourceLocation; import net.minecraft.world.item.ItemStack; @@ -31,6 +33,15 @@ public class HexJEIPlugin implements IModPlugin { return UID; } + @Override + public void registerItemSubtypes(@NotNull ISubtypeRegistration registration) { + registration.registerSubtypeInterpreter(HexItems.BATTERY, (itemStack, ctx) -> { + if (!itemStack.hasTag()) { + return IIngredientSubtypeInterpreter.NONE; + } + return String.valueOf(HexItems.BATTERY.getMaxMana(itemStack)); + }); + } @Override public void registerCategories(IRecipeCategoryRegistration registration) { From 958db00b151502c74520cd521722653795fb547f Mon Sep 17 00:00:00 2001 From: "yrsegal@gmail.com" Date: Sat, 6 Aug 2022 11:34:33 -0400 Subject: [PATCH 039/117] close #201 --- .../client/RegisterClientStuff.java | 127 +++++++++++++++++- 1 file changed, 126 insertions(+), 1 deletion(-) 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 855600f0..06a5e29c 100644 --- a/Common/src/main/java/at/petrak/hexcasting/client/RegisterClientStuff.java +++ b/Common/src/main/java/at/petrak/hexcasting/client/RegisterClientStuff.java @@ -31,6 +31,7 @@ import com.mojang.datafixers.util.Pair; import net.minecraft.ChatFormatting; 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.Style; import net.minecraft.network.chat.TextColor; @@ -40,11 +41,14 @@ import net.minecraft.util.Mth; 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.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; @@ -184,6 +188,15 @@ public class RegisterClientStuff { .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), + new TextComponent(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), @@ -237,7 +250,11 @@ public class RegisterClientStuff { } private static UnaryOperator @@ -203,6 +221,8 @@ const dotRadius = scale * +getProp("--dot-scale"); const movDotRadius = scale * +getProp("--moving-dot-scale"); const pauseScale = scale * +getProp("--pausetext-scale"); + const bodyBg = scale * +getProp("--pausetext-scale"); + const darkMode = +getProp("--dark-mode"); if (!perWorld) { @@ -259,7 +279,7 @@ context.fill(); } if (fadeColor) { - context.fillStyle = `rgba(255, 255, 255, ${fadeColor})`; + context.fillStyle = darkMode ? `rgba(32, 26, 32, ${fadeColor})` : `rgba(255, 255, 255, ${fadeColor})`; context.fillRect(0, 0, canvas.width, canvas.height); } if (scrollTimeout <= 2000) { From 473a5a9834bd39c1ef83b7f87416efab8ca0eba8 Mon Sep 17 00:00:00 2001 From: Alwinfy <20421383+Alwinfy@users.noreply.github.com> Date: Fri, 19 Aug 2022 11:22:58 -0400 Subject: [PATCH 069/117] Fix hardcode hack with another hack --- doc/template.html | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/doc/template.html b/doc/template.html index 0b432fdf..b94b235c 100644 --- a/doc/template.html +++ b/doc/template.html @@ -129,6 +129,17 @@ const speeds = [0, 0.25, 0.5, 1, 2, 4]; const scrollThreshold = 100; const rfaQueue = []; + const colorCache = new Map(); + function getColorRGB(ctx, str) { + if (!colorCache.has(str)) { + ctx.fillStyle = str; + ctx.clearRect(0, 0, 1, 1); + ctx.fillRect(0, 0, 1, 1); + const imgData = ctx.getImageData(0, 0, 1, 1); + colorCache.set(str, imgData.data); + } + return colorCache.get(str); + } function startAngle(str) { switch (str) { case "east": return 0; @@ -223,6 +234,7 @@ const pauseScale = scale * +getProp("--pausetext-scale"); const bodyBg = scale * +getProp("--pausetext-scale"); const darkMode = +getProp("--dark-mode"); + const bgColors = getColorRGB(context, getComputedStyle(document.body).backgroundColor); if (!perWorld) { @@ -279,7 +291,7 @@ context.fill(); } if (fadeColor) { - context.fillStyle = darkMode ? `rgba(32, 26, 32, ${fadeColor})` : `rgba(255, 255, 255, ${fadeColor})`; + context.fillStyle = `rgba(${bgColors[0]}, ${bgColors[1]}, ${bgColors[2]}, ${fadeColor})`; context.fillRect(0, 0, canvas.width, canvas.height); } if (scrollTimeout <= 2000) { From ed2abee735eb25dd0d1a3811d6ae197c28972792 Mon Sep 17 00:00:00 2001 From: "yrsegal@gmail.com" Date: Mon, 22 Aug 2022 22:28:55 -0400 Subject: [PATCH 070/117] fix double-use of getHeldItemToOperateOn --- .../api/spell/casting/CastingContext.kt | 6 +++--- .../common/casting/operators/OpWrite.kt | 14 ++++---------- .../casting/operators/spells/OpBreakBlock.kt | 11 +++++------ .../casting/operators/spells/OpColorize.kt | 18 ++++++++---------- .../casting/operators/spells/OpDestroyWater.kt | 2 -- .../common/casting/operators/spells/OpErase.kt | 16 +++++----------- .../casting/operators/spells/OpMakeBattery.kt | 14 +++++--------- .../operators/spells/OpMakePackagedSpell.kt | 15 +++++---------- .../casting/operators/spells/OpPlaceBlock.kt | 14 ++++---------- .../casting/operators/spells/OpRecharge.kt | 11 ++++------- .../operators/spells/great/OpBrainsweep.kt | 11 +++++++---- .../operators/spells/great/OpTeleport.kt | 2 +- 12 files changed, 51 insertions(+), 83 deletions(-) diff --git a/Common/src/main/java/at/petrak/hexcasting/api/spell/casting/CastingContext.kt b/Common/src/main/java/at/petrak/hexcasting/api/spell/casting/CastingContext.kt index 0e0866bd..58c8003f 100644 --- a/Common/src/main/java/at/petrak/hexcasting/api/spell/casting/CastingContext.kt +++ b/Common/src/main/java/at/petrak/hexcasting/api/spell/casting/CastingContext.kt @@ -14,8 +14,8 @@ 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.item.ItemEntity import net.minecraft.world.entity.player.Player -import net.minecraft.world.item.Item import net.minecraft.world.item.ItemStack import net.minecraft.world.level.GameType import net.minecraft.world.phys.Vec3 @@ -150,14 +150,14 @@ data class CastingContext( * Return whether the withdrawal was successful. */ // https://github.com/VazkiiMods/Psi/blob/master/src/main/java/vazkii/psi/common/spell/trick/block/PieceTrickPlaceBlock.java#L143 - fun withdrawItem(item: Item, count: Int, actuallyRemove: Boolean): Boolean { + fun withdrawItem(item: ItemStack, count: Int, actuallyRemove: Boolean): Boolean { if (this.caster.isCreative) return true // TODO: withdraw from ender chest given a specific ender charm? val stacksToExamine = DiscoveryHandlers.collectItemSlots(this) fun matches(stack: ItemStack): Boolean = - !stack.isEmpty && stack.`is`(item) + !stack.isEmpty && ItemEntity.areMergable(stack, item) val presentCount = stacksToExamine.fold(0) { acc, stack -> acc + if (matches(stack)) stack.count else 0 diff --git a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/OpWrite.kt b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/OpWrite.kt index c91c318c..daf6c8de 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/OpWrite.kt +++ b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/OpWrite.kt @@ -1,5 +1,6 @@ package at.petrak.hexcasting.common.casting.operators +import at.petrak.hexcasting.api.addldata.DataHolder import at.petrak.hexcasting.api.spell.ParticleSpray import at.petrak.hexcasting.api.spell.RenderedSpell import at.petrak.hexcasting.api.spell.SpellDatum @@ -35,22 +36,15 @@ object OpWrite : SpellOperator { throw MishapOthersName(trueName) return Triple( - Spell(datum), + Spell(datum, datumHolder), 0, listOf() ) } - private data class Spell(val datum: SpellDatum<*>) : RenderedSpell { + private data class Spell(val datum: SpellDatum<*>, val datumHolder: DataHolder) : RenderedSpell { override fun cast(ctx: CastingContext) { - val (handStack) = ctx.getHeldItemToOperateOn { - val datumHolder = IXplatAbstractions.INSTANCE.findDataHolder(it) - - datumHolder != null && datumHolder.writeDatum(datum, true) - } - - val datumHolder = IXplatAbstractions.INSTANCE.findDataHolder(handStack) - datumHolder?.writeDatum(datum, false) + datumHolder.writeDatum(datum, false) } } } 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 8b4e4606..1ebaa9fa 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 @@ -15,22 +15,21 @@ object OpBreakBlock : SpellOperator { override fun execute( args: List>, ctx: CastingContext - ): Triple> { + ): Triple>? { val pos = args.getChecked(0, argc) ctx.assertVecInRange(pos) - val centered = Vec3.atCenterOf(BlockPos(pos)) + val bpos = BlockPos(pos) + val centered = Vec3.atCenterOf(bpos) return Triple( - Spell(pos), + Spell(bpos), (ManaConstants.DUST_UNIT * 1.125).toInt(), listOf(ParticleSpray.burst(centered, 1.0)) ) } - private data class Spell(val v: Vec3) : RenderedSpell { + private data class Spell(val pos: BlockPos) : RenderedSpell { override fun cast(ctx: CastingContext) { - val pos = BlockPos(v) - 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 269b5fc3..29d6854c 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 @@ -9,6 +9,7 @@ import at.petrak.hexcasting.api.spell.SpellOperator import at.petrak.hexcasting.api.spell.casting.CastingContext import at.petrak.hexcasting.api.spell.mishaps.MishapBadOffhandItem import at.petrak.hexcasting.xplat.IXplatAbstractions +import net.minecraft.world.item.ItemStack object OpColorize : SpellOperator { override val argc = 0 @@ -26,22 +27,19 @@ object OpColorize : SpellOperator { ) } return Triple( - Spell, + Spell(handStack), ManaConstants.DUST_UNIT, listOf() ) } - private object Spell : RenderedSpell { + private data class Spell(val stack: ItemStack) : RenderedSpell { override fun cast(ctx: CastingContext) { - val handStack = ctx.getHeldItemToOperateOn(IXplatAbstractions.INSTANCE::isColorizer).first.copy() - if (IXplatAbstractions.INSTANCE.isColorizer(handStack)) { - if (ctx.withdrawItem(handStack.item, 1, true)) { - IXplatAbstractions.INSTANCE.setColorizer( - ctx.caster, - FrozenColorizer(handStack, ctx.caster.uuid) - ) - } + if (ctx.withdrawItem(stack, 1, true)) { + IXplatAbstractions.INSTANCE.setColorizer( + ctx.caster, + FrozenColorizer(stack, ctx.caster.uuid) + ) } } } diff --git a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/spells/OpDestroyWater.kt b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/spells/OpDestroyWater.kt index a58dd9ba..bb8f620f 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/spells/OpDestroyWater.kt +++ b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/spells/OpDestroyWater.kt @@ -52,8 +52,6 @@ object OpDestroyWater : SpellOperator { var successes = 0 while (todo.isNotEmpty() && successes <= MAX_DESTROY_COUNT) { val here = todo.removeFirst() - val distFromFocus = - ctx.caster.position().distanceToSqr(Vec3.atCenterOf(here)) if (ctx.canEditBlockAt(here) && seen.add(here)) { // never seen this pos in my life val fluid = ctx.world.getFluidState(here) 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 627a4820..b9e2ceda 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 @@ -8,6 +8,7 @@ import at.petrak.hexcasting.api.spell.SpellOperator import at.petrak.hexcasting.api.spell.casting.CastingContext import at.petrak.hexcasting.api.spell.mishaps.MishapBadOffhandItem import at.petrak.hexcasting.xplat.IXplatAbstractions +import net.minecraft.world.item.ItemStack class OpErase : SpellOperator { override val argc = 0 @@ -33,22 +34,15 @@ class OpErase : SpellOperator { } return Triple( - Spell, + Spell(handStack), ManaConstants.DUST_UNIT, listOf() ) } - private object Spell : RenderedSpell { + private data class Spell(val stack: ItemStack) : RenderedSpell { override fun cast(ctx: CastingContext) { - val (handStack) = ctx.getHeldItemToOperateOn { - val hexHolder = IXplatAbstractions.INSTANCE.findHexHolder(it) - val datumHolder = IXplatAbstractions.INSTANCE.findDataHolder(it) - - (hexHolder?.hasHex() == true) || - (datumHolder?.writeDatum(null, true) == true) - } - val hexHolder = IXplatAbstractions.INSTANCE.findHexHolder(handStack) - val datumHolder = IXplatAbstractions.INSTANCE.findDataHolder(handStack) + val hexHolder = IXplatAbstractions.INSTANCE.findHexHolder(stack) + val datumHolder = IXplatAbstractions.INSTANCE.findDataHolder(stack) if (hexHolder?.hasHex() == true) hexHolder.clearHex() 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 4ecd79e9..2c123dbe 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,11 +2,7 @@ package at.petrak.hexcasting.common.casting.operators.spells import at.petrak.hexcasting.api.misc.ManaConstants import at.petrak.hexcasting.api.mod.HexItemTags -import at.petrak.hexcasting.api.spell.getChecked -import at.petrak.hexcasting.api.spell.ParticleSpray -import at.petrak.hexcasting.api.spell.RenderedSpell -import at.petrak.hexcasting.api.spell.SpellDatum -import at.petrak.hexcasting.api.spell.SpellOperator +import at.petrak.hexcasting.api.spell.* import at.petrak.hexcasting.api.spell.casting.CastingContext import at.petrak.hexcasting.api.spell.mishaps.MishapBadItem import at.petrak.hexcasting.api.spell.mishaps.MishapBadOffhandItem @@ -14,6 +10,7 @@ import at.petrak.hexcasting.api.utils.extractMana import at.petrak.hexcasting.api.utils.isManaItem import at.petrak.hexcasting.common.items.magic.ItemManaHolder import at.petrak.hexcasting.common.lib.HexItems +import net.minecraft.world.InteractionHand import net.minecraft.world.entity.item.ItemEntity import net.minecraft.world.item.ItemStack @@ -59,14 +56,13 @@ object OpMakeBattery : SpellOperator { ) } - return Triple(Spell(entity), + return Triple(Spell(entity, hand), ManaConstants.CRYSTAL_UNIT, listOf(ParticleSpray.burst(entity.position(), 0.5))) } - private data class Spell(val itemEntity: ItemEntity) : RenderedSpell { + private data class Spell(val itemEntity: ItemEntity, val hand: InteractionHand) : RenderedSpell { override fun cast(ctx: CastingContext) { - val (handStack, hand) = ctx.getHeldItemToOperateOn { it.`is`(HexItemTags.PHIAL_BASE) } - if (handStack.`is`(HexItemTags.PHIAL_BASE) && itemEntity.isAlive) { + if (itemEntity.isAlive) { val entityStack = itemEntity.item.copy() val manaAmt = extractMana(entityStack, drainForBatteries = true) if (manaAmt > 0) { 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 c8f3b9fd..d7e47fb7 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,6 @@ package at.petrak.hexcasting.common.casting.operators.spells -import at.petrak.hexcasting.api.spell.getChecked -import at.petrak.hexcasting.api.spell.ParticleSpray -import at.petrak.hexcasting.api.spell.RenderedSpell -import at.petrak.hexcasting.api.spell.SpellDatum -import at.petrak.hexcasting.api.spell.SpellList -import at.petrak.hexcasting.api.spell.SpellOperator +import at.petrak.hexcasting.api.spell.* import at.petrak.hexcasting.api.spell.casting.CastingContext import at.petrak.hexcasting.api.spell.mishaps.MishapBadItem import at.petrak.hexcasting.api.spell.mishaps.MishapBadOffhandItem @@ -15,6 +10,7 @@ import at.petrak.hexcasting.api.utils.isManaItem import at.petrak.hexcasting.common.items.magic.ItemPackagedHex import at.petrak.hexcasting.xplat.IXplatAbstractions import net.minecraft.world.entity.item.ItemEntity +import net.minecraft.world.item.ItemStack class OpMakePackagedSpell(val itemType: T, val cost: Int) : SpellOperator { override val argc = 2 @@ -53,13 +49,12 @@ class OpMakePackagedSpell(val itemType: T, val cost: Int) : if (trueName != null) throw MishapOthersName(trueName) - return Triple(Spell(entity, patterns), cost, listOf(ParticleSpray.burst(entity.position(), 0.5))) + return Triple(Spell(entity, patterns, handStack), cost, listOf(ParticleSpray.burst(entity.position(), 0.5))) } - private inner class Spell(val itemEntity: ItemEntity, val patterns: List>) : RenderedSpell { + private inner class Spell(val itemEntity: ItemEntity, val patterns: List>, val stack: ItemStack) : RenderedSpell { override fun cast(ctx: CastingContext) { - val (handStack) = ctx.getHeldItemToOperateOn { it.`is`(itemType) } - val hexHolder = IXplatAbstractions.INSTANCE.findHexHolder(handStack) + val hexHolder = IXplatAbstractions.INSTANCE.findHexHolder(stack) if (hexHolder != null && !hexHolder.hasHex() && itemEntity.isAlive 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 bd3758b0..d59c9227 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 @@ -29,13 +29,8 @@ object OpPlaceBlock : SpellOperator { val pos = BlockPos(target) - // TODO: does this even work?? why are we returning null?? what does that *do*? - if (!ctx.canEditBlockAt(pos)) - return null - - val blockHit = BlockHitResult( - Vec3.ZERO, ctx.caster.direction, pos, false + target, ctx.caster.direction, pos, false ) val itemUseCtx = UseOnContext(ctx.caster, ctx.castingHand, blockHit) val placeContext = BlockPlaceContext(itemUseCtx) @@ -59,7 +54,7 @@ object OpPlaceBlock : SpellOperator { return val blockHit = BlockHitResult( - Vec3.ZERO, ctx.caster.direction, pos, false + vec, ctx.caster.direction, pos, false ) val bstate = ctx.world.getBlockState(pos) @@ -80,13 +75,12 @@ object OpPlaceBlock : SpellOperator { val itemUseCtx = UseOnContext(ctx.caster, ctx.castingHand, blockHit) val placeContext = BlockPlaceContext(itemUseCtx) if (bstate.canBeReplaced(placeContext)) { - val placee = placeeStack.item as BlockItem - if (ctx.withdrawItem(placee, 1, false)) { + if (ctx.withdrawItem(placeeStack, 1, false)) { val res = spoofedStack.useOn(placeContext) ctx.caster.setItemInHand(ctx.castingHand, oldStack) if (res != InteractionResult.FAIL) { - ctx.withdrawItem(placee, 1, true) + ctx.withdrawItem(placeeStack, 1, true) ctx.world.playSound( ctx.caster, 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 fba454b0..6e2c25dd 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 @@ -9,6 +9,7 @@ import at.petrak.hexcasting.api.utils.extractMana import at.petrak.hexcasting.api.utils.isManaItem import at.petrak.hexcasting.xplat.IXplatAbstractions import net.minecraft.world.entity.item.ItemEntity +import net.minecraft.world.item.ItemStack object OpRecharge : SpellOperator { override val argc = 1 @@ -44,19 +45,15 @@ object OpRecharge : SpellOperator { return null return Triple( - Spell(entity), + Spell(entity, handStack), ManaConstants.SHARD_UNIT, listOf(ParticleSpray.burst(entity.position(), 0.5)) ) } - private data class Spell(val itemEntity: ItemEntity) : RenderedSpell { + private data class Spell(val itemEntity: ItemEntity, val stack: ItemStack) : RenderedSpell { override fun cast(ctx: CastingContext) { - val (handStack) = ctx.getHeldItemToOperateOn { - val mana = IXplatAbstractions.INSTANCE.findManaHolder(it) - mana != null && mana.canRecharge() && mana.insertMana(-1, true) != 0 - } - val mana = IXplatAbstractions.INSTANCE.findManaHolder(handStack) + val mana = IXplatAbstractions.INSTANCE.findManaHolder(stack) if (mana != null && itemEntity.isAlive) { val entityStack = itemEntity.item.copy() 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 b5c8a192..3507bf9b 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 @@ -25,7 +25,7 @@ object OpBrainsweep : SpellOperator { override fun execute( args: List>, ctx: CastingContext - ): Triple> { + ): Triple>? { val sacrifice = args.getChecked(0, argc) val pos = args.getChecked(1, argc) ctx.assertVecInRange(pos) @@ -35,6 +35,10 @@ object OpBrainsweep : SpellOperator { throw MishapAlreadyBrainswept(sacrifice) val bpos = BlockPos(pos) + + if (!ctx.canEditBlockAt(bpos)) + return null + val state = ctx.world.getBlockState(bpos) val recman = ctx.world.recipeManager @@ -56,9 +60,8 @@ object OpBrainsweep : SpellOperator { val recipe: BrainsweepRecipe ) : RenderedSpell { override fun cast(ctx: CastingContext) { - if (ctx.canEditBlockAt(pos)) { - ctx.world.setBlockAndUpdate(pos, BrainsweepRecipe.copyProperties(state, recipe.result)) - } + ctx.world.setBlockAndUpdate(pos, BrainsweepRecipe.copyProperties(state, recipe.result)) + Brainsweeping.brainsweep(sacrifice) if (HexConfig.server().doVillagersTakeOffenseAtMindMurder()) { sacrifice.tellWitnessesThatIWasMurdered(ctx.caster) 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 c1da3ab6..0deacf4c 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 @@ -46,7 +46,7 @@ object OpTeleport : SpellOperator { override fun cast(ctx: CastingContext) { val distance = delta.length() if (distance < 32768.0) { - OpTeleport.teleportRespectSticky(teleportee, delta) + teleportRespectSticky(teleportee, delta) } if (teleportee is ServerPlayer && teleportee == ctx.caster) { From 2ae33cf82dcb92c27b77dabea2d43a49d600816f Mon Sep 17 00:00:00 2001 From: "yrsegal@gmail.com" Date: Mon, 22 Aug 2022 22:34:00 -0400 Subject: [PATCH 071/117] fix #228 --- .../operators/spells/great/OpTeleport.kt | 17 ++++------------- .../tags/entity_types/sticky_teleporters.json | 10 ++++++++-- 2 files changed, 12 insertions(+), 15 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 0deacf4c..ef2cba1f 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 @@ -83,23 +83,14 @@ object OpTeleport : SpellOperator { } fun teleportRespectSticky(teleportee: Entity, delta: Vec3) { - var stickyTeleport = false - // roll our own for loop - // this really would be more readable as a c-style for loop, waugh - var cursor = teleportee.vehicle - var base: Entity? = null - while (cursor != null) { - if (cursor.type.`is`(HexEntityTags.STICKY_TELEPORTERS)) - stickyTeleport = true - base = cursor - cursor = cursor.vehicle - } + + val base = teleportee.rootVehicle val playersToUpdate = mutableListOf() - if (stickyTeleport) { + if (base.indirectPassengers.any { it.type.`is`(HexEntityTags.STICKY_TELEPORTERS) }) { // this handles teleporting the passengers - val target = base!!.position().add(delta) + val target = base.position().add(delta) base.teleportTo(target.x, target.y, target.z) base.indirectPassengers .filterIsInstance() 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 95451c51..cb61bbd5 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 @@ -19,6 +19,12 @@ }, "minecraft:pig", "minecraft:strider", - "minecraft:horse" + "minecraft:horse", + "minecraft:skeleton_horse", + "minecraft:zombie_horse", + "minecraft:mule", + "minecraft:donkey", + "minecraft:llama", + "minecraft:trader_llama" ] -} \ No newline at end of file +} From 8ea5b53ee227243aad45a922566796f60c4f6a7e Mon Sep 17 00:00:00 2001 From: "yrsegal@gmail.com" Date: Mon, 22 Aug 2022 23:29:22 -0400 Subject: [PATCH 072/117] fix change to discovery not allowing for unstackables --- .../at/petrak/hexcasting/api/spell/casting/CastingContext.kt | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/Common/src/main/java/at/petrak/hexcasting/api/spell/casting/CastingContext.kt b/Common/src/main/java/at/petrak/hexcasting/api/spell/casting/CastingContext.kt index 58c8003f..ce1739dc 100644 --- a/Common/src/main/java/at/petrak/hexcasting/api/spell/casting/CastingContext.kt +++ b/Common/src/main/java/at/petrak/hexcasting/api/spell/casting/CastingContext.kt @@ -14,7 +14,6 @@ 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.item.ItemEntity import net.minecraft.world.entity.player.Player import net.minecraft.world.item.ItemStack import net.minecraft.world.level.GameType @@ -157,7 +156,7 @@ data class CastingContext( val stacksToExamine = DiscoveryHandlers.collectItemSlots(this) fun matches(stack: ItemStack): Boolean = - !stack.isEmpty && ItemEntity.areMergable(stack, item) + !stack.isEmpty && ItemStack.matches(item, stack) val presentCount = stacksToExamine.fold(0) { acc, stack -> acc + if (matches(stack)) stack.count else 0 From 7e780b5dcabaf4ce1b71c1aa27b923e9676a3429 Mon Sep 17 00:00:00 2001 From: "yrsegal@gmail.com" Date: Thu, 25 Aug 2022 14:01:18 -0400 Subject: [PATCH 073/117] Fix an issue with the pan recipe --- .../fabric/recipe/FabricModConditionalIngredient.java | 11 ++++++++--- .../forge/recipe/ForgeModConditionalIngredient.java | 11 ++++++++--- 2 files changed, 16 insertions(+), 6 deletions(-) diff --git a/Fabric/src/main/java/at/petrak/hexcasting/fabric/recipe/FabricModConditionalIngredient.java b/Fabric/src/main/java/at/petrak/hexcasting/fabric/recipe/FabricModConditionalIngredient.java index 1534677f..a954bc0e 100644 --- a/Fabric/src/main/java/at/petrak/hexcasting/fabric/recipe/FabricModConditionalIngredient.java +++ b/Fabric/src/main/java/at/petrak/hexcasting/fabric/recipe/FabricModConditionalIngredient.java @@ -3,6 +3,7 @@ package at.petrak.hexcasting.fabric.recipe; import at.petrak.hexcasting.xplat.IXplatAbstractions; import com.google.gson.JsonElement; import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; import io.github.tropheusj.serialization_hooks.ingredient.BaseCustomIngredient; import io.github.tropheusj.serialization_hooks.ingredient.IngredientDeserializer; import net.minecraft.network.FriendlyByteBuf; @@ -74,9 +75,13 @@ public class FabricModConditionalIngredient extends BaseCustomIngredient { if (object.has("type") && object.getAsJsonPrimitive("type").getAsString().equals(ID.toString())) { if (object.has("modid") && IXplatAbstractions.INSTANCE.isModPresent(object.getAsJsonPrimitive("modid").getAsString())) { - Ingredient ingredient = Ingredient.fromJson(object.get("if_loaded")); - if (!ingredient.isEmpty()) { - return ingredient; + try { + Ingredient ingredient = Ingredient.fromJson(object.get("if_loaded")); + if (!ingredient.isEmpty()) { + return ingredient; + } + } catch (JsonParseException e) { + // NO-OP } } diff --git a/Forge/src/main/java/at/petrak/hexcasting/forge/recipe/ForgeModConditionalIngredient.java b/Forge/src/main/java/at/petrak/hexcasting/forge/recipe/ForgeModConditionalIngredient.java index f4f6b9d3..25fe15fe 100644 --- a/Forge/src/main/java/at/petrak/hexcasting/forge/recipe/ForgeModConditionalIngredient.java +++ b/Forge/src/main/java/at/petrak/hexcasting/forge/recipe/ForgeModConditionalIngredient.java @@ -3,6 +3,7 @@ package at.petrak.hexcasting.forge.recipe; import at.petrak.hexcasting.xplat.IXplatAbstractions; import com.google.gson.JsonElement; import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; import net.minecraft.network.FriendlyByteBuf; import net.minecraft.resources.ResourceLocation; import net.minecraft.world.item.ItemStack; @@ -74,9 +75,13 @@ public class ForgeModConditionalIngredient extends AbstractIngredient { public static Ingredient fromJson(JsonObject object) { if (object.has("type") && object.getAsJsonPrimitive("type").getAsString().equals(ID.toString())) { if (object.has("modid") && IXplatAbstractions.INSTANCE.isModPresent(object.getAsJsonPrimitive("modid").getAsString())) { - Ingredient ingredient = Ingredient.fromJson(object.get("if_loaded")); - if (!ingredient.isEmpty()) { - return ingredient; + try { + Ingredient ingredient = Ingredient.fromJson(object.get("if_loaded")); + if (!ingredient.isEmpty()) { + return ingredient; + } + } catch (JsonParseException e) { + // NO-OP } } From 0ba1c36ad91b0deeef9d21e5bf1dabd34a310223 Mon Sep 17 00:00:00 2001 From: "yrsegal@gmail.com" Date: Thu, 25 Aug 2022 21:05:26 -0400 Subject: [PATCH 074/117] Phials now always show media amounts (in dust) --- .../circle/BlockEntityAbstractImpetus.java | 8 ++-- .../items/magic/ItemCreativeUnlocker.java | 12 ++---- .../common/items/magic/ItemManaHolder.java | 38 ++++++++++++++++--- .../assets/hexcasting/lang/en_us.json | 11 +++--- 4 files changed, 47 insertions(+), 22 deletions(-) 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 2a40a51e..86dc8cc4 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 @@ -43,6 +43,7 @@ import net.minecraft.world.phys.Vec3; import org.jetbrains.annotations.Contract; import org.jetbrains.annotations.Nullable; +import java.text.DecimalFormat; import java.util.*; public abstract class BlockEntityAbstractImpetus extends HexBlockEntity implements WorldlyContainer { @@ -55,6 +56,8 @@ public abstract class BlockEntityAbstractImpetus extends HexBlockEntity implemen TAG_MANA = "mana", TAG_LAST_MISHAP = "last_mishap"; + private static final DecimalFormat DUST_AMOUNT = new DecimalFormat("###,###.##"); + @Nullable private UUID activator = null; @Nullable @@ -120,9 +123,8 @@ public abstract class BlockEntityAbstractImpetus extends HexBlockEntity implemen if (beai.getMana() < 0) { lines.add(new Pair<>(new ItemStack(HexItems.AMETHYST_DUST), ItemCreativeUnlocker.infiniteMedia(world))); } else { - var dustCount = (float) beai.getMana() / (float) ManaConstants.DUST_UNIT; - var dustCmp = new TranslatableComponent("hexcasting.tooltip.lens.impetus.mana", - String.format("%.2f", dustCount)); + var dustCmp = new TranslatableComponent("hexcasting.tooltip.mana", + DUST_AMOUNT.format(beai.getMana() / (float) ManaConstants.DUST_UNIT)); lines.add(new Pair<>(new ItemStack(HexItems.AMETHYST_DUST), dustCmp)); } diff --git a/Common/src/main/java/at/petrak/hexcasting/common/items/magic/ItemCreativeUnlocker.java b/Common/src/main/java/at/petrak/hexcasting/common/items/magic/ItemCreativeUnlocker.java index 088e14f4..8c088177 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/items/magic/ItemCreativeUnlocker.java +++ b/Common/src/main/java/at/petrak/hexcasting/common/items/magic/ItemCreativeUnlocker.java @@ -219,8 +219,6 @@ public class ItemCreativeUnlocker extends Item implements ManaHolderItem { return copy; } - private static final TextColor HEX_COLOR = TextColor.fromRgb(0xb38ef3); - private static MutableComponent rainbow(MutableComponent component, int shift, Level level) { if (level == null) { return component.withStyle(ChatFormatting.WHITE); @@ -233,16 +231,14 @@ public class ItemCreativeUnlocker extends Item implements ManaHolderItem { @Override public void appendHoverText(ItemStack stack, @Nullable Level level, List tooltipComponents, TooltipFlag isAdvanced) { - String prefix = "item.hexcasting.creative_unlocker."; - Component emphasized = infiniteMedia(level); - MutableComponent modName = new TranslatableComponent(prefix + "mod_name").withStyle( - (s) -> s.withColor(HEX_COLOR)); + MutableComponent modName = new TranslatableComponent("item.hexcasting.creative_unlocker.mod_name").withStyle( + (s) -> s.withColor(ItemManaHolder.HEX_COLOR)); tooltipComponents.add( - new TranslatableComponent(prefix + "tooltip.0", emphasized).withStyle(ChatFormatting.GRAY)); - tooltipComponents.add(new TranslatableComponent(prefix + "tooltip.1", modName).withStyle(ChatFormatting.GRAY)); + new TranslatableComponent("hexcasting.spelldata.onitem", emphasized).withStyle(ChatFormatting.GRAY)); + tooltipComponents.add(new TranslatableComponent("item.hexcasting.creative_unlocker.tooltip", modName).withStyle(ChatFormatting.GRAY)); } private static void addChildren(Advancement root, List out) { diff --git a/Common/src/main/java/at/petrak/hexcasting/common/items/magic/ItemManaHolder.java b/Common/src/main/java/at/petrak/hexcasting/common/items/magic/ItemManaHolder.java index 243f8962..e9fd0987 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/items/magic/ItemManaHolder.java +++ b/Common/src/main/java/at/petrak/hexcasting/common/items/magic/ItemManaHolder.java @@ -1,10 +1,12 @@ package at.petrak.hexcasting.common.items.magic; import at.petrak.hexcasting.api.item.ManaHolderItem; +import at.petrak.hexcasting.api.misc.ManaConstants; import at.petrak.hexcasting.api.utils.ManaHelper; import at.petrak.hexcasting.api.utils.NBTHelper; -import net.minecraft.ChatFormatting; import net.minecraft.network.chat.Component; +import net.minecraft.network.chat.TextColor; +import net.minecraft.network.chat.TextComponent; import net.minecraft.network.chat.TranslatableComponent; import net.minecraft.util.Mth; import net.minecraft.world.item.Item; @@ -13,12 +15,24 @@ import net.minecraft.world.item.TooltipFlag; import net.minecraft.world.level.Level; import org.jetbrains.annotations.Nullable; +import java.math.RoundingMode; +import java.text.DecimalFormat; import java.util.List; public abstract class ItemManaHolder extends Item implements ManaHolderItem { public static final String TAG_MANA = "hexcasting:mana"; public static final String TAG_MAX_MANA = "hexcasting:start_mana"; + public static final TextColor HEX_COLOR = TextColor.fromRgb(0xb38ef3); + + private static final DecimalFormat PERCENTAGE = new DecimalFormat("####"); + + static { + PERCENTAGE.setRoundingMode(RoundingMode.DOWN); + } + + private static final DecimalFormat DUST_AMOUNT = new DecimalFormat("###,###.##"); + public ItemManaHolder(Properties pProperties) { super(pProperties); } @@ -75,12 +89,24 @@ public abstract class ItemManaHolder extends Item implements ManaHolderItem { @Override public void appendHoverText(ItemStack pStack, @Nullable Level pLevel, List pTooltipComponents, TooltipFlag pIsAdvanced) { - if (pIsAdvanced.isAdvanced() && getMaxMana(pStack) > 0) { + var maxMana = getMaxMana(pStack); + if (maxMana > 0) { + var mana = getMana(pStack); + var fullness = getManaFullness(pStack); + + var color = TextColor.fromRgb(ManaHelper.manaBarColor(mana, maxMana)); + + var manaAmount = new TextComponent(DUST_AMOUNT.format(mana / (float) ManaConstants.DUST_UNIT)); + var percentFull = new TextComponent(PERCENTAGE.format(100f * fullness) + "%"); + var maxCapacity = new TranslatableComponent("hexcasting.tooltip.mana", DUST_AMOUNT.format(maxMana / (float) ManaConstants.DUST_UNIT)); + + manaAmount.withStyle(style -> style.withColor(HEX_COLOR)); + maxCapacity.withStyle(style -> style.withColor(HEX_COLOR)); + percentFull.withStyle(style -> style.withColor(color)); + pTooltipComponents.add( - new TranslatableComponent("item.hexcasting.manaholder.amount", - String.format("%,d", getMana(pStack)), - String.format("%,d", getMaxMana(pStack)), - 100f * getManaFullness(pStack)).withStyle(ChatFormatting.GRAY)); + new TranslatableComponent("hexcasting.tooltip.mana_amount.advanced", + manaAmount, maxCapacity, percentFull)); } super.appendHoverText(pStack, pLevel, pTooltipComponents, pIsAdvanced); 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 71b877f2..1e6df8a4 100644 --- a/Common/src/main/resources/assets/hexcasting/lang/en_us.json +++ b/Common/src/main/resources/assets/hexcasting/lang/en_us.json @@ -16,7 +16,6 @@ "item.hexcasting.trinket": "Trinket", "item.hexcasting.artifact": "Artifact", "item.hexcasting.battery": "Phial of Media", - "item.hexcasting.manaholder.amount": "N*merical Mana: %s/%s (%.0f%%)", "item.hexcasting.amethyst_dust": "Amethyst Dust", "item.hexcasting.charged_amethyst": "Charged Amethyst", "item.hexcasting.lens": "Scrying Lens", @@ -66,9 +65,8 @@ "item.hexcasting.pride_colorizer_transgender": "Transgender Pigment", "item.hexcasting.uuid_colorizer": "Soulglimmer Pigment", "item.hexcasting.creative_unlocker": "The Media Cube", - "item.hexcasting.creative_unlocker.tooltip.0": "Contains %s.", "item.hexcasting.creative_unlocker.for_emphasis": "INFINITE MEDIA", - "item.hexcasting.creative_unlocker.tooltip.1": "Consume to unlock all %s knowledge.", + "item.hexcasting.creative_unlocker.tooltip": "Consume to unlock all %s knowledge.", "item.hexcasting.creative_unlocker.mod_name": "Hexcasting", @@ -123,7 +121,6 @@ "hexcasting.tooltip.abacus": "%d", "hexcasting.tooltip.abacus.reset": "Reset to 0", "hexcasting.tooltip.abacus.reset.nice": "nice", - "hexcasting.tooltip.lens.impetus.mana": "%s dust", "hexcasting.tooltip.lens.impetus.storedplayer": "Bound to %s", "hexcasting.tooltip.lens.impetus.storedplayer.none": "Unbound", "hexcasting.tooltip.lens.pattern.invalid": "Invalid Pattern", @@ -141,6 +138,10 @@ "hexcasting.spelldata.entity.whoknows": "An Entity (this should only show up if this was stored before the 0.5.0 update, use Scribe's Reflection, Scribe's Gambit to fix)", "hexcasting.spelldata.akashic.nopos": "The owning record does not know of any iota here (this is a bug)", + "hexcasting.tooltip.mana": "%s dust", + "hexcasting.tooltip.mana_amount": "Contains: %s (%s)", + "hexcasting.tooltip.mana_amount.advanced": "Contains: %s/%s (%s)", + "gui.hexcasting.spellcasting": "Hex Grid", "tag.hexcasting.wands": "Hex Staves", "tag.hexcasting.akashic_logs": "Edified Logs", @@ -631,7 +632,7 @@ "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.", "hexcasting.page.hexcasting.3": "Each item has its own quirks:$(br2)$(l:items/hexcasting)$(item)Cyphers/$ are fragile, destroyed after their internal _media reserves are gone, and $(italic)cannot/$ be recharged;$(br2)$(l:items/hexcasting)$(item)Trinkets/$ can be cast as much as the holder likes, as long as there's enough _media left, but become useless afterwards until recharged;", "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 mana, a $(l:items/amethyst)$(item)Charged Crystal/$ used as the battery will allow me to cast it 10 times.", + "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", From 6418e9b95ef9352e36fa7320bfba865a4b73ad62 Mon Sep 17 00:00:00 2001 From: "yrsegal@gmail.com" Date: Thu, 25 Aug 2022 21:08:15 -0400 Subject: [PATCH 075/117] Akashic libraries now have a range limit --- .../blocks/akashic/BlockAkashicFloodfiller.java | 17 ++++++++++------- .../resources/assets/hexcasting/lang/en_us.json | 2 +- 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/Common/src/main/java/at/petrak/hexcasting/common/blocks/akashic/BlockAkashicFloodfiller.java b/Common/src/main/java/at/petrak/hexcasting/common/blocks/akashic/BlockAkashicFloodfiller.java index a5132a60..f7cb4bb9 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/blocks/akashic/BlockAkashicFloodfiller.java +++ b/Common/src/main/java/at/petrak/hexcasting/common/blocks/akashic/BlockAkashicFloodfiller.java @@ -37,10 +37,9 @@ public class BlockAkashicFloodfiller extends Block { return true; } - - public static @Nullable - BlockPos floodFillFor(BlockPos start, Level world, - TriPredicate isValid, TriPredicate isTarget) { + @Nullable + public static BlockPos floodFillFor(BlockPos start, Level world, + TriPredicate isValid, TriPredicate isTarget, int maxRange) { var seenBlocks = new HashSet(); var todo = new ArrayDeque(); todo.add(start); @@ -50,6 +49,10 @@ public class BlockAkashicFloodfiller extends Block { for (var dir : Direction.values()) { var neighbor = here.relative(dir); + + if (neighbor.distSqr(start) > maxRange * maxRange) + continue; + if (seenBlocks.add(neighbor)) { var bs = world.getBlockState(neighbor); if (isTarget.test(neighbor, bs, world)) { @@ -64,10 +67,10 @@ public class BlockAkashicFloodfiller extends Block { return null; } - public static @Nullable - BlockPos floodFillFor(BlockPos start, Level world, + @Nullable + public static BlockPos floodFillFor(BlockPos start, Level world, TriPredicate isTarget) { - return floodFillFor(start, world, BlockAkashicFloodfiller::canItBeFloodedThrough, isTarget); + return floodFillFor(start, world, BlockAkashicFloodfiller::canItBeFloodedThrough, isTarget, 32); } public static boolean canItBeFloodedThrough(BlockPos pos, BlockState state, Level world) { 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 1e6df8a4..39f518e1 100644 --- a/Common/src/main/resources/assets/hexcasting/lang/en_us.json +++ b/Common/src/main/resources/assets/hexcasting/lang/en_us.json @@ -705,7 +705,7 @@ "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. 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.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.", From 240f021194311f5e2927ea03eaa559914eae7bc8 Mon Sep 17 00:00:00 2001 From: "yrsegal@gmail.com" Date: Thu, 25 Aug 2022 21:09:51 -0400 Subject: [PATCH 076/117] Fluid creation hexes can insert partial, destroy fluid can drain tanks Closes #216 --- .../common/casting/RegisterPatterns.java | 16 +++- .../OpCreateLava.kt => OpCreateFluid.kt} | 43 ++++------- .../casting/operators/spells/OpCreateWater.kt | 74 ------------------- .../{OpDestroyWater.kt => OpDestroyFluid.kt} | 23 ++++-- .../hexcasting/xplat/IXplatAbstractions.java | 3 +- .../assets/hexcasting/lang/en_us.json | 8 +- .../fabric/xplat/FabricXplatImpl.java | 40 ++++++++-- .../forge/xplat/ForgeXplatImpl.java | 26 +++++-- 8 files changed, 107 insertions(+), 126 deletions(-) rename Common/src/main/java/at/petrak/hexcasting/common/casting/operators/spells/{great/OpCreateLava.kt => OpCreateFluid.kt} (50%) delete mode 100644 Common/src/main/java/at/petrak/hexcasting/common/casting/operators/spells/OpCreateWater.kt rename Common/src/main/java/at/petrak/hexcasting/common/casting/operators/spells/{OpDestroyWater.kt => OpDestroyFluid.kt} (87%) diff --git a/Common/src/main/java/at/petrak/hexcasting/common/casting/RegisterPatterns.java b/Common/src/main/java/at/petrak/hexcasting/common/casting/RegisterPatterns.java index 23d08e1c..169889f9 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/casting/RegisterPatterns.java +++ b/Common/src/main/java/at/petrak/hexcasting/common/casting/RegisterPatterns.java @@ -38,6 +38,10 @@ import at.petrak.hexcasting.common.casting.operators.stack.*; import at.petrak.hexcasting.common.lib.HexItems; import it.unimi.dsi.fastutil.booleans.BooleanArrayList; 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 static at.petrak.hexcasting.api.HexAPI.modLoc; @@ -201,10 +205,13 @@ public class RegisterPatterns { modLoc("colorize"), OpColorize.INSTANCE); PatternRegistry.mapPattern(HexPattern.fromAngles("aqawqadaq", HexDir.SOUTH_EAST), modLoc("create_water"), - OpCreateWater.INSTANCE); + new OpCreateFluid(false, ManaConstants.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"), - OpDestroyWater.INSTANCE); + OpDestroyFluid.INSTANCE); PatternRegistry.mapPattern(HexPattern.fromAngles("aaqawawa", HexDir.SOUTH_EAST), modLoc("ignite"), OpIgnite.INSTANCE); PatternRegistry.mapPattern(HexPattern.fromAngles("ddedwdwd", HexDir.SOUTH_WEST), modLoc("extinguish"), @@ -292,7 +299,10 @@ public class RegisterPatterns { PatternRegistry.mapPattern(HexPattern.fromAngles("eawwaeawawaa", HexDir.NORTH_WEST), modLoc("flight"), OpFlight.INSTANCE, true); PatternRegistry.mapPattern(HexPattern.fromAngles("eaqawqadaqd", HexDir.EAST), - modLoc("create_lava"), OpCreateLava.INSTANCE, true); + modLoc("create_lava"), new OpCreateFluid(true, ManaConstants.CRYSTAL_UNIT, + Items.LAVA_BUCKET, + Blocks.LAVA_CAULDRON.defaultBlockState(), + Fluids.LAVA), true); PatternRegistry.mapPattern( HexPattern.fromAngles("wwwqqqwwwqqeqqwwwqqwqqdqqqqqdqq", HexDir.EAST), modLoc("teleport"), OpTeleport.INSTANCE, true); diff --git a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/spells/great/OpCreateLava.kt b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/spells/OpCreateFluid.kt similarity index 50% rename from Common/src/main/java/at/petrak/hexcasting/common/casting/operators/spells/great/OpCreateLava.kt rename to Common/src/main/java/at/petrak/hexcasting/common/casting/operators/spells/OpCreateFluid.kt index 1a819def..c3c1421c 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/spells/great/OpCreateLava.kt +++ b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/spells/OpCreateFluid.kt @@ -1,22 +1,19 @@ -package at.petrak.hexcasting.common.casting.operators.spells.great +package at.petrak.hexcasting.common.casting.operators.spells -import at.petrak.hexcasting.api.HexAPI -import at.petrak.hexcasting.api.misc.ManaConstants import at.petrak.hexcasting.api.spell.* import at.petrak.hexcasting.api.spell.casting.CastingContext import at.petrak.hexcasting.xplat.IXplatAbstractions import net.minecraft.core.BlockPos import net.minecraft.world.item.BucketItem +import net.minecraft.world.item.Item import net.minecraft.world.item.ItemStack -import net.minecraft.world.item.Items -import net.minecraft.world.level.block.AbstractCauldronBlock import net.minecraft.world.level.block.Blocks -import net.minecraft.world.level.material.Fluids +import net.minecraft.world.level.block.state.BlockState +import net.minecraft.world.level.material.Fluid import net.minecraft.world.phys.Vec3 -object OpCreateLava : SpellOperator { +class OpCreateFluid(override val isGreat: Boolean, val cost: Int, val bucket: Item, val cauldron: BlockState, val fluid: Fluid) : SpellOperator { override val argc = 1 - override val isGreat = true override fun execute( args: List>, ctx: CastingContext @@ -25,20 +22,20 @@ object OpCreateLava : SpellOperator { ctx.assertVecInRange(target) return Triple( - Spell(target), - ManaConstants.CRYSTAL_UNIT, - listOf(ParticleSpray.burst(Vec3.atCenterOf(BlockPos(target)), 1.0)), + Spell(target, bucket, cauldron, fluid), + cost, + listOf(ParticleSpray.burst(Vec3.atCenterOf(BlockPos(target)), 1.0)) ) } - private data class Spell(val target: Vec3) : RenderedSpell { + private data class Spell(val target: Vec3, val bucket: Item, val cauldron: BlockState, val fluid: Fluid) : RenderedSpell { override fun cast(ctx: CastingContext) { val pos = BlockPos(target) if (!ctx.canEditBlockAt(pos) || !IXplatAbstractions.INSTANCE.isPlacingAllowed( ctx.world, pos, - ItemStack(Items.LAVA_BUCKET), + ItemStack(bucket), ctx.caster ) ) @@ -46,24 +43,16 @@ object OpCreateLava : SpellOperator { val state = ctx.world.getBlockState(pos) - if (state.block is AbstractCauldronBlock) - ctx.world.setBlock(pos, Blocks.LAVA_CAULDRON.defaultBlockState(), 3) + if (state.block == Blocks.CAULDRON) + ctx.world.setBlock(pos, cauldron, 3) else if (!IXplatAbstractions.INSTANCE.tryPlaceFluid( ctx.world, ctx.castingHand, pos, - ItemStack(Items.LAVA_BUCKET), - Fluids.LAVA - ) - ) { - // Just steal bucket code lmao - val charlie = Items.LAVA_BUCKET - if (charlie is BucketItem) { - // make the player null so we don't give them a usage statistic for example - charlie.emptyContents(null, ctx.world, pos, null) - } else { - HexAPI.LOGGER.warn("Items.LAVA_BUCKET wasn't a BucketItem?") - } + fluid + ) && bucket is BucketItem) { + // make the player null so we don't give them a usage statistic for example + bucket.emptyContents(null, ctx.world, pos, null) } } } diff --git a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/spells/OpCreateWater.kt b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/spells/OpCreateWater.kt deleted file mode 100644 index 90d03499..00000000 --- a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/spells/OpCreateWater.kt +++ /dev/null @@ -1,74 +0,0 @@ -package at.petrak.hexcasting.common.casting.operators.spells - -import at.petrak.hexcasting.api.HexAPI -import at.petrak.hexcasting.api.misc.ManaConstants -import at.petrak.hexcasting.api.spell.* -import at.petrak.hexcasting.api.spell.casting.CastingContext -import at.petrak.hexcasting.xplat.IXplatAbstractions -import net.minecraft.core.BlockPos -import net.minecraft.world.item.BucketItem -import net.minecraft.world.item.ItemStack -import net.minecraft.world.item.Items -import net.minecraft.world.level.block.AbstractCauldronBlock -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 - -object OpCreateWater : SpellOperator { - override val argc = 1 - override fun execute( - args: List>, - ctx: CastingContext - ): Triple> { - val target = args.getChecked(0, argc) - ctx.assertVecInRange(target) - - return Triple( - Spell(target), - ManaConstants.DUST_UNIT, - listOf(ParticleSpray.burst(Vec3.atCenterOf(BlockPos(target)), 1.0)) - ) - } - - private data class Spell(val target: Vec3) : RenderedSpell { - override fun cast(ctx: CastingContext) { - val pos = BlockPos(target) - - if (!ctx.canEditBlockAt(pos) - || !IXplatAbstractions.INSTANCE.isPlacingAllowed( - ctx.world, - pos, - ItemStack(Items.WATER_BUCKET), - ctx.caster - ) - ) - return - val state = ctx.world.getBlockState(pos) - - if (state.block is AbstractCauldronBlock) - ctx.world.setBlock( - pos, - Blocks.WATER_CAULDRON.defaultBlockState().setValue(LayeredCauldronBlock.LEVEL, 3), - 3 - ) - else if (!IXplatAbstractions.INSTANCE.tryPlaceFluid( - ctx.world, - ctx.castingHand, - pos, - ItemStack(Items.WATER_BUCKET), - Fluids.WATER - ) - ) { - // Just steal bucket code lmao - val charlie = Items.WATER_BUCKET - if (charlie is BucketItem) { - // make the player null so we don't give them a usage statistic for example - charlie.emptyContents(null, ctx.world, pos, null) - } else { - HexAPI.LOGGER.warn("Items.WATER_BUCKET wasn't a BucketItem?") - } - } - } - } -} diff --git a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/spells/OpDestroyWater.kt b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/spells/OpDestroyFluid.kt similarity index 87% rename from Common/src/main/java/at/petrak/hexcasting/common/casting/operators/spells/OpDestroyWater.kt rename to Common/src/main/java/at/petrak/hexcasting/common/casting/operators/spells/OpDestroyFluid.kt index bb8f620f..d9baf1fb 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/spells/OpDestroyWater.kt +++ b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/spells/OpDestroyFluid.kt @@ -9,16 +9,13 @@ import net.minecraft.core.Direction import net.minecraft.core.particles.ParticleTypes import net.minecraft.sounds.SoundEvents import net.minecraft.sounds.SoundSource -import net.minecraft.world.level.block.Block -import net.minecraft.world.level.block.Blocks -import net.minecraft.world.level.block.BucketPickup -import net.minecraft.world.level.block.LiquidBlock +import net.minecraft.world.level.block.* import net.minecraft.world.level.block.entity.BlockEntity import net.minecraft.world.level.material.Fluids import net.minecraft.world.level.material.Material import net.minecraft.world.phys.Vec3 -object OpDestroyWater : SpellOperator { +object OpDestroyFluid : SpellOperator { override val argc = 1 override fun execute( args: List>, @@ -39,10 +36,24 @@ object OpDestroyWater : SpellOperator { private data class Spell(val target: Vec3) : RenderedSpell { override fun cast(ctx: CastingContext) { + val basePos = BlockPos(target) + + // Try draining from fluid handlers first, and if so, don't do the normal behavior + if (ctx.canEditBlockAt(basePos)) { + if (IXplatAbstractions.INSTANCE.drainAllFluid(ctx.world, basePos)) { + return + } else { + val state = ctx.world.getBlockState(basePos) + if (state.block is AbstractCauldronBlock && state.block != Blocks.CAULDRON) { + ctx.world.setBlock(basePos, Blocks.CAULDRON.defaultBlockState(), 3) + return + } + } + } + // SpongeBlock.java val todo = ArrayDeque() val seen = HashSet() - val basePos = BlockPos(target) // a little extra range on the initial cast to make it feel more intuitive for (xShift in -2..2) for (yShift in -2..2) for (zShift in -2..2) { 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 8654eb1d..2b6b3659 100644 --- a/Common/src/main/java/at/petrak/hexcasting/xplat/IXplatAbstractions.java +++ b/Common/src/main/java/at/petrak/hexcasting/xplat/IXplatAbstractions.java @@ -120,8 +120,9 @@ public interface IXplatAbstractions { BlockEntityType createBlockEntityType(BiFunction func, Block... blocks); - boolean tryPlaceFluid(Level level, InteractionHand hand, BlockPos pos, ItemStack stack, Fluid fluid); + boolean tryPlaceFluid(Level level, InteractionHand hand, BlockPos pos, Fluid fluid); + boolean drainAllFluid(Level level, BlockPos pos); // misc 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 39f518e1..9de13af6 100644 --- a/Common/src/main/resources/assets/hexcasting/lang/en_us.json +++ b/Common/src/main/resources/assets/hexcasting/lang/en_us.json @@ -310,7 +310,7 @@ "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 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", @@ -920,8 +920,8 @@ "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.create_water": "Summon a block of water (or insert 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": "Destroy a great deal of liquid (not just water) around the given position. Costs about two $(l:items/amethyst)$(item)Charged Amethyst/$.", + "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/$.", "hexcasting.page.blockworks.conjure_light": "Conjure a magical light that softly glows with my pigment at the given position. Costs about one $(l:items/amethyst)$(item)Amethyst Dust/$.", "hexcasting.page.blockworks.bonemeal": "Encourage a plant or sapling at the target position to grow, as if $(item)Bonemeal/$ was applied. Costs a bit more than one $(l:items/amethyst)$(item)Amethyst Dust/$.", @@ -958,7 +958,7 @@ "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 a bucket's worth into a block at the given position. Costs about one $(l:items/amethyst)$(item)Charged Amethyst/$.", + "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", 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 c57f7100..7e289421 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 @@ -31,12 +31,11 @@ import net.fabricmc.fabric.api.item.v1.FabricItemSettings; import net.fabricmc.fabric.api.networking.v1.PlayerLookup; import net.fabricmc.fabric.api.networking.v1.ServerPlayNetworking; import net.fabricmc.fabric.api.object.builder.v1.block.entity.FabricBlockEntityTypeBuilder; -import net.fabricmc.fabric.api.transfer.v1.context.ContainerItemContext; import net.fabricmc.fabric.api.transfer.v1.fluid.FluidConstants; import net.fabricmc.fabric.api.transfer.v1.fluid.FluidStorage; import net.fabricmc.fabric.api.transfer.v1.fluid.FluidVariant; import net.fabricmc.fabric.api.transfer.v1.storage.Storage; -import net.fabricmc.fabric.api.transfer.v1.storage.StorageUtil; +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; @@ -252,10 +251,41 @@ public class FabricXplatImpl implements IXplatAbstractions { @Override @SuppressWarnings("UnstableApiUsage") - public boolean tryPlaceFluid(Level level, InteractionHand hand, BlockPos pos, ItemStack stack, Fluid fluid) { + public boolean tryPlaceFluid(Level level, InteractionHand hand, BlockPos pos, Fluid fluid) { Storage target = FluidStorage.SIDED.find(level, pos, Direction.UP); - Storage emptyFrom = FluidStorage.ITEM.find(stack, ContainerItemContext.withInitial(stack)); - return StorageUtil.move(emptyFrom, target, (f) -> true, FluidConstants.BUCKET, null) > 0; + if (target == null) + return false; + try (Transaction transaction = Transaction.openOuter()) { + long insertedAmount = target.insert(FluidVariant.of(fluid), FluidConstants.BUCKET, transaction); + if (insertedAmount > 0) { + transaction.commit(); + return true; + } + } + return false; + } + + @Override + @SuppressWarnings("UnstableApiUsage") + public boolean drainAllFluid(Level level, BlockPos pos) { + Storage target = FluidStorage.SIDED.find(level, pos, Direction.UP); + if (target == null) + return false; + try (Transaction transaction = Transaction.openOuter()) { + boolean any = false; + for (var view : target.iterable(transaction)) { + long extracted = view.extract(view.getResource(), view.getAmount(), transaction); + if (extracted > 0) { + any = true; + } + } + + if (any) { + transaction.commit(); + return true; + } + } + return false; } @Override 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 8e7e9a26..916c1626 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 @@ -82,6 +82,8 @@ import java.util.List; import java.util.Optional; import java.util.function.BiFunction; +import static net.minecraftforge.fluids.capability.IFluidHandler.FluidAction.EXECUTE; + public class ForgeXplatImpl implements IXplatAbstractions { @Override public Platform platform() { @@ -310,14 +312,26 @@ public class ForgeXplatImpl implements IXplatAbstractions { } @Override - public boolean tryPlaceFluid(Level level, InteractionHand hand, BlockPos pos, ItemStack stack, Fluid fluid) { + public boolean tryPlaceFluid(Level level, InteractionHand hand, BlockPos pos, Fluid fluid) { Optional handler = FluidUtil.getFluidHandler(level, pos, Direction.UP).resolve(); - if (handler.isPresent() && - FluidUtil.tryEmptyContainer(stack, handler.get(), FluidAttributes.BUCKET_VOLUME, null, true).isSuccess()) { - return true; + return handler.isPresent() && + handler.get().fill(new FluidStack(fluid, FluidAttributes.BUCKET_VOLUME), EXECUTE) > 0; + } + + @Override + public boolean drainAllFluid(Level level, BlockPos pos) { + Optional handler = FluidUtil.getFluidHandler(level, pos, Direction.UP).resolve(); + if (handler.isPresent()) { + boolean any = false; + IFluidHandler pool = handler.get(); + for (int i = 0; i < pool.getTanks(); i++) { + if (!pool.drain(pool.getFluidInTank(i), EXECUTE).isEmpty()) { + any = true; + } + } + return any; } - return FluidUtil.tryPlaceFluid(null, level, hand, pos, stack, new FluidStack( - fluid, FluidAttributes.BUCKET_VOLUME)).isSuccess(); + return false; } @Override From 32fed35bebf34dd0dc7e3b9d4b34c82344235c0e Mon Sep 17 00:00:00 2001 From: "yrsegal@gmail.com" Date: Fri, 26 Aug 2022 14:40:38 -0400 Subject: [PATCH 077/117] patterns now have innate names currently only matters for mishaps --- .../petrak/hexcasting/api/PatternRegistry.kt | 8 ++ .../petrak/hexcasting/api/spell/Operator.kt | 25 ++++++ .../api/spell/casting/CastingHarness.kt | 30 +++++-- .../hexcasting/api/spell/mishaps/Mishap.kt | 8 +- .../hexcasting/client/gui/GuiSpellcasting.kt | 4 - .../common/casting/RegisterPatterns.java | 4 +- .../common/casting/operators/stack/OpMask.kt | 9 +- .../interop/patchouli/PatternProcessor.java | 33 +++++++ .../assets/hexcasting/lang/en_us.json | 85 ++++++++++++------- .../en_us/entries/patterns/consts.json | 6 +- .../en_us/entries/patterns/numbers.json | 2 +- .../en_us/entries/patterns/stackmanip.json | 4 +- .../en_us/templates/manual_pattern.json | 3 +- .../en_us/templates/manual_pattern_nosig.json | 3 +- .../thehexbook/en_us/templates/pattern.json | 3 +- doc/collate_data.py | 21 +++-- 16 files changed, 186 insertions(+), 62 deletions(-) create mode 100644 Common/src/main/java/at/petrak/hexcasting/interop/patchouli/PatternProcessor.java diff --git a/Common/src/main/java/at/petrak/hexcasting/api/PatternRegistry.kt b/Common/src/main/java/at/petrak/hexcasting/api/PatternRegistry.kt index 8ee4fe2f..d8027d4a 100644 --- a/Common/src/main/java/at/petrak/hexcasting/api/PatternRegistry.kt +++ b/Common/src/main/java/at/petrak/hexcasting/api/PatternRegistry.kt @@ -27,6 +27,7 @@ import java.util.concurrent.ConcurrentMap */ object PatternRegistry { private val operatorLookup = ConcurrentHashMap() + private val keyLookup = ConcurrentHashMap() private val specialHandlers: ConcurrentLinkedDeque = ConcurrentLinkedDeque() // Map signatures to the "preferred" direction they start in and their operator ID. @@ -48,6 +49,7 @@ object PatternRegistry { } this.operatorLookup[id] = operator + this.keyLookup[operator] = id if (isPerWorld) { this.perWorldPatternLookup[id] = PerWorldEntry(pattern, id) } else { @@ -120,6 +122,12 @@ object PatternRegistry { return perWorldPatterns.lookup } + /** + * Internal use only. + */ + @JvmStatic + fun lookupPattern(op: Operator): ResourceLocation? = this.keyLookup[op] + /** * Internal use only. */ diff --git a/Common/src/main/java/at/petrak/hexcasting/api/spell/Operator.kt b/Common/src/main/java/at/petrak/hexcasting/api/spell/Operator.kt index a5b24adc..46d9c658 100644 --- a/Common/src/main/java/at/petrak/hexcasting/api/spell/Operator.kt +++ b/Common/src/main/java/at/petrak/hexcasting/api/spell/Operator.kt @@ -1,8 +1,14 @@ package at.petrak.hexcasting.api.spell +import at.petrak.hexcasting.api.PatternRegistry import at.petrak.hexcasting.api.spell.casting.CastingContext import at.petrak.hexcasting.api.spell.casting.SpellContinuation +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 /** * Manipulates the stack in some way, usually by popping some number of values off the stack @@ -40,6 +46,11 @@ interface Operator { */ val causesBlindDiversion: Boolean get() = this is SpellOperator + /** + * The component for displaying this pattern's name. Override for dynamic patterns. + */ + val displayName: Component get() = "hexcasting.spell.${PatternRegistry.lookupPattern(this)}".asTranslatedComponent.lightPurple + companion object { // I see why vzakii did this: you can't raycast out to infinity! const val MAX_DISTANCE: Double = 32.0 @@ -57,6 +68,20 @@ interface Operator { override fun execute(args: List>, ctx: CastingContext): List> = listOf(x) } + + private val DOUBLE_FORMATTER = DecimalFormat("####.####") + + @JvmStatic + fun makeConstantOp(x: Double, key: ResourceLocation): Operator = object : ConstManaOperator { + override val argc: Int + get() = 0 + + override fun execute(args: List>, ctx: CastingContext): List> = + x.asSpellResult + + override val displayName: Component + get() = "hexcasting.spell.$key".asTranslatedComponent(DOUBLE_FORMATTER.format(x)).lightPurple + } } } 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 9a2cd337..d4493fce 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 @@ -47,6 +47,24 @@ class CastingHarness private constructor( */ fun executeIota(iota: SpellDatum<*>, world: ServerLevel): ControllerInfo = executeIotas(listOf(iota), world) + private fun getOperatorForPattern(iota: SpellDatum<*>, world: ServerLevel): Operator? { + if (iota.getType() == DatumType.PATTERN) + return PatternRegistry.matchPattern(iota.payload as HexPattern, world) + return null + } + + private fun getPatternForFrame(frame: ContinuationFrame): HexPattern? { + if (frame !is ContinuationFrame.Evaluate) return null + + return frame.list.car.payload as? HexPattern + } + + private fun getOperatorForFrame(frame: ContinuationFrame, world: ServerLevel): Operator? { + if (frame !is ContinuationFrame.Evaluate) return null + + return getOperatorForPattern(frame.list.car, world) + } + /** * Given a list of iotas, execute them in sequence. */ @@ -63,6 +81,8 @@ class CastingHarness private constructor( val result = try { next.evaluate(continuation.next, world, this) } catch (mishap: Mishap) { + val pattern = getPatternForFrame(next) + val operator = getOperatorForFrame(next, world) CastResult( continuation, null, @@ -70,7 +90,7 @@ class CastingHarness private constructor( listOf( OperatorSideEffect.DoMishap( mishap, - Mishap.Context(HexPattern(HexDir.WEST), null) + Mishap.Context(pattern ?: HexPattern(HexDir.WEST), operator) ) ) ) @@ -126,7 +146,7 @@ class CastingHarness private constructor( listOf( OperatorSideEffect.DoMishap( mishap, - Mishap.Context(iota.payload as? HexPattern ?: HexPattern(HexDir.WEST), null) + Mishap.Context(iota.payload as? HexPattern ?: HexPattern(HexDir.WEST), getOperatorForPattern(iota, world)) ) ), ) @@ -139,7 +159,7 @@ class CastingHarness private constructor( listOf( OperatorSideEffect.DoMishap( MishapError(exception), - Mishap.Context(iota.payload as? HexPattern ?: HexPattern(HexDir.WEST), null) + Mishap.Context(iota.payload as? HexPattern ?: HexPattern(HexDir.WEST), getOperatorForPattern(iota, world)) ) ) ) @@ -218,7 +238,7 @@ class CastingHarness private constructor( continuation, null, mishap.resolutionType(ctx), - listOf(OperatorSideEffect.DoMishap(mishap, Mishap.Context(newPat, operatorIdPair?.second))), + listOf(OperatorSideEffect.DoMishap(mishap, Mishap.Context(newPat, operatorIdPair?.first))), ) } catch (exception: Exception) { exception.printStackTrace() @@ -229,7 +249,7 @@ class CastingHarness private constructor( listOf( OperatorSideEffect.DoMishap( MishapError(exception), - Mishap.Context(newPat, operatorIdPair?.second) + Mishap.Context(newPat, operatorIdPair?.first) ) ) ) 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 6b5784f7..807c5b1d 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 @@ -2,6 +2,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.spell.Operator import at.petrak.hexcasting.api.spell.ParticleSpray import at.petrak.hexcasting.api.spell.SpellDatum import at.petrak.hexcasting.api.spell.casting.CastingContext @@ -15,7 +16,6 @@ import at.petrak.hexcasting.xplat.IXplatAbstractions import net.minecraft.Util import net.minecraft.core.BlockPos import net.minecraft.network.chat.Component -import net.minecraft.resources.ResourceLocation import net.minecraft.world.InteractionHand import net.minecraft.world.damagesource.DamageSource import net.minecraft.world.entity.LivingEntity @@ -54,8 +54,8 @@ sealed class Mishap : Throwable() { protected fun error(stub: String, vararg args: Any): Component = "hexcasting.mishap.$stub".asTranslatedComponent(*args) - protected fun actionName(action: ResourceLocation?): Component = - "hexcasting.spell.${action ?: "unknown"}".asTranslatedComponent.lightPurple + protected fun actionName(action: Operator?): Component = + action?.displayName ?: "hexcasting.spell.null".asTranslatedComponent.lightPurple protected fun yeetHeldItemsTowards(ctx: CastingContext, targetPos: Vec3) { // Knock the player's items out of their hands @@ -101,7 +101,7 @@ sealed class Mishap : Throwable() { return ctx.world.getBlockState(pos).block.name } - data class Context(val pattern: HexPattern, val action: ResourceLocation?) + data class Context(val pattern: HexPattern, val action: Operator?) companion object { fun trulyHurt(entity: LivingEntity, source: DamageSource, amount: Float) { 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 8d01bbb6..c7a6a934 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 @@ -207,10 +207,6 @@ class GuiSpellcasting( is PatternDrawState.JustStarted -> { // Well, we never managed to get anything on the stack this go-around. this.drawState = PatternDrawState.BetweenPatterns - if (this.patterns.isEmpty()) { - Minecraft.getInstance().setScreen(null) - Minecraft.getInstance().soundManager.stop(HexSounds.CASTING_AMBIANCE.location, null) - } } is PatternDrawState.Drawing -> { val (start, _, pat) = this.drawState as PatternDrawState.Drawing diff --git a/Common/src/main/java/at/petrak/hexcasting/common/casting/RegisterPatterns.java b/Common/src/main/java/at/petrak/hexcasting/common/casting/RegisterPatterns.java index 169889f9..520a04d2 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/casting/RegisterPatterns.java +++ b/Common/src/main/java/at/petrak/hexcasting/common/casting/RegisterPatterns.java @@ -500,7 +500,7 @@ public class RegisterPatterns { if (negate) { accumulator = -accumulator; } - return Operator.makeConstantOp(SpellDatum.make(accumulator)); + return Operator.makeConstantOp(accumulator, modLoc("number")); } else { return null; } @@ -536,7 +536,7 @@ public class RegisterPatterns { return null; } - return new OpMask(mask); + return new OpMask(mask, modLoc("mask")); }); } } 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 40631da9..94dd22db 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 @@ -3,9 +3,13 @@ package at.petrak.hexcasting.common.casting.operators.stack import at.petrak.hexcasting.api.spell.ConstManaOperator import at.petrak.hexcasting.api.spell.SpellDatum import at.petrak.hexcasting.api.spell.casting.CastingContext +import at.petrak.hexcasting.api.utils.asTranslatedComponent +import at.petrak.hexcasting.api.utils.lightPurple import it.unimi.dsi.fastutil.booleans.BooleanList +import net.minecraft.network.chat.Component +import net.minecraft.resources.ResourceLocation -class OpMask(val mask: BooleanList) : ConstManaOperator { +class OpMask(val mask: BooleanList, val key: ResourceLocation) : ConstManaOperator { override val argc: Int get() = mask.size @@ -17,4 +21,7 @@ class OpMask(val mask: BooleanList) : ConstManaOperator { } 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/interop/patchouli/PatternProcessor.java b/Common/src/main/java/at/petrak/hexcasting/interop/patchouli/PatternProcessor.java new file mode 100644 index 00000000..1d61a943 --- /dev/null +++ b/Common/src/main/java/at/petrak/hexcasting/interop/patchouli/PatternProcessor.java @@ -0,0 +1,33 @@ +package at.petrak.hexcasting.interop.patchouli; + +import net.minecraft.client.resources.language.I18n; +import vazkii.patchouli.api.IComponentProcessor; +import vazkii.patchouli.api.IVariable; +import vazkii.patchouli.api.IVariableProvider; + +public class PatternProcessor implements IComponentProcessor { + private String translationKey; + + @Override + public void setup(IVariableProvider vars) { + if (vars.has("header")) + translationKey = vars.get("header").asString(); + else { + IVariable key = vars.get("op_id"); + String opName = key.asString(); + + String prefix = "hexcasting.spell."; + boolean hasOverride = I18n.exists(prefix + "book." + opName); + translationKey = prefix + (hasOverride ? "book." : "") + opName; + } + } + + @Override + public IVariable process(String key) { + if (key.equals("translation_key")) { + return IVariable.wrap(translationKey); + } + + return null; + } +} 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 9de13af6..767ca2fb 100644 --- a/Common/src/main/resources/assets/hexcasting/lang/en_us.json +++ b/Common/src/main/resources/assets/hexcasting/lang/en_us.json @@ -207,10 +207,40 @@ "hexcasting.subtitles.impetus.fletcher.tick": "Fletcher Impetus ticks", "hexcasting.subtitles.impetus.cleric.register": "Cleric Impetus dings", + "_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:number": "Numerical Reflection", + "hexcasting.spell.book.hexcasting:mask": "Bookkeeper's Gambit", + "hexcasting.spell.hexcasting:get_caster": "Mind's Reflection", "hexcasting.spell.hexcasting:get_entity_pos": "Compass' Purification", "hexcasting.spell.hexcasting:get_entity_look": "Alidade's Purification", - "hexcasting.spell.hexcasting:get_entity_height": "Stadiometer's Prfn.", + "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", @@ -236,22 +266,22 @@ "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 Prfn.: Animal", - "hexcasting.spell.hexcasting:get_entity/monster": "Entity Prfn.: Monster", - "hexcasting.spell.hexcasting:get_entity/item": "Entity Prfn.: Item", - "hexcasting.spell.hexcasting:get_entity/player": "Entity Prfn.: Player", - "hexcasting.spell.hexcasting:get_entity/living": "Entity Prfn.: Living", - "hexcasting.spell.hexcasting:zone_entity": "Zone Dstl.: Any", - "hexcasting.spell.hexcasting:zone_entity/animal": "Zone Dstl.: Animal", - "hexcasting.spell.hexcasting:zone_entity/monster": "Zone Dstl.: Monster", - "hexcasting.spell.hexcasting:zone_entity/item": "Zone Dstl.: Item", - "hexcasting.spell.hexcasting:zone_entity/player": "Zone Dstl.: Player", - "hexcasting.spell.hexcasting:zone_entity/living": "Zone Dstl.: Living", - "hexcasting.spell.hexcasting:zone_entity/not_animal": "Zone Dstl.: Non-Animal", - "hexcasting.spell.hexcasting:zone_entity/not_monster": "Zone Dstl.: Non-Monster", - "hexcasting.spell.hexcasting:zone_entity/not_item": "Zone Dstl.: Non-Item", - "hexcasting.spell.hexcasting:zone_entity/not_player": "Zone Dstl.: Non-Player", - "hexcasting.spell.hexcasting:zone_entity/not_living": "Zone Dstl.: Non-Living", + "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.spell.hexcasting:const/null": "Nullary Reflection", "hexcasting.spell.hexcasting:duplicate": "Gemini Decomposition", "hexcasting.spell.hexcasting:duplicate_n": "Gemini's Gambit", @@ -261,8 +291,8 @@ "hexcasting.spell.hexcasting:swizzle": "Swindler's Gambit", "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:mul_dot": "Multiplicative Distillation", + "hexcasting.spell.hexcasting:div_cross": "Division Distillation", "hexcasting.spell.hexcasting:abs_len": "Length Purification", "hexcasting.spell.hexcasting:pow_proj": "Power Distillation", "hexcasting.spell.hexcasting:construct_vec": "Vector Exaltation", @@ -289,9 +319,9 @@ "hexcasting.spell.hexcasting:sin": "Sine Purification", "hexcasting.spell.hexcasting:cos": "Cosine Purification", "hexcasting.spell.hexcasting:tan": "Tangent Purification", - "hexcasting.spell.hexcasting:arcsin": "Inverse Sine Prfn.", - "hexcasting.spell.hexcasting:arccos": "Inverse Cosine Prfn.", - "hexcasting.spell.hexcasting:arctan": "Inverse Tangent Prfn.", + "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", @@ -361,16 +391,13 @@ "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/x": "Vector Rfln. +X/-X", - "hexcasting.spell.hexcasting:const/vec/y": "Vector Rfln. +Y/-Y", - "hexcasting.spell.hexcasting:const/vec/z": "Vector Rfln. +Z/-Z", "hexcasting.spell.hexcasting:const/vec/0": "Vector Reflection Zero", "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:number": "Numerical Reflection", - "hexcasting.spell.hexcasting:mask": "Bookkeeper's Gambit", - "hexcasting.spell.unknown": "Special Handler", + "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", @@ -731,7 +758,6 @@ "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.entry.numbers": "Number Literals", - "hexcasting.page.numbers.1.header": "Numerical Reflection", "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.", "hexcasting.page.numbers.example.10.header": "Example 1", @@ -805,7 +831,6 @@ "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.header": "Bookkeeper's Gambits", "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. Costs an amount of media that starts negligible and scales up as the numerical code does.", diff --git a/Common/src/main/resources/data/hexcasting/patchouli_books/thehexbook/en_us/entries/patterns/consts.json b/Common/src/main/resources/data/hexcasting/patchouli_books/thehexbook/en_us/entries/patterns/consts.json index 4d6508dd..906c6e56 100644 --- a/Common/src/main/resources/data/hexcasting/patchouli_books/thehexbook/en_us/entries/patterns/consts.json +++ b/Common/src/main/resources/data/hexcasting/patchouli_books/thehexbook/en_us/entries/patterns/consts.json @@ -8,7 +8,7 @@ "pages": [ { "type": "hexcasting:manual_pattern", - "header": "hexcasting.spell.hexcasting:const/vec/x", + "op_id": "hexcasting:const/vec/x", "anchor": "hexcasting:const/vec/x", "input": "", "output": "vector", @@ -28,7 +28,7 @@ }, { "type": "hexcasting:manual_pattern", - "header": "hexcasting.spell.hexcasting:const/vec/y", + "op_id": "hexcasting:const/vec/y", "anchor": "hexcasting:const/vec/y", "input": "", "output": "vector", @@ -48,7 +48,7 @@ }, { "type": "hexcasting:manual_pattern", - "header": "hexcasting.spell.hexcasting:const/vec/z", + "op_id": "hexcasting:const/vec/z", "anchor": "hexcasting:const/vec/z", "input": "", "output": "vector", diff --git a/Common/src/main/resources/data/hexcasting/patchouli_books/thehexbook/en_us/entries/patterns/numbers.json b/Common/src/main/resources/data/hexcasting/patchouli_books/thehexbook/en_us/entries/patterns/numbers.json index 87e06a53..e0e6115f 100644 --- a/Common/src/main/resources/data/hexcasting/patchouli_books/thehexbook/en_us/entries/patterns/numbers.json +++ b/Common/src/main/resources/data/hexcasting/patchouli_books/thehexbook/en_us/entries/patterns/numbers.json @@ -8,7 +8,7 @@ "pages": [ { "type": "hexcasting:manual_pattern", - "header": "hexcasting.page.numbers.1.header", + "op_id": "hexcasting:number", "anchor": "Numbers", "input": "", "output": "number", 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 6ddab4c2..e9a2219b 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 @@ -68,8 +68,8 @@ }, { "type": "hexcasting:manual_pattern", - "header": "hexcasting.page.stackmanip.mask.header", - "anchor": "Numbers", + "op_id": "hexcasting:mask", + "anchor": "hexcasting:mask", "input": "many", "output": "many", "text": "hexcasting.page.stackmanip.mask.1", diff --git a/Common/src/main/resources/data/hexcasting/patchouli_books/thehexbook/en_us/templates/manual_pattern.json b/Common/src/main/resources/data/hexcasting/patchouli_books/thehexbook/en_us/templates/manual_pattern.json index 385f795d..4c8ea5fa 100644 --- a/Common/src/main/resources/data/hexcasting/patchouli_books/thehexbook/en_us/templates/manual_pattern.json +++ b/Common/src/main/resources/data/hexcasting/patchouli_books/thehexbook/en_us/templates/manual_pattern.json @@ -1,8 +1,9 @@ { + "processor": "at.petrak.hexcasting.interop.patchouli.PatternProcessor", "components": [ { "type": "patchouli:header", - "text": "#header", + "text": "#translation_key", "x": -1, "y": -1 }, diff --git a/Common/src/main/resources/data/hexcasting/patchouli_books/thehexbook/en_us/templates/manual_pattern_nosig.json b/Common/src/main/resources/data/hexcasting/patchouli_books/thehexbook/en_us/templates/manual_pattern_nosig.json index d12c586d..845d7e4d 100644 --- a/Common/src/main/resources/data/hexcasting/patchouli_books/thehexbook/en_us/templates/manual_pattern_nosig.json +++ b/Common/src/main/resources/data/hexcasting/patchouli_books/thehexbook/en_us/templates/manual_pattern_nosig.json @@ -1,8 +1,9 @@ { + "processor": "at.petrak.hexcasting.interop.patchouli.PatternProcessor", "components": [ { "type": "patchouli:header", - "text": "#header", + "text": "#translation_key", "x": -1, "y": -1 }, diff --git a/Common/src/main/resources/data/hexcasting/patchouli_books/thehexbook/en_us/templates/pattern.json b/Common/src/main/resources/data/hexcasting/patchouli_books/thehexbook/en_us/templates/pattern.json index 805422e6..9f5c0bb9 100644 --- a/Common/src/main/resources/data/hexcasting/patchouli_books/thehexbook/en_us/templates/pattern.json +++ b/Common/src/main/resources/data/hexcasting/patchouli_books/thehexbook/en_us/templates/pattern.json @@ -1,8 +1,9 @@ { + "processor": "at.petrak.hexcasting.interop.patchouli.PatternProcessor", "components": [ { "type": "patchouli:header", - "text": "hexcasting.spell.#op_id#", + "text": "#translation_key", "x": -1, "y": -1 }, diff --git a/doc/collate_data.py b/doc/collate_data.py index 04bde1ad..0bf422a1 100755 --- a/doc/collate_data.py +++ b/doc/collate_data.py @@ -104,15 +104,15 @@ def parse_style(sty): return "", Style("base", None) if sty in types: return "", Style(types[sty], True) - if sty in colors: + if sty in colors: return "", Style("color", colors[sty]) if sty.startswith("#") and len(sty) in [4, 7]: return "", Style("color", sty[1:]) # TODO more style parse raise ValueError("Unknown style: " + sty) -def localize(i18n, string): - return i18n.get(string, string) if i18n else string +def localize(i18n, string, default=None): + return i18n.get(string, default if default else string) if i18n else string format_re = re.compile(r"\$\(([^)]*)\)") def format_string(root_data, string): @@ -144,7 +144,7 @@ def format_string(root_data, string): text_nodes.append(extra_text + string[last_end:]) first_node, *text_nodes = text_nodes - # parse + # parse style_stack = [FormatTree(Style("base", True), []), FormatTree(Style("para", {}), [first_node])] for style, text in zip(styles, text_nodes): tmp_stylestack = [] @@ -174,6 +174,11 @@ def format_string(root_data, string): test_root = {"i18n": {}, "macros": default_macros, "resource_dir": "Common/src/main/resources", "modid": "hexcasting"} test_str = "Write the given iota to my $(l:patterns/readwrite#hexcasting:write/local)$(#490)local$().$(br)The $(l:patterns/readwrite#hexcasting:write/local)$(#490)local$() is a lot like a $(l:items/focus)$(#b0b)Focus$(). It's cleared when I stop casting a Hex, starts with $(l:casting/influences)$(#490)Null$() in it, and is preserved between casts of $(l:patterns/meta#hexcasting:for_each)$(#fc77be)Thoth's Gambit$(). " +def localize_pattern(root_data, op_id): + return localize(root_data["i18n"], "hexcasting.spell.book." + op_id, + localize(root_data["i18n"], "hexcasting.spell." + op_id)) + + def do_localize(root_data, obj, *names): for name in names: if name in obj: @@ -204,10 +209,12 @@ def resolve_pattern(root_data, page): if "pattern_reg" not in root_data: root_data["pattern_reg"] = fetch_patterns(root_data) page["op"] = [root_data["pattern_reg"][page["op_id"]]] - page["name"] = localize(root_data["i18n"], "hexcasting.spell." + page["op_id"]) + page["name"] = localize_pattern(root_data, page["op_id"]) def fixup_pattern(do_sig, root_data, page): patterns = page["patterns"] + if "op_id" in page: + page["header"] = localize_pattern(root_data, page["op_id"]) if not isinstance(patterns, list): patterns = [patterns] if do_sig: inp = page.get("input", None) or "" @@ -261,7 +268,7 @@ def parse_entry(root_data, entry_path, ent_name): if isinstance(page, str): page = {"type": "patchouli:text", "text": page} data["pages"][i] = page - + do_localize(root_data, page, "title", "header") do_format(root_data, page, "text") if page["type"] in page_types: @@ -473,7 +480,7 @@ def write_page(out, pageid, page): with out.pair_tag("code"): out.text(i) out.text(".") if "text" in page: write_block(out, page["text"]) - elif ty == "hexcasting:brainsweep": + elif ty == "hexcasting:brainsweep": with out.pair_tag("blockquote", clazz="crafting-info"): out.text(f"Depicted in the book: A mind-flaying recipe producing the ") with out.pair_tag("code"): out.text(page["output_name"]) From 25fea447a50c64562e4213b1fa94735730d5a3fa Mon Sep 17 00:00:00 2001 From: "yrsegal@gmail.com" Date: Sat, 27 Aug 2022 09:11:19 -0400 Subject: [PATCH 078/117] fix selection of items for placing being weird --- .../at/petrak/hexcasting/api/spell/casting/CastingContext.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Common/src/main/java/at/petrak/hexcasting/api/spell/casting/CastingContext.kt b/Common/src/main/java/at/petrak/hexcasting/api/spell/casting/CastingContext.kt index ce1739dc..6d70561b 100644 --- a/Common/src/main/java/at/petrak/hexcasting/api/spell/casting/CastingContext.kt +++ b/Common/src/main/java/at/petrak/hexcasting/api/spell/casting/CastingContext.kt @@ -156,7 +156,7 @@ data class CastingContext( val stacksToExamine = DiscoveryHandlers.collectItemSlots(this) fun matches(stack: ItemStack): Boolean = - !stack.isEmpty && ItemStack.matches(item, stack) + !stack.isEmpty && ItemStack.isSameItemSameTags(item, stack) val presentCount = stacksToExamine.fold(0) { acc, stack -> acc + if (matches(stack)) stack.count else 0 From 63db46aff9a3e23a601090f8143deb7b7ecc01a6 Mon Sep 17 00:00:00 2001 From: "yrsegal@gmail.com" Date: Sun, 28 Aug 2022 12:32:45 -0400 Subject: [PATCH 079/117] fix nonsensical error messages for scribe's --- .../petrak/hexcasting/api/spell/casting/CastingContext.kt | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/Common/src/main/java/at/petrak/hexcasting/api/spell/casting/CastingContext.kt b/Common/src/main/java/at/petrak/hexcasting/api/spell/casting/CastingContext.kt index 6d70561b..4dba1d3a 100644 --- a/Common/src/main/java/at/petrak/hexcasting/api/spell/casting/CastingContext.kt +++ b/Common/src/main/java/at/petrak/hexcasting/api/spell/casting/CastingContext.kt @@ -41,8 +41,12 @@ data class CastingContext( inline fun getHeldItemToOperateOn(acceptItemIf: (ItemStack) -> Boolean): Pair { val handItem = caster.getItemInHand(otherHand) - if (!acceptItemIf(handItem)) - return caster.getItemInHand(castingHand) to castingHand + if (!acceptItemIf(handItem)) { + val castingItem = caster.getItemInHand(castingHand) + if (acceptItemIf(castingItem)) { + return castingItem to castingHand + } + } return handItem to otherHand } From cf03cc95b5b884e2d3ef9f98d82f38550ef2ec98 Mon Sep 17 00:00:00 2001 From: "yrsegal@gmail.com" Date: Sun, 28 Aug 2022 19:34:24 -0400 Subject: [PATCH 080/117] fix enlightenment being effectively impossible to obtain --- .../at/petrak/hexcasting/api/advancements/OvercastTrigger.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 380c8af4..8f0509de 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 @@ -35,7 +35,7 @@ public class OvercastTrigger extends SimpleCriterionTrigger { var manaToHealth = HexConfig.common().manaToHealthRate(); var healthUsed = manaGenerated / manaToHealth; - return inst.test(manaGenerated, healthUsed / player.getMaxHealth(), player.getHealth() - (float) healthUsed); + return inst.test(manaGenerated, healthUsed / player.getMaxHealth(), player.getHealth()); }); } From f7163127df8a4a1c74d3ead9c799f829e2d2a5a8 Mon Sep 17 00:00:00 2001 From: "yrsegal@gmail.com" Date: Sun, 28 Aug 2022 19:55:52 -0400 Subject: [PATCH 081/117] be a bit more lenient with blocked overcast damage --- .../main/java/at/petrak/hexcasting/api/spell/mishaps/Mishap.kt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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 807c5b1d..06f69a01 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 @@ -105,6 +105,7 @@ sealed class Mishap : Throwable() { companion object { fun trulyHurt(entity: LivingEntity, source: DamageSource, amount: Float) { + val targetHealth = entity.health - amount if (entity.invulnerableTime > 10) { val lastHurt = entity.lastHurt if (lastHurt < amount) @@ -114,7 +115,7 @@ sealed class Mishap : Throwable() { } if (!entity.hurt(source, amount)) { // Ok, if you REALLY don't want to play nice... - entity.health -= amount + entity.health = targetHealth entity.markHurt() if (entity.isDeadOrDying) { From d9a59830c83e8a58a58e8844bb6e4c687010bf6b Mon Sep 17 00:00:00 2001 From: "yrsegal@gmail.com" Date: Sun, 28 Aug 2022 22:13:19 -0400 Subject: [PATCH 082/117] fix a couple of inconsistencies in patchi book --- .../src/main/resources/assets/hexcasting/lang/en_us.json | 8 ++++---- 1 file changed, 4 insertions(+), 4 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 767ca2fb..8474edbf 100644 --- a/Common/src/main/resources/assets/hexcasting/lang/en_us.json +++ b/Common/src/main/resources/assets/hexcasting/lang/en_us.json @@ -950,7 +950,7 @@ "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/$.", "hexcasting.page.blockworks.conjure_light": "Conjure a magical light that softly glows with my pigment at the given position. Costs about one $(l:items/amethyst)$(item)Amethyst Dust/$.", "hexcasting.page.blockworks.bonemeal": "Encourage a plant or sapling at the target position to grow, as if $(item)Bonemeal/$ was applied. Costs a bit more than one $(l:items/amethyst)$(item)Amethyst Dust/$.", - "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 Crystal/$.", + "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/$s.", @@ -1021,13 +1021,13 @@ "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 1 $(item)Charged Amethyst Crystal/$.", + "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.", - "hexcasting.page.interop.pehkui.set": "Set the scale of the entity, passing in a proportion of their normal size. Costs about 1 $(item)Amethyst Shard/$.", + "hexcasting.page.interop.pehkui.set": "Set the scale of the entity, passing in a proportion of their normal size. Costs about one $(l:items/amethyst)$(item)Amethyst Shard/$.", "": "" } From c41ad80907146237c43351e0412883373e6caea8 Mon Sep 17 00:00:00 2001 From: "yrsegal@gmail.com" Date: Sun, 28 Aug 2022 22:14:18 -0400 Subject: [PATCH 083/117] plural of dust is dust, sometimes it's a weird case of an uncountable word --- Common/src/main/resources/assets/hexcasting/lang/en_us.json | 6 +++--- 1 file changed, 3 insertions(+), 3 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 8474edbf..8e5a5258 100644 --- a/Common/src/main/resources/assets/hexcasting/lang/en_us.json +++ b/Common/src/main/resources/assets/hexcasting/lang/en_us.json @@ -934,9 +934,9 @@ "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/$s per point of explosion 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.", "hexcasting.page.basic_spell.explode.fire.1": "Remove a number and vector from the stack, then create a fiery explosion at the given location with the given power.", - "hexcasting.page.basic_spell.explode.fire.2": "Costs one $(l:items/amethyst)$(item)Amethyst Dust/$, plus about 3 extra $(l:items/amethyst)$(item)Amethyst Dust/$s per point of explosion power. Otherwise, the same as $(l:patterns/spells/basic#hexcasting:explode)$(action)Explosion/$, except with fire.", + "hexcasting.page.basic_spell.explode.fire.2": "Costs one $(l:items/amethyst)$(item)Amethyst Dust/$, plus about 3 extra $(l:items/amethyst)$(item)Amethyst Dust/$ per point of explosion power. Otherwise, the same as $(l:patterns/spells/basic#hexcasting:explode)$(action)Explosion/$, except with fire.", "hexcasting.page.basic_spell.add_motion": "Remove an entity and direction from the stack, then give a shove to the given entity in the given direction. The strength of the impulse is determined by the length of the vector.$(br)Costs units of $(l:items/amethyst)$(item)Amethyst Dust/$ equal to the square of the length of the vector.", "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.", @@ -952,7 +952,7 @@ "hexcasting.page.blockworks.bonemeal": "Encourage a plant or sapling at the target position to grow, as if $(item)Bonemeal/$ was applied. Costs a bit more than one $(l:items/amethyst)$(item)Amethyst Dust/$.", "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/$s.", + "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.", From 6675e80ced4d135f23c6fe64557700ea122b27fa Mon Sep 17 00:00:00 2001 From: gamma-delta <29877714+gamma-delta@users.noreply.github.com> Date: Sun, 28 Aug 2022 21:25:54 -0500 Subject: [PATCH 084/117] Fix greater sentinel claiming it costs 2 dust while actually only costing 1 --- .../casting/operators/spells/sentinel/OpCreateSentinel.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 0711f252..4ce1984a 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 @@ -25,7 +25,7 @@ class OpCreateSentinel(val extendsRange: Boolean) : SpellOperator { return Triple( Spell(target, this.extendsRange), - ManaConstants.DUST_UNIT, + ManaConstants.DUST_UNIT * if (extendsRange) 2 else 1, listOf(ParticleSpray.burst(target, 2.0)) ) } From a092047e33134ceed53161b9a837c9d5d9007b10 Mon Sep 17 00:00:00 2001 From: gamma-delta <29877714+gamma-delta@users.noreply.github.com> Date: Sun, 28 Aug 2022 21:46:05 -0500 Subject: [PATCH 085/117] Clean up some advancements. - Root now accepts any of the 3 denominations of amethyst - Changed some wordings to hint at how to achieve enlightenment in the advancmenets - Remove some ableist language --- Common/src/generated/resources/.cache/cache | 2 +- .../data/hexcasting/advancements/root.json | 4 +- .../hexcasting/api/mod/HexItemTags.java | 1 + .../hexcasting/datagen/HexAdvancements.java | 6 +- .../datagen/HexItemTagProvider.java | 8 +- .../assets/hexcasting/lang/en_us.json | 6 +- Fabric/src/generated/resources/.cache/cache | 527 +++++++++--------- .../tags/items/grants_root_advancement.json | 8 + Forge/src/generated/resources/.cache/cache | 1 + .../tags/items/grants_root_advancement.json | 8 + 10 files changed, 296 insertions(+), 275 deletions(-) create mode 100644 Fabric/src/generated/resources/data/hexcasting/tags/items/grants_root_advancement.json create mode 100644 Forge/src/generated/resources/data/hexcasting/tags/items/grants_root_advancement.json diff --git a/Common/src/generated/resources/.cache/cache b/Common/src/generated/resources/.cache/cache index 390f2ff6..481b9c79 100644 --- a/Common/src/generated/resources/.cache/cache +++ b/Common/src/generated/resources/.cache/cache @@ -337,5 +337,5 @@ b6593ea802a692c29b5032292df31beb84878ad8 data/hexcasting/advancements/aaa_wastef 4f4c94021adfb296e3ef3dce1acc46f724f38f92 data/hexcasting/advancements/aab_big_cast.json 2fe3543a209fca031b1eace7ea217c76142609cc data/hexcasting/advancements/enlightenment.json eb6393ffc79966e4b5983a68157742b78cd12414 data/hexcasting/advancements/opened_eyes.json -ed0e62cb81783d8eb6323dd70609067219f163ec data/hexcasting/advancements/root.json +a66a85cef9a3195e4388ecc16786e2a9f6ed3b56 data/hexcasting/advancements/root.json 739cbdf7f204132f2acfab4df8d21c6197aa1456 data/hexcasting/advancements/y_u_no_cast_angy.json diff --git a/Common/src/generated/resources/data/hexcasting/advancements/root.json b/Common/src/generated/resources/data/hexcasting/advancements/root.json index 8160a074..77d92c32 100644 --- a/Common/src/generated/resources/data/hexcasting/advancements/root.json +++ b/Common/src/generated/resources/data/hexcasting/advancements/root.json @@ -21,9 +21,7 @@ "conditions": { "items": [ { - "items": [ - "hexcasting:charged_amethyst" - ] + "tag": "hexcasting:grants_root_advancement" } ] } 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 index cb919193..64b5c695 100644 --- a/Common/src/main/java/at/petrak/hexcasting/api/mod/HexItemTags.java +++ b/Common/src/main/java/at/petrak/hexcasting/api/mod/HexItemTags.java @@ -12,6 +12,7 @@ public class HexItemTags { public static final TagKey AKASHIC_PLANKS = create("akashic_planks"); public static final TagKey WANDS = create("wands"); 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)); 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 63cbee37..7971c609 100644 --- a/Common/src/main/java/at/petrak/hexcasting/datagen/HexAdvancements.java +++ b/Common/src/main/java/at/petrak/hexcasting/datagen/HexAdvancements.java @@ -5,6 +5,7 @@ import at.petrak.hexcasting.api.advancements.FailToCastGreatSpellTrigger; import at.petrak.hexcasting.api.advancements.OvercastTrigger; import at.petrak.hexcasting.api.advancements.SpendManaTrigger; import at.petrak.hexcasting.api.misc.ManaConstants; +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; @@ -12,6 +13,7 @@ import net.minecraft.advancements.DisplayInfo; import net.minecraft.advancements.FrameType; 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.TranslatableComponent; @@ -37,8 +39,8 @@ public class HexAdvancements extends PaucalAdvancementProvider { new ResourceLocation("minecraft", "textures/block/calcite.png"), 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(HexItems.CHARGED_AMETHYST)) + .addCriterion("has_charged_amethyst", InventoryChangeTrigger.TriggerInstance.hasItems( + ItemPredicate.Builder.item().of(HexItemTags.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/HexItemTagProvider.java b/Common/src/main/java/at/petrak/hexcasting/datagen/HexItemTagProvider.java index 7f81a096..71603502 100644 --- a/Common/src/main/java/at/petrak/hexcasting/datagen/HexItemTagProvider.java +++ b/Common/src/main/java/at/petrak/hexcasting/datagen/HexItemTagProvider.java @@ -26,10 +26,12 @@ public class HexItemTagProvider extends PaucalItemTagProvider { tag(xtags.amethystDust()).add(HexItems.AMETHYST_DUST); tag(HexItemTags.WANDS).add(HexItems.WAND_AKASHIC, - HexItems.WAND_OAK, HexItems.WAND_SPRUCE, HexItems.WAND_BIRCH, - HexItems.WAND_JUNGLE, HexItems.WAND_ACACIA, HexItems.WAND_DARK_OAK, - HexItems.WAND_CRIMSON, HexItems.WAND_WARPED); + HexItems.WAND_OAK, HexItems.WAND_SPRUCE, HexItems.WAND_BIRCH, + HexItems.WAND_JUNGLE, HexItems.WAND_ACACIA, HexItems.WAND_DARK_OAK, + HexItems.WAND_CRIMSON, HexItems.WAND_WARPED); tag(HexItemTags.PHIAL_BASE).add(Items.GLASS_BOTTLE); + tag(HexItemTags.GRANTS_ROOT_ADVANCEMENT).add(HexItems.AMETHYST_DUST, Items.AMETHYST_SHARD, + HexItems.CHARGED_AMETHYST); this.copy(HexBlockTags.AKASHIC_LOGS, HexItemTags.AKASHIC_LOGS); this.copy(HexBlockTags.AKASHIC_PLANKS, HexItemTags.AKASHIC_PLANKS); 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 8e5a5258..ca0b2d72 100644 --- a/Common/src/main/resources/assets/hexcasting/lang/en_us.json +++ b/Common/src/main/resources/assets/hexcasting/lang/en_us.json @@ -154,9 +154,9 @@ "emi.category.hexcasting.villager_profession": "Villager Profession", "advancement.hexcasting:root": "Hexcasting Research", - "advancement.hexcasting:root.desc": "Find a concentrated form of media growing deep beneath the earth.", + "advancement.hexcasting:root.desc": "Find and mine a concentrated form of media growing deep beneath the earth.", "advancement.hexcasting:enlightenment": "Achieve Enlightenment", - "advancement.hexcasting:enlightenment.desc": "Go nearly insane from casting a hex using almost all of your health.", + "advancement.hexcasting:enlightenment.desc": "Shatter a barrier by casting a hex using almost all of your health.", "advancement.hexcasting:wasteful_cast": "Waste Not...", "advancement.hexcasting:wasteful_cast.desc": "Waste a large amount of media when casting a hex.", "advancement.hexcasting:big_cast": "... Want Not", @@ -164,7 +164,7 @@ "advancement.hexcasting:y_u_no_cast_angy": "Blind Diversion", "advancement.hexcasting:y_u_no_cast_angy.desc": "Try to cast a spell from a scroll, but fail.", "advancement.hexcasting:opened_eyes": "Opened Eyes", - "advancement.hexcasting:opened_eyes.desc": "Have nature take a piece of your mind in payment for a hex.", + "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?", "stat.hexcasting.mana_used": "Media Consumed (in dust)", "stat.hexcasting.mana_overcasted": "Media Overcast (in dust)", diff --git a/Fabric/src/generated/resources/.cache/cache b/Fabric/src/generated/resources/.cache/cache index 115eda47..daf916d5 100644 --- a/Fabric/src/generated/resources/.cache/cache +++ b/Fabric/src/generated/resources/.cache/cache @@ -1,263 +1,264 @@ -556d2e6068965e90c307a435b372ae761cd1c606 data/minecraft/tags/items/wooden_doors.json -b596d96eebb4f7bad5930f4eebc589f292b59c98 data/minecraft/tags/items/planks.json -39ef3ab2effbae595b45400e7db7a8ad693e0d13 data/hexcasting/recipes/pride_colorizer_pansexual.json -c521621c409275e219f72abf5c6089d60408e646 data/hexcasting/loot_tables/blocks/impetus_rightclick.json -023c32e8834eb313c4fa94a84a8f6390ee951ef0 data/hexcasting/advancements/recipes/hexcasting.creative_tab/empty_impetus.json -bdf848284137f0116ddf4725b0dda6eaa0cef5fd data/hexcasting/loot_tables/blocks/akashic_wood_stripped.json -3e49b1076839e73e871faf64262f96bed22a6b1d data/hexcasting/recipes/artifact.json -2d79a41ba8697f9e1fa26b1bff48f33c824d3823 data/minecraft/tags/items/wooden_pressure_plates.json -c25784941d6416744fb2ca2d43a3203e5c3e7c8a data/minecraft/tags/blocks/mineable/hoe.json -f3e78a96f17dc5ed54047bb24be58dbf3151c8fa data/hexcasting/advancements/recipes/hexcasting.creative_tab/ancient_scroll_paper_lantern.json -4345c060715ce9bf341c5c2b9bb5ca0871282241 data/hexcasting/advancements/recipes/hexcasting.creative_tab/pride_colorizer_genderfluid.json -d5c6f9a31a8310ec440fc8c14da8988f0d166586 data/hexcasting/recipes/brainsweep/impetus_storedplayer.json -db09b7fc38bdaffa15b57bd361da8529c7bc943e data/hexcasting/recipes/wand_warped.json -aba5978bd1bc3c27ba92e13241e470921ad8c125 data/hexcasting/advancements/recipes/hexcasting.creative_tab/pride_colorizer_bisexual.json -4f852507d843f82dce1512f55abfb205b9829ed4 data/hexcasting/advancements/recipes/hexcasting.creative_tab/akashic_planks.json -b107ec9af9e08d124f3d4f14d85911f55a5b905b data/hexcasting/recipes/akashic_pressure_plate.json -8da0de2d4c31c117431a2133f70f8681ca6b5f17 data/hexcasting/advancements/recipes/hexcasting.creative_tab/scroll_small.json -874ee348cf2542696b7768049529a2001f0820e7 data/hexcasting/advancements/recipes/hexcasting.creative_tab/jeweler_hammer.json -5703cc53d18f6b3a14bb030b639d286981c4c754 data/hexcasting/recipes/spellbook.json -cd3ca380294544b07e91ce85d97808c30ffa5d17 data/hexcasting/advancements/recipes/hexcasting.creative_tab/spellbook.json -7351200c8e3eb24772852c578286384c8aab61bd data/hexcasting/advancements/recipes/hexcasting.creative_tab/empty_directrix.json -e0ff0fe75be853b849f84b05787c1c791fa9e208 data/hexcasting/advancements/recipes/hexcasting.creative_tab/akashic_stairs.json -d910f10b472c3ff422f14961539e4c31b8830bff data/hexcasting/recipes/dye_colorizer_yellow.json -918075a87ccc30a489aa8cafa2de992dd179aeac data/hexcasting/advancements/recipes/hexcasting.creative_tab/dye_colorizer_lime.json -9f7a9ba332e1018098d21a5ec474440fca7f6c73 data/hexcasting/recipes/brainsweep/directrix_redstone.json -779b7b9be93062e935972af1cff9c79fa5440a23 data/hexcasting/recipes/amethyst_sconce.json -b475e6d26350d0560e2cd66879f86520faaeb68c data/hexcasting/recipes/dye_colorizer_red.json -811177c2ddc341f7a6d8704e1eb273f200aee3a1 data/hexcasting/loot_tables/blocks/akashic_button.json -4d4caaea035ae4ee878843dd2455042b299b4e5e data/c/tags/items/amethyst_dusts.json -5f9f0962f407062e7b6dd0e8c5f8c55ce13962a5 data/hexcasting/advancements/recipes/brainsweep/brainsweep/impetus_rightclick.json -7f165b1783a871cf69db2e9978290f8993665649 data/hexcasting/advancements/recipes/hexcasting.creative_tab/cypher.json -f50c71bbbbf7d77665c9008fcdd9be0d571ce48e data/hexcasting/recipes/pride_colorizer_transgender.json -d3ad9a9e92dd125f872d9671930d4e57f24894ed data/hexcasting/recipes/pride_colorizer_demigirl.json -b684bfa3755ca25996e74152d2efecbc9d6387d8 data/hexcasting/advancements/recipes/hexcasting.creative_tab/stonecutting/amethyst_tiles.json -2d79a41ba8697f9e1fa26b1bff48f33c824d3823 data/minecraft/tags/blocks/pressure_plates.json -add097a7a749bd1ebd5828216f013f6cd5b72b62 data/hexcasting/recipes/akashic_door.json -3e89b354e3eb8f8ec2518b03f13c5c4295adef5f data/hexcasting/recipes/dye_colorizer_lime.json -5d4811f78feefbef0a305555143f488b3dac7ac6 data/hexcasting/advancements/recipes/brainsweep/brainsweep/impetus_storedplayer.json -85fea90b80954899f236e52d3b3a25f305f8b9d5 data/hexcasting/advancements/recipes/hexcasting.creative_tab/scroll_paper_lantern.json -1ba431aef086bb60bfe8fe01b4d2bf5dfb7593c4 data/hexcasting/loot_tables/blocks/impetus_look.json -14d6be5d47b54676a349564ea32c045c76c39b45 data/hexcasting/recipes/uuid_colorizer.json -d6dfd0c6e995270868cb90de818d24b8a667fd01 data/hexcasting/advancements/recipes/hexcasting.creative_tab/dye_colorizer_purple.json -769de6bc8862c02c3364d20e304b21cfb0bfaf31 data/hexcasting/loot_tables/blocks/akashic_log.json -b8b58bbaf1ddca3514896af14db83f304e415305 data/minecraft/tags/blocks/trapdoors.json -5861845c3cd84021c7c19ac4f5b3bcc8e1bd3916 data/hexcasting/recipes/brainsweep/impetus_look.json -5a17fa9a1496f5fbedd0362f94a5231e0e5ebbfc data/hexcasting/advancements/recipes/hexcasting.creative_tab/ageing_scroll_paper_lantern.json -fa04d5bc32f5646cd67bc8e8b572bdb7849b735e data/hexcasting/recipes/akashic_bookshelf.json -b8bc2f7ab38646e63376b23f7490a17011908496 data/hexcasting/loot_tables/blocks/akashic_leaves1.json -c26bbff5a4aaaa4b5c26f61e8177fc382425149b data/hexcasting/loot_tables/inject/amethyst_cluster.json -0295cb6a13069d4e211c18132a2a40d57145b45c data/hexcasting/loot_tables/blocks/scroll_paper.json -48e782ce4fbd486dd0d6ceb9fdcb94d0e0c727d4 data/minecraft/tags/blocks/slabs.json -64aef53a076a34dbaaca0d3df8c671476729bec4 data/hexcasting/loot_tables/inject/scroll_loot_some.json -f3c6b6917e504e1c3d5d8875f7cce6f311e791d2 data/minecraft/tags/blocks/logs_that_burn.json -8886e95ddd696288c1f5706cbd63878a4a2bae3a data/hexcasting/loot_tables/blocks/akashic_planks.json -2ad42dd4a4877a23cb7f45e8b75c9f53f58d12f5 data/hexcasting/recipes/wand_acacia.json -b0b1c5fff194b92ff8c5d6468e177271fd910abd data/hexcasting/advancements/recipes/hexcasting.creative_tab/dye_colorizer_red.json -9c619750b17ac95e339882ce6c097ba9a000cc82 data/hexcasting/advancements/recipes/hexcasting.creative_tab/pride_colorizer_pansexual.json -21041998b3f1de0b45c731295576fc4b2ec6905a data/hexcasting/recipes/compat/create/crushing/amethyst_shard.json -2d79a41ba8697f9e1fa26b1bff48f33c824d3823 data/minecraft/tags/blocks/wooden_pressure_plates.json -8334a42636f045b4dc34c0fe5b3b3d3902aa4b7e data/hexcasting/recipes/scroll_small.json -584bd8806ef8df5f0e623ed727d6e54a61e60dea data/hexcasting/loot_tables/blocks/slate_block.json -c11dc4388c18dadff5d93126eb0f7ae848d627b9 data/hexcasting/advancements/recipes/brainsweep/brainsweep/directrix_redstone.json -5f3e3813757d8300acad523d45ac7c4d85728399 data/minecraft/tags/items/buttons.json -4066f098ef104eadf6729bb372d9e643c598b477 data/hexcasting/advancements/recipes/hexcasting.creative_tab/akashic_wood_stripped.json -ffe8e09c41222b5b909626436dbd7099e01ccc64 data/hexcasting/recipes/compat/farmersdelight/cutting/akashic_door.json -310e2440f26f130c81d32d9fcd93a3384c2b1e72 data/hexcasting/advancements/recipes/hexcasting.creative_tab/dye_colorizer_brown.json -5f3e3813757d8300acad523d45ac7c4d85728399 data/minecraft/tags/blocks/buttons.json -30950c6dd31102cf145f8f7d2979df0736a7ba1e data/hexcasting/advancements/recipes/hexcasting.creative_tab/wand_oak.json -9a24dcdf873dc97001efb487f6e00739c2ebf15c data/hexcasting/recipes/akashic_slab.json -3a60e7980813438657c180cc0650a7e96e3c9a65 data/hexcasting/tags/items/wands.json -bceac44311dc2771c3744c0cda299f03fb957350 data/hexcasting/loot_tables/blocks/scroll_paper_lantern.json -771e22cb013a2566773da73f3bd3dd48bef34830 data/hexcasting/loot_tables/blocks/akashic_trapdoor.json -b8b58bbaf1ddca3514896af14db83f304e415305 data/minecraft/tags/items/wooden_trapdoors.json -48e782ce4fbd486dd0d6ceb9fdcb94d0e0c727d4 data/minecraft/tags/items/slabs.json -fdce54a0e527322819787ec9232b24d401c45a29 data/hexcasting/advancements/recipes/hexcasting.creative_tab/pride_colorizer_demiboy.json -ef936e73eea3be9d53c4ac5c78d1477675550375 data/hexcasting/recipes/stonecutting/amethyst_tiles.json -88cf11d37222254d9e3a4bef0f9ca2de1495c31a data/hexcasting/recipes/dye_colorizer_white.json -0e95c5f97c4089d654334a0d58fbf2b808548bd0 data/hexcasting/advancements/recipes/hexcasting.creative_tab/dye_colorizer_gray.json -eb06eb90c08b051ff6c42215fb7c91123e240a66 data/hexcasting/recipes/dye_colorizer_purple.json -55dded121a8dddb2ee7fb1f3ffcdcd1ada4afbd5 data/hexcasting/advancements/recipes/hexcasting.creative_tab/akashic_wood.json -9d4704f96cc4cfa3275092fb58ff90c98449abe3 data/hexcasting/loot_tables/blocks/ancient_scroll_paper.json -022dc03ce6f2915459c7bf75d44ec0b8bb3e4083 data/hexcasting/recipes/wand_dark_oak.json -e454c9f48ec394f4d353c5a6c04641c9871b8798 data/hexcasting/advancements/recipes/hexcasting.creative_tab/pride_colorizer_transgender.json -9ddd0b27bb747d433eef17a9f1bd4f055e444f7a data/hexcasting/loot_tables/blocks/akashic_leaves2.json -c25784941d6416744fb2ca2d43a3203e5c3e7c8a data/minecraft/tags/blocks/leaves.json -a952d33cda8b805237052b602cf066683c4bf261 data/hexcasting/recipes/empty_directrix.json -f6fab3a3296d157a2b969af0c86eb0e5a9f14df4 data/hexcasting/recipes/wand_birch.json -b2d8fb979a3fbe47404da349318f38ab45bac760 data/hexcasting/recipes/pride_colorizer_plural.json -2397e64bd5fa2af12bb4f0f7efbc55f387c07a2b data/hexcasting/recipes/lens.json -d72a4675ceb721ee4ac43339d8bfbbb82c2adba2 data/hexcasting/advancements/recipes/hexcasting.creative_tab/slate_block.json -090b54b026f6fef2502295ddde5a60f5350e2ec6 data/hexcasting/advancements/recipes/hexcasting.creative_tab/artifact.json -d14cf2f8f0895a5b6dc09b7582c0abf1c2514adf data/hexcasting/recipes/sub_sandwich.json -b596d96eebb4f7bad5930f4eebc589f292b59c98 data/hexcasting/tags/items/akashic_planks.json -b8b58bbaf1ddca3514896af14db83f304e415305 data/minecraft/tags/items/trapdoors.json -f8d2872c4e692153049b6ae4879755a079954763 data/hexcasting/advancements/recipes/hexcasting.creative_tab/wand_spruce.json -26e9416771d97f9c716d07c27b1b5ca4a267eea2 data/hexcasting/loot_tables/blocks/amethyst_dust_block.json -05d435799cbf3ee1b51c5b4ffeace507691bcf2a data/hexcasting/advancements/recipes/hexcasting.creative_tab/pride_colorizer_gay.json -44d5d32647164e5510ecdbde22addbc047e4603a data/hexcasting/recipes/dye_colorizer_cyan.json -8aa3d09d72255aa4da497ab4225654961063a496 data/hexcasting/recipes/ancient_scroll_paper.json -e5ae652aee1567ac2e626fa0f88f160993a6f9a5 data/hexcasting/advancements/recipes/hexcasting.creative_tab/amethyst_dust_unpacking.json -7c0107192c0e24ff9f23ab0f59834b6081ca5b33 data/hexcasting/advancements/recipes/hexcasting.creative_tab/wand_crimson.json -1266b263056dd15c862bff27b05a119c4bbc89ee data/hexcasting/advancements/recipes/hexcasting.creative_tab/akashic_door.json -a92e5560c774bb81cd9f38bd9378af8695cac622 data/hexcasting/recipes/akashic_stairs.json -8a9b22b846968e9120c3a63a9f18694aa5703cab data/create/recipes/crushing/amethyst_cluster.json -f3a33396e071f3afd61eadab2aabdb9acf2ae775 data/hexcasting/recipes/slate.json -f7bbc60f547a02378ddb1f23395add4822725fed data/hexcasting/recipes/wand_oak.json -0529b25d154715d6b1c030d87e59e6f9d41d91d6 data/hexcasting/recipes/focus.json -5b9b1c15c7a157aa56b3caa7d43a6ad1fa8f4710 data/hexcasting/loot_tables/blocks/akashic_bookshelf.json -29260d23193f414236b0278a5abd7fe1f7ba8b46 data/hexcasting/advancements/recipes/hexcasting.creative_tab/dye_colorizer_black.json -fc57d15e9f9f11347a2170dd06053954345368d2 data/hexcasting/advancements/recipes/hexcasting.creative_tab/lens.json -cd63a4179aa8c6aff90b251995bc4e8e1a71a784 data/hexcasting/loot_tables/blocks/akashic_leaves3.json -f3c6b6917e504e1c3d5d8875f7cce6f311e791d2 data/hexcasting/tags/blocks/akashic_logs.json -66e51300dc72c27ed8024ddf852ac9a6208a66b1 data/hexcasting/advancements/recipes/hexcasting.creative_tab/akashic_bookshelf.json -3b082fff535586c13c12811a29839eb0096bfdb1 data/hexcasting/recipes/dye_colorizer_green.json -d4328adfccf702d2de3eb6098a47c95e429b7b28 data/hexcasting/loot_tables/blocks/akashic_door.json -186dc05888e66e17af0217bd0680648dc3da3968 data/hexcasting/recipes/dye_colorizer_orange.json -737ac05e20d6633abd383d654f7cd7e92564447b data/hexcasting/loot_tables/blocks/directrix_redstone.json -b7c248d2627c2a2b398d1c50181c1e0863612424 data/hexcasting/recipes/empty_impetus.json -3fe1fcf17e1e25aebede47c537f92888330ccf9f data/hexcasting/advancements/recipes/hexcasting.creative_tab/abacus.json -4dc3f5865d69a604923cb59f4a3eed7b4aa175cf data/hexcasting/recipes/ageing_scroll_paper_lantern.json -eb4bfbd7fc7632a5c16aa1d50d6090a1f466069b data/minecraft/tags/blocks/mineable/pickaxe.json -43071f2aa09fa59dd8f0211a68c842dac833be02 data/hexcasting/advancements/recipes/hexcasting.creative_tab/scroll.json -37584409884ac4d9fbf7f0a4a3cb8ef3b5d32965 data/hexcasting/recipes/pride_colorizer_agender.json -556d2e6068965e90c307a435b372ae761cd1c606 data/minecraft/tags/items/doors.json -804f0e5c6c32c7310129437ccca3ffc148bb973b data/hexcasting/advancements/recipes/hexcasting.creative_tab/wand_acacia.json -3b2bcffe70bb1f732f06c2560cef66de6c273d62 data/hexcasting/advancements/recipes/hexcasting.creative_tab/wand_warped.json -ddd7bd92b9e1586cebd2cee658315a9336a80a76 data/hexcasting/advancements/recipes/hexcasting.creative_tab/amethyst_dust_packing.json -318c04242e7b9c302e68b3bfe6dd11ec0fc8a863 data/hexcasting/advancements/recipes/hexcasting.creative_tab/wand_jungle.json -2c542a616b312e41537fb25a2362877dd50d2692 data/hexcasting/recipes/akashic_connector.json -6837c1fe0ab23167ca8475086b28115369227e0c data/hexcasting/advancements/recipes/hexcasting.creative_tab/dye_colorizer_light_gray.json -5e6df78e451395e08f86c8d89dca0a2c99a69691 data/hexcasting/recipes/pride_colorizer_aromantic.json -c2a362b8c19cb288187d8ff340f82198edc54378 data/hexcasting/advancements/recipes/brainsweep/brainsweep/budding_amethyst.json -b9083c4c0a7a365bdfd785a21826a89dc8d5db52 data/hexcasting/loot_tables/blocks/akashic_record.json -2d52419f3fcdc10643cdb8cef89858efc0ad4d11 data/hexcasting/advancements/recipes/hexcasting.creative_tab/wand_akashic.json -ac285195e958804bcbd0b87e443d2851fd3a4856 data/hexcasting/recipes/akashic_tile.json -f3c6b6917e504e1c3d5d8875f7cce6f311e791d2 data/minecraft/tags/blocks/logs.json -b42dae604eab34ae3831fa16c063af852c175791 data/hexcasting/advancements/recipes/hexcasting.creative_tab/ancient_scroll_paper.json -339dc062b4d8d0c4fa2d1eccd2935b4c37ec75c6 data/hexcasting/advancements/recipes/hexcasting.creative_tab/dye_colorizer_pink.json -ce9ca7b98a89540996f2ad18eea98e31df7974b5 data/hexcasting/recipes/akashic_planks.json -2d80cb505efc0ba0d34d1768413128fcda17630f data/hexcasting/advancements/recipes/hexcasting.creative_tab/pride_colorizer_demigirl.json -a639b071a5f4738ddf798fcac041a5002657e146 data/hexcasting/recipes/jeweler_hammer.json -d7f85ce9d46aacc7ec89dc7aa0f88a331ccfbae7 data/hexcasting/recipes/brainsweep/akashic_record.json -ce79c9e183b57bfbdb75cd074d7ff6e48894d05c data/hexcasting/loot_tables/blocks/akashic_connector.json -f3c6b6917e504e1c3d5d8875f7cce6f311e791d2 data/minecraft/tags/items/logs.json -49b6ea97ddc55ef3d7fa47582f268a07a35cadde data/hexcasting/loot_tables/blocks/slate.json -ac128e72adda8fea0ad63d7e6e18dd9399f53d65 data/hexcasting/recipes/pride_colorizer_intersex.json -99aae9efc13ff2b8a4612579b2f865ed2fbe8985 data/hexcasting/advancements/recipes/hexcasting.creative_tab/akashic_tile.json -eb771389a05a4cdfb98286942f2a65bf2a77458f data/hexcasting/advancements/recipes/hexcasting.creative_tab/pride_colorizer_lesbian.json -d8825a8cbaf100d309b4bd8ac26ed22b020011cb data/hexcasting/advancements/recipes/hexcasting.creative_tab/scroll_medium.json -556d2e6068965e90c307a435b372ae761cd1c606 data/minecraft/tags/blocks/doors.json -f089ab17470c5fa0065438c5533d5fafb3ee8eaf data/hexcasting/advancements/recipes/hexcasting.creative_tab/focus.json -39a4ba8180e45cab481184d2bcdc217893244446 data/hexcasting/advancements/recipes/hexcasting.creative_tab/pride_colorizer_asexual.json -cd7e618d7c08ffff67683852f799362fb8aaebaf data/hexcasting/recipes/pride_colorizer_nonbinary.json -9fcc0862c99c50a1df9d3af95b2b3c2af28afa1b data/hexcasting/advancements/recipes/hexcasting.creative_tab/slate_block_from_slates.json -48e782ce4fbd486dd0d6ceb9fdcb94d0e0c727d4 data/minecraft/tags/items/wooden_slabs.json -cf855b595844c6f2522c0ad18030519279b396ad data/hexcasting/advancements/recipes/hexcasting.creative_tab/dye_colorizer_magenta.json -91bb341776ce64a68e1c4200aa8f5b2fa6669820 data/hexcasting/recipes/amethyst_dust_unpacking.json -d5122f034678cc53a2921c65f30451caf708046c data/hexcasting/advancements/recipes/hexcasting.creative_tab/akashic_trapdoor.json -a84bf48a188d7b250db5c971a6d9b63d82279ba3 data/hexcasting/recipes/akashic_wood.json -3f9756b2c5137b285c4faa88ab43c4996b6b2bb6 data/hexcasting/recipes/ancient_scroll_paper_lantern.json -c375ba3f7105d6f57ef982f6f4e9326ad88a947d data/hexcasting/loot_tables/blocks/ancient_scroll_paper_lantern.json -b596d96eebb4f7bad5930f4eebc589f292b59c98 data/hexcasting/tags/blocks/akashic_planks.json -4d8667ebdad42e7220009f69a1f6f465a73b2a9a data/hexcasting/recipes/compat/farmersdelight/cutting/akashic_wood.json -a27a2514fd3acb6cf0a4f2a6b176ca4c2a3ee064 data/hexcasting/advancements/recipes/hexcasting.creative_tab/dye_colorizer_cyan.json -1d19457c9843d97d2ed59199d9077940d9e5e46a data/hexcasting/recipes/akashic_button.json -b596d96eebb4f7bad5930f4eebc589f292b59c98 data/minecraft/tags/blocks/planks.json -42441ca3b389ea4db8a4153ec363847f0ca6e714 data/hexcasting/loot_tables/blocks/akashic_panel.json -8dab47781281a29e39cb8e6c4da6a27f916e0646 data/hexcasting/advancements/recipes/hexcasting.creative_tab/pride_colorizer_nonbinary.json -7a535e710c96e39a17606a10bc1f153d7c57b8e7 data/hexcasting/advancements/recipes/hexcasting.creative_tab/akashic_pressure_plate.json -26782da27b3ce2dcab8545f672d68fe1a8549f35 data/hexcasting/advancements/recipes/hexcasting.creative_tab/akashic_slab.json -6f904b1ac6fc5863a8e718bc42043c40d5ec4c2a data/hexcasting/recipes/dye_colorizer_pink.json -16705d340500a2796facb4256852fd3d8e9775f8 data/hexcasting/loot_tables/blocks/akashic_wood.json -b3583f65db5e1eaae0426b14416c076982ca3685 data/hexcasting/advancements/recipes/hexcasting.creative_tab/pride_colorizer_aroace.json -d6355142e6edb7964c95997dc877a3652081f793 data/hexcasting/loot_tables/blocks/amethyst_tiles.json -a4f3fed2e6ddc8e60a19a1a51bd5b54904a43fa8 data/hexcasting/advancements/recipes/hexcasting.creative_tab/pride_colorizer_agender.json -456ae69977612b6f62c109783518e9006287e77b data/hexcasting/recipes/pride_colorizer_genderqueer.json -563cb6dda9c55864f141f2ec0ecd2a2b95f57237 data/hexcasting/advancements/recipes/hexcasting.creative_tab/amethyst_tiles.json -86ee80768fef41cf9b517564b733f4586094f367 data/hexcasting/recipes/scroll_medium.json -b519fd81671c9cb8d909bbfd0d4017d2005432d3 data/hexcasting/advancements/recipes/hexcasting.creative_tab/dye_colorizer_blue.json -556d2e6068965e90c307a435b372ae761cd1c606 data/minecraft/tags/blocks/wooden_doors.json -5c471f81cc168826f1652a39a71aeb85e786ea16 data/hexcasting/recipes/scroll_paper_lantern.json -7c607fdc60aac2b78394931fc39ae24a1a3dd3d2 data/hexcasting/loot_tables/blocks/empty_directrix.json -337c4370fd24b66a6b4b3f6c296a33d9a799034e data/hexcasting/advancements/recipes/hexcasting.creative_tab/amethyst_sconce.json -5f3e3813757d8300acad523d45ac7c4d85728399 data/minecraft/tags/items/wooden_buttons.json -eb17a23e7a9543f33922c056cdf0d63def176bf2 data/hexcasting/advancements/recipes/hexcasting.creative_tab/uuid_colorizer.json -d7213631b2f9075c9bdef0d5a48ca28f85f5a090 data/hexcasting/advancements/recipes/hexcasting.creative_tab/scroll_paper.json -9c857c4aeda8a1b3d7a1b5d341871a9434b5816f data/hexcasting/advancements/recipes/hexcasting.creative_tab/dye_colorizer_yellow.json -149179e18b1b8db5dc3fb96e6faa6cb6ffaecb75 data/hexcasting/advancements/recipes/hexcasting.creative_tab/akashic_panel.json -1157a6545ece0e2b8734b8a1428f9a3c021c8b73 data/hexcasting/recipes/wand_akashic.json -4d1c771493f5968a0878c142342ceb8717a5784f data/hexcasting/recipes/dye_colorizer_magenta.json -1dc89dff5d4fadb95d9b5a2a5a910f63ea4b02bf data/minecraft/tags/blocks/crystal_sound_blocks.json -05e86742a71afd740f47639be62f93bc9898fcde data/c/tags/items/gems.json -0a72e213fec8dd32b1ea9623a242484ce8318c47 data/hexcasting/recipes/pride_colorizer_asexual.json -ccf4ea841ea9a66738253385c659ff86c85a73f5 data/hexcasting/recipes/scroll_paper.json -0cd94b91d64a31a251eebbb37845d165c603452e data/hexcasting/recipes/wand_crimson.json -0ca193fe94bc004aa0080826ed0fc4596f9a62dd data/hexcasting/recipes/pride_colorizer_genderfluid.json -08f14a615c6c8c0b8a08a56af000c1e1991732d3 data/hexcasting/advancements/recipes/hexcasting.creative_tab/trinket.json -a2ea936ff220d9faa168ffbc60a9823de2119ac5 data/hexcasting/recipes/cypher.json -7077bb190244008a715eab451c80e8d489844c01 data/hexcasting/loot_tables/blocks/empty_impetus.json -bb5c04fa0e6d0b3322f3b24d49d1a30a5b790889 data/hexcasting/loot_tables/blocks/akashic_slab.json -ccc33b4f1a43c8ecd3352ad36ae2dd2191317b5b data/hexcasting/advancements/recipes/hexcasting.creative_tab/dye_colorizer_white.json -b8b58bbaf1ddca3514896af14db83f304e415305 data/minecraft/tags/blocks/wooden_trapdoors.json -6f33e68b62de15df1673b772d37171b130e3c9bb data/hexcasting/advancements/recipes/hexcasting.creative_tab/pride_colorizer_plural.json -f55afc2c05d93b5a44bc9fd73c5e81e71b183965 data/minecraft/tags/blocks/mineable/shovel.json -fe60c763bfe0afa0a266b7390edfc62bde8941b7 data/hexcasting/tags/items/phial_base.json -8df59ac1ca676bf1a506f3116fd273d6379f238e data/hexcasting/recipes/dye_colorizer_gray.json -c3a01df30228881c199686192d105fb2651c39c8 data/hexcasting/recipes/pride_colorizer_aroace.json -59000d9f3edb942081f7d1e03d753e9cd59690cc data/hexcasting/advancements/recipes/hexcasting.creative_tab/sub_sandwich.json -49508c455626eeca18c957edc0cde016e823f7b0 data/hexcasting/recipes/scroll.json -6f5c41ab9f87ec1206efaaab8d91adc766bb79fd data/hexcasting/recipes/slate_block_from_slates.json -f74f8389f1e8bdb77a92ecfb8d7d7d6f4418d818 data/hexcasting/recipes/akashic_panel.json -72795bfbffffa8ab2a02c869f16447167f4fd179 data/hexcasting/loot_tables/blocks/akashic_pressure_plate.json -1d558c1b63dd3c3e129261f53db5fd6748b59051 data/hexcasting/recipes/pride_colorizer_lesbian.json -cf0ad981bebbb79414d955fb40fbf537fe88b89d data/hexcasting/advancements/recipes/brainsweep/brainsweep/akashic_record.json -c386a7294db6ed97f9b131cb8402ca6203092b63 data/hexcasting/recipes/akashic_wood_stripped.json -e5c835d3866e8f5ecfb03c9e7c2c134a50951d67 data/hexcasting/recipes/amethyst_tiles.json -bc490780a689c62da00244137679bbaa8a653430 data/hexcasting/recipes/dye_colorizer_brown.json -f332cdebf9c53edec6cb3903f65d4ccc1398f849 data/hexcasting/advancements/recipes/hexcasting.creative_tab/pride_colorizer_aromantic.json -64686e6d1a10a4bd16ec0378dc9ce720eff3b4d7 data/hexcasting/recipes/dye_colorizer_light_gray.json -484be1c50092772587dd18769e63ee3ab22ad971 data/hexcasting/advancements/recipes/hexcasting.creative_tab/dye_colorizer_orange.json -c25784941d6416744fb2ca2d43a3203e5c3e7c8a data/minecraft/tags/items/leaves.json -62b120d8943a9e73778ad1468f12532b21774994 data/hexcasting/recipes/akashic_trapdoor.json -ef016ca292fa4edc7496b64e6f2931f4e7d90636 data/hexcasting/recipes/amethyst_dust_packing.json -35a9b4beac7c6eddb990464eaeaebec2a9ab9951 data/hexcasting/loot_tables/inject/scroll_loot_many.json -949f05968c562d5e4d35630ce8e3189a2060dee7 data/hexcasting/advancements/recipes/hexcasting.creative_tab/pride_colorizer_intersex.json -d189977c9c5d2048ba1ba40ee49d182af2836330 data/create/recipes/crushing/amethyst_block.json -02dcee696b1e162f20dbfcf02bdb9e2144a64a27 data/hexcasting/recipes/pride_colorizer_gay.json -7c08784f2de139be380b5299f8ea8b8c78126ed8 data/minecraft/tags/blocks/mineable/axe.json -32e3d36398fa63e017ed6c46e7e19d7ba041c3d9 data/hexcasting/recipes/pride_colorizer_bisexual.json -1af91ec74694bf90fb7f53b6d55078c7e21460cc data/hexcasting/advancements/recipes/hexcasting.creative_tab/pride_colorizer_genderqueer.json -f3c6b6917e504e1c3d5d8875f7cce6f311e791d2 data/minecraft/tags/items/logs_that_burn.json -ef8563a18c0bb3999a1092efe37540ea474633c5 data/hexcasting/recipes/dye_colorizer_light_blue.json -3b1c077f88f625c0b2653324c7b94fd3f2b3a538 data/hexcasting/loot_tables/blocks/akashic_tile.json -db8a00478e1c4b0f9b143b5946d1ba25e489591d data/hexcasting/recipes/dynamic/seal_focus.json -196c49b203748e57a9b2b1259055b9de4b6be8d8 data/hexcasting/recipes/wand_spruce.json -09e80537530ed51b6792f16fe8b32448e89dc334 data/hexcasting/recipes/slate_block.json -31f9b7d8141f67981deedf7a46894e454006bb28 data/hexcasting/advancements/recipes/hexcasting.creative_tab/akashic_button.json -6b4459635b3d53cc2b6836fa97d29244a65b412d data/hexcasting/recipes/abacus.json -1b96773128b11946ff4f30d5aa4040f9e04d0d40 data/hexcasting/recipes/pride_colorizer_demiboy.json -076dd8bb2ce1508293384fa93fa138a369d10751 data/hexcasting/advancements/recipes/hexcasting.creative_tab/dye_colorizer_green.json -3147422bed290cb47ea3763dbdc6f0e96eed5c2a data/hexcasting/loot_tables/inject/scroll_loot_few.json -aab3082b3303f358cc265fb10bc9bbe08c96eef0 data/hexcasting/recipes/trinket.json -77afbbd8280136eb11d1aab1219d6057063e8f75 data/hexcasting/recipes/compat/farmersdelight/cutting/akashic_trapdoor.json -c3aed1dbaa46e084711a116d1bb4522df9a7405a data/hexcasting/advancements/recipes/hexcasting.creative_tab/dye_colorizer_light_blue.json -3a376402af89128dc37adaa0a72b6de66d58309d data/hexcasting/recipes/dynamic/seal_spellbook.json -2ec90cd941acad6eabfb38d21466ef8e9b9bf2c1 data/hexcasting/recipes/wand_jungle.json -48e782ce4fbd486dd0d6ceb9fdcb94d0e0c727d4 data/minecraft/tags/blocks/wooden_slabs.json -7cb828138a8ea2dae399011ee02bb909ca5f993e data/hexcasting/loot_tables/blocks/akashic_log_stripped.json -3b566309ba10142fe73c8f32ce501592befd907e data/hexcasting/loot_tables/blocks/akashic_stairs.json -ab5d271371323d93ff6eed18179ee4f7fd8c939c data/hexcasting/recipes/brainsweep/impetus_rightclick.json -8c22db477365a800ce1e715aeaad896550467047 data/hexcasting/recipes/dye_colorizer_black.json -f3c6b6917e504e1c3d5d8875f7cce6f311e791d2 data/hexcasting/tags/items/akashic_logs.json -c64f5e56ca18eb68d2e58827920ca0e3ae4617ca data/hexcasting/recipes/dye_colorizer_blue.json -5f3e3813757d8300acad523d45ac7c4d85728399 data/minecraft/tags/blocks/wooden_buttons.json -e125117befadda0785e370969a8e04eff070d057 data/hexcasting/loot_tables/blocks/amethyst_sconce.json -b8825decc5079bbe72c8a189e36bda2efefaf26f data/hexcasting/recipes/compat/farmersdelight/cutting/akashic_log.json -4da41a82a17f58c9342944f214e745696c1d8ed7 data/hexcasting/loot_tables/blocks/impetus_storedplayer.json -67d4c536be3762833a4af33cd7cdfc68eb4ad629 data/hexcasting/advancements/recipes/hexcasting.creative_tab/wand_dark_oak.json -22ad2496732633bb5539a1fa761051d7add48055 data/hexcasting/advancements/recipes/hexcasting.creative_tab/slate.json -168749d413b20bb9c05a8e7191758e0e596a319b data/hexcasting/advancements/recipes/hexcasting.creative_tab/akashic_connector.json -30f81e0537c625a4cafcdec75314926569291171 data/hexcasting/recipes/brainsweep/budding_amethyst.json -86424d21e1bf91c128d3b0d528b813629ad962e9 data/hexcasting/advancements/recipes/brainsweep/brainsweep/impetus_look.json -f32ccb2d36d773215d91dee46bec70a20af501c3 data/hexcasting/advancements/recipes/hexcasting.creative_tab/wand_birch.json +196c49b203748e57a9b2b1259055b9de4b6be8d8 data\hexcasting\recipes\wand_spruce.json +ef8563a18c0bb3999a1092efe37540ea474633c5 data\hexcasting\recipes\dye_colorizer_light_blue.json +e125117befadda0785e370969a8e04eff070d057 data\hexcasting\loot_tables\blocks\amethyst_sconce.json +5f3e3813757d8300acad523d45ac7c4d85728399 data\minecraft\tags\blocks\wooden_buttons.json +26782da27b3ce2dcab8545f672d68fe1a8549f35 data\hexcasting\advancements\recipes\hexcasting.creative_tab\akashic_slab.json +f50c71bbbbf7d77665c9008fcdd9be0d571ce48e data\hexcasting\recipes\pride_colorizer_transgender.json +8aa3d09d72255aa4da497ab4225654961063a496 data\hexcasting\recipes\ancient_scroll_paper.json +3b082fff535586c13c12811a29839eb0096bfdb1 data\hexcasting\recipes\dye_colorizer_green.json +7a535e710c96e39a17606a10bc1f153d7c57b8e7 data\hexcasting\advancements\recipes\hexcasting.creative_tab\akashic_pressure_plate.json +c26bbff5a4aaaa4b5c26f61e8177fc382425149b data\hexcasting\loot_tables\inject\amethyst_cluster.json +090b54b026f6fef2502295ddde5a60f5350e2ec6 data\hexcasting\advancements\recipes\hexcasting.creative_tab\artifact.json +49b6ea97ddc55ef3d7fa47582f268a07a35cadde data\hexcasting\loot_tables\blocks\slate.json +9fcc0862c99c50a1df9d3af95b2b3c2af28afa1b data\hexcasting\advancements\recipes\hexcasting.creative_tab\slate_block_from_slates.json +4f852507d843f82dce1512f55abfb205b9829ed4 data\hexcasting\advancements\recipes\hexcasting.creative_tab\akashic_planks.json +2397e64bd5fa2af12bb4f0f7efbc55f387c07a2b data\hexcasting\recipes\lens.json +26e9416771d97f9c716d07c27b1b5ca4a267eea2 data\hexcasting\loot_tables\blocks\amethyst_dust_block.json +8a9b22b846968e9120c3a63a9f18694aa5703cab data\create\recipes\crushing\amethyst_cluster.json +3e49b1076839e73e871faf64262f96bed22a6b1d data\hexcasting\recipes\artifact.json +add097a7a749bd1ebd5828216f013f6cd5b72b62 data\hexcasting\recipes\akashic_door.json +9c619750b17ac95e339882ce6c097ba9a000cc82 data\hexcasting\advancements\recipes\hexcasting.creative_tab\pride_colorizer_pansexual.json +85fea90b80954899f236e52d3b3a25f305f8b9d5 data\hexcasting\advancements\recipes\hexcasting.creative_tab\scroll_paper_lantern.json +7351200c8e3eb24772852c578286384c8aab61bd data\hexcasting\advancements\recipes\hexcasting.creative_tab\empty_directrix.json +64aef53a076a34dbaaca0d3df8c671476729bec4 data\hexcasting\loot_tables\inject\scroll_loot_some.json +eb17a23e7a9543f33922c056cdf0d63def176bf2 data\hexcasting\advancements\recipes\hexcasting.creative_tab\uuid_colorizer.json +8c22db477365a800ce1e715aeaad896550467047 data\hexcasting\recipes\dye_colorizer_black.json +bceac44311dc2771c3744c0cda299f03fb957350 data\hexcasting\loot_tables\blocks\scroll_paper_lantern.json +4066f098ef104eadf6729bb372d9e643c598b477 data\hexcasting\advancements\recipes\hexcasting.creative_tab\akashic_wood_stripped.json +a27a2514fd3acb6cf0a4f2a6b176ca4c2a3ee064 data\hexcasting\advancements\recipes\hexcasting.creative_tab\dye_colorizer_cyan.json +d6dfd0c6e995270868cb90de818d24b8a667fd01 data\hexcasting\advancements\recipes\hexcasting.creative_tab\dye_colorizer_purple.json +b7c248d2627c2a2b398d1c50181c1e0863612424 data\hexcasting\recipes\empty_impetus.json +d5122f034678cc53a2921c65f30451caf708046c data\hexcasting\advancements\recipes\hexcasting.creative_tab\akashic_trapdoor.json +5d4811f78feefbef0a305555143f488b3dac7ac6 data\hexcasting\advancements\recipes\brainsweep\brainsweep\impetus_storedplayer.json +f3c6b6917e504e1c3d5d8875f7cce6f311e791d2 data\hexcasting\tags\items\akashic_logs.json +35a9b4beac7c6eddb990464eaeaebec2a9ab9951 data\hexcasting\loot_tables\inject\scroll_loot_many.json +6837c1fe0ab23167ca8475086b28115369227e0c data\hexcasting\advancements\recipes\hexcasting.creative_tab\dye_colorizer_light_gray.json +556d2e6068965e90c307a435b372ae761cd1c606 data\minecraft\tags\items\doors.json +6f904b1ac6fc5863a8e718bc42043c40d5ec4c2a data\hexcasting\recipes\dye_colorizer_pink.json +43071f2aa09fa59dd8f0211a68c842dac833be02 data\hexcasting\advancements\recipes\hexcasting.creative_tab\scroll.json +f3c6b6917e504e1c3d5d8875f7cce6f311e791d2 data\minecraft\tags\blocks\logs.json +b2d8fb979a3fbe47404da349318f38ab45bac760 data\hexcasting\recipes\pride_colorizer_plural.json +e0ff0fe75be853b849f84b05787c1c791fa9e208 data\hexcasting\advancements\recipes\hexcasting.creative_tab\akashic_stairs.json +c25784941d6416744fb2ca2d43a3203e5c3e7c8a data\minecraft\tags\items\leaves.json +310e2440f26f130c81d32d9fcd93a3384c2b1e72 data\hexcasting\advancements\recipes\hexcasting.creative_tab\dye_colorizer_brown.json +737ac05e20d6633abd383d654f7cd7e92564447b data\hexcasting\loot_tables\blocks\directrix_redstone.json +2ec90cd941acad6eabfb38d21466ef8e9b9bf2c1 data\hexcasting\recipes\wand_jungle.json +b8b58bbaf1ddca3514896af14db83f304e415305 data\minecraft\tags\blocks\wooden_trapdoors.json +874ee348cf2542696b7768049529a2001f0820e7 data\hexcasting\advancements\recipes\hexcasting.creative_tab\jeweler_hammer.json +5f3e3813757d8300acad523d45ac7c4d85728399 data\minecraft\tags\items\wooden_buttons.json +7077bb190244008a715eab451c80e8d489844c01 data\hexcasting\loot_tables\blocks\empty_impetus.json +1d558c1b63dd3c3e129261f53db5fd6748b59051 data\hexcasting\recipes\pride_colorizer_lesbian.json +cf0ad981bebbb79414d955fb40fbf537fe88b89d data\hexcasting\advancements\recipes\brainsweep\brainsweep\akashic_record.json +39ef3ab2effbae595b45400e7db7a8ad693e0d13 data\hexcasting\recipes\pride_colorizer_pansexual.json +0cd94b91d64a31a251eebbb37845d165c603452e data\hexcasting\recipes\wand_crimson.json +ce9ca7b98a89540996f2ad18eea98e31df7974b5 data\hexcasting\recipes\akashic_planks.json +f3c6b6917e504e1c3d5d8875f7cce6f311e791d2 data\minecraft\tags\items\logs.json +484be1c50092772587dd18769e63ee3ab22ad971 data\hexcasting\advancements\recipes\hexcasting.creative_tab\dye_colorizer_orange.json +0ca193fe94bc004aa0080826ed0fc4596f9a62dd data\hexcasting\recipes\pride_colorizer_genderfluid.json +4345c060715ce9bf341c5c2b9bb5ca0871282241 data\hexcasting\advancements\recipes\hexcasting.creative_tab\pride_colorizer_genderfluid.json +bc490780a689c62da00244137679bbaa8a653430 data\hexcasting\recipes\dye_colorizer_brown.json +b475e6d26350d0560e2cd66879f86520faaeb68c data\hexcasting\recipes\dye_colorizer_red.json +b9083c4c0a7a365bdfd785a21826a89dc8d5db52 data\hexcasting\loot_tables\blocks\akashic_record.json +949f05968c562d5e4d35630ce8e3189a2060dee7 data\hexcasting\advancements\recipes\hexcasting.creative_tab\pride_colorizer_intersex.json +fa04d5bc32f5646cd67bc8e8b572bdb7849b735e data\hexcasting\recipes\akashic_bookshelf.json +3f9756b2c5137b285c4faa88ab43c4996b6b2bb6 data\hexcasting\recipes\ancient_scroll_paper_lantern.json +1157a6545ece0e2b8734b8a1428f9a3c021c8b73 data\hexcasting\recipes\wand_akashic.json +2c542a616b312e41537fb25a2362877dd50d2692 data\hexcasting\recipes\akashic_connector.json +ffe8e09c41222b5b909626436dbd7099e01ccc64 data\hexcasting\recipes\compat\farmersdelight\cutting\akashic_door.json +2d79a41ba8697f9e1fa26b1bff48f33c824d3823 data\minecraft\tags\blocks\pressure_plates.json +1ba431aef086bb60bfe8fe01b4d2bf5dfb7593c4 data\hexcasting\loot_tables\blocks\impetus_look.json +f3e78a96f17dc5ed54047bb24be58dbf3151c8fa data\hexcasting\advancements\recipes\hexcasting.creative_tab\ancient_scroll_paper_lantern.json +fc57d15e9f9f11347a2170dd06053954345368d2 data\hexcasting\advancements\recipes\hexcasting.creative_tab\lens.json +5c471f81cc168826f1652a39a71aeb85e786ea16 data\hexcasting\recipes\scroll_paper_lantern.json +4d8667ebdad42e7220009f69a1f6f465a73b2a9a data\hexcasting\recipes\compat\farmersdelight\cutting\akashic_wood.json +9d4704f96cc4cfa3275092fb58ff90c98449abe3 data\hexcasting\loot_tables\blocks\ancient_scroll_paper.json +ab5d271371323d93ff6eed18179ee4f7fd8c939c data\hexcasting\recipes\brainsweep\impetus_rightclick.json +48e782ce4fbd486dd0d6ceb9fdcb94d0e0c727d4 data\minecraft\tags\items\slabs.json +318c04242e7b9c302e68b3bfe6dd11ec0fc8a863 data\hexcasting\advancements\recipes\hexcasting.creative_tab\wand_jungle.json +563cb6dda9c55864f141f2ec0ecd2a2b95f57237 data\hexcasting\advancements\recipes\hexcasting.creative_tab\amethyst_tiles.json +7c607fdc60aac2b78394931fc39ae24a1a3dd3d2 data\hexcasting\loot_tables\blocks\empty_directrix.json +022dc03ce6f2915459c7bf75d44ec0b8bb3e4083 data\hexcasting\recipes\wand_dark_oak.json +b596d96eebb4f7bad5930f4eebc589f292b59c98 data\minecraft\tags\blocks\planks.json +fdce54a0e527322819787ec9232b24d401c45a29 data\hexcasting\advancements\recipes\hexcasting.creative_tab\pride_colorizer_demiboy.json +1d19457c9843d97d2ed59199d9077940d9e5e46a data\hexcasting\recipes\akashic_button.json +3b566309ba10142fe73c8f32ce501592befd907e data\hexcasting\loot_tables\blocks\akashic_stairs.json +c3aed1dbaa46e084711a116d1bb4522df9a7405a data\hexcasting\advancements\recipes\hexcasting.creative_tab\dye_colorizer_light_blue.json +14d6be5d47b54676a349564ea32c045c76c39b45 data\hexcasting\recipes\uuid_colorizer.json +339dc062b4d8d0c4fa2d1eccd2935b4c37ec75c6 data\hexcasting\advancements\recipes\hexcasting.creative_tab\dye_colorizer_pink.json +f8d2872c4e692153049b6ae4879755a079954763 data\hexcasting\advancements\recipes\hexcasting.creative_tab\wand_spruce.json +d910f10b472c3ff422f14961539e4c31b8830bff data\hexcasting\recipes\dye_colorizer_yellow.json +3e89b354e3eb8f8ec2518b03f13c5c4295adef5f data\hexcasting\recipes\dye_colorizer_lime.json +2d79a41ba8697f9e1fa26b1bff48f33c824d3823 data\minecraft\tags\blocks\wooden_pressure_plates.json +b596d96eebb4f7bad5930f4eebc589f292b59c98 data\hexcasting\tags\items\akashic_planks.json +d6355142e6edb7964c95997dc877a3652081f793 data\hexcasting\loot_tables\blocks\amethyst_tiles.json +168749d413b20bb9c05a8e7191758e0e596a319b data\hexcasting\advancements\recipes\hexcasting.creative_tab\akashic_connector.json +f55afc2c05d93b5a44bc9fd73c5e81e71b183965 data\minecraft\tags\blocks\mineable\shovel.json +9a24dcdf873dc97001efb487f6e00739c2ebf15c data\hexcasting\recipes\akashic_slab.json +769de6bc8862c02c3364d20e304b21cfb0bfaf31 data\hexcasting\loot_tables\blocks\akashic_log.json +1266b263056dd15c862bff27b05a119c4bbc89ee data\hexcasting\advancements\recipes\hexcasting.creative_tab\akashic_door.json +d14cf2f8f0895a5b6dc09b7582c0abf1c2514adf data\hexcasting\recipes\sub_sandwich.json +4dc3f5865d69a604923cb59f4a3eed7b4aa175cf data\hexcasting\recipes\ageing_scroll_paper_lantern.json +f74f8389f1e8bdb77a92ecfb8d7d7d6f4418d818 data\hexcasting\recipes\akashic_panel.json +4da41a82a17f58c9342944f214e745696c1d8ed7 data\hexcasting\loot_tables\blocks\impetus_storedplayer.json +c11dc4388c18dadff5d93126eb0f7ae848d627b9 data\hexcasting\advancements\recipes\brainsweep\brainsweep\directrix_redstone.json +186dc05888e66e17af0217bd0680648dc3da3968 data\hexcasting\recipes\dye_colorizer_orange.json +d3ad9a9e92dd125f872d9671930d4e57f24894ed data\hexcasting\recipes\pride_colorizer_demigirl.json +2ad42dd4a4877a23cb7f45e8b75c9f53f58d12f5 data\hexcasting\recipes\wand_acacia.json +77afbbd8280136eb11d1aab1219d6057063e8f75 data\hexcasting\recipes\compat\farmersdelight\cutting\akashic_trapdoor.json +2d79a41ba8697f9e1fa26b1bff48f33c824d3823 data\minecraft\tags\items\wooden_pressure_plates.json +ce79c9e183b57bfbdb75cd074d7ff6e48894d05c data\hexcasting\loot_tables\blocks\akashic_connector.json +d7213631b2f9075c9bdef0d5a48ca28f85f5a090 data\hexcasting\advancements\recipes\hexcasting.creative_tab\scroll_paper.json +0e95c5f97c4089d654334a0d58fbf2b808548bd0 data\hexcasting\advancements\recipes\hexcasting.creative_tab\dye_colorizer_gray.json +72795bfbffffa8ab2a02c869f16447167f4fd179 data\hexcasting\loot_tables\blocks\akashic_pressure_plate.json +44d5d32647164e5510ecdbde22addbc047e4603a data\hexcasting\recipes\dye_colorizer_cyan.json +31f9b7d8141f67981deedf7a46894e454006bb28 data\hexcasting\advancements\recipes\hexcasting.creative_tab\akashic_button.json +076dd8bb2ce1508293384fa93fa138a369d10751 data\hexcasting\advancements\recipes\hexcasting.creative_tab\dye_colorizer_green.json +a84bf48a188d7b250db5c971a6d9b63d82279ba3 data\hexcasting\recipes\akashic_wood.json +09e80537530ed51b6792f16fe8b32448e89dc334 data\hexcasting\recipes\slate_block.json +aba5978bd1bc3c27ba92e13241e470921ad8c125 data\hexcasting\advancements\recipes\hexcasting.creative_tab\pride_colorizer_bisexual.json +f3c6b6917e504e1c3d5d8875f7cce6f311e791d2 data\hexcasting\tags\blocks\akashic_logs.json +fe60c763bfe0afa0a266b7390edfc62bde8941b7 data\hexcasting\tags\items\phial_base.json +37584409884ac4d9fbf7f0a4a3cb8ef3b5d32965 data\hexcasting\recipes\pride_colorizer_agender.json +a639b071a5f4738ddf798fcac041a5002657e146 data\hexcasting\recipes\jeweler_hammer.json +3a60e7980813438657c180cc0650a7e96e3c9a65 data\hexcasting\tags\items\wands.json +6f5c41ab9f87ec1206efaaab8d91adc766bb79fd data\hexcasting\recipes\slate_block_from_slates.json +c3a01df30228881c199686192d105fb2651c39c8 data\hexcasting\recipes\pride_colorizer_aroace.json +b8bc2f7ab38646e63376b23f7490a17011908496 data\hexcasting\loot_tables\blocks\akashic_leaves1.json +ac128e72adda8fea0ad63d7e6e18dd9399f53d65 data\hexcasting\recipes\pride_colorizer_intersex.json +584bd8806ef8df5f0e623ed727d6e54a61e60dea data\hexcasting\loot_tables\blocks\slate_block.json +3b2bcffe70bb1f732f06c2560cef66de6c273d62 data\hexcasting\advancements\recipes\hexcasting.creative_tab\wand_warped.json +a92e5560c774bb81cd9f38bd9378af8695cac622 data\hexcasting\recipes\akashic_stairs.json +c2a362b8c19cb288187d8ff340f82198edc54378 data\hexcasting\advancements\recipes\brainsweep\brainsweep\budding_amethyst.json +86424d21e1bf91c128d3b0d528b813629ad962e9 data\hexcasting\advancements\recipes\brainsweep\brainsweep\impetus_look.json +f3c6b6917e504e1c3d5d8875f7cce6f311e791d2 data\minecraft\tags\blocks\logs_that_burn.json +e5c835d3866e8f5ecfb03c9e7c2c134a50951d67 data\hexcasting\recipes\amethyst_tiles.json +30f81e0537c625a4cafcdec75314926569291171 data\hexcasting\recipes\brainsweep\budding_amethyst.json +b519fd81671c9cb8d909bbfd0d4017d2005432d3 data\hexcasting\advancements\recipes\hexcasting.creative_tab\dye_colorizer_blue.json +ac285195e958804bcbd0b87e443d2851fd3a4856 data\hexcasting\recipes\akashic_tile.json +c25784941d6416744fb2ca2d43a3203e5c3e7c8a data\minecraft\tags\blocks\mineable\hoe.json +39a4ba8180e45cab481184d2bcdc217893244446 data\hexcasting\advancements\recipes\hexcasting.creative_tab\pride_colorizer_asexual.json +08f14a615c6c8c0b8a08a56af000c1e1991732d3 data\hexcasting\advancements\recipes\hexcasting.creative_tab\trinket.json +811177c2ddc341f7a6d8704e1eb273f200aee3a1 data\hexcasting\loot_tables\blocks\akashic_button.json +91bb341776ce64a68e1c4200aa8f5b2fa6669820 data\hexcasting\recipes\amethyst_dust_unpacking.json +5e6df78e451395e08f86c8d89dca0a2c99a69691 data\hexcasting\recipes\pride_colorizer_aromantic.json +21041998b3f1de0b45c731295576fc4b2ec6905a data\hexcasting\recipes\compat\create\crushing\amethyst_shard.json +f332cdebf9c53edec6cb3903f65d4ccc1398f849 data\hexcasting\advancements\recipes\hexcasting.creative_tab\pride_colorizer_aromantic.json +88cf11d37222254d9e3a4bef0f9ca2de1495c31a data\hexcasting\recipes\dye_colorizer_white.json +d72a4675ceb721ee4ac43339d8bfbbb82c2adba2 data\hexcasting\advancements\recipes\hexcasting.creative_tab\slate_block.json +5f3e3813757d8300acad523d45ac7c4d85728399 data\minecraft\tags\blocks\buttons.json +5b9b1c15c7a157aa56b3caa7d43a6ad1fa8f4710 data\hexcasting\loot_tables\blocks\akashic_bookshelf.json +ef936e73eea3be9d53c4ac5c78d1477675550375 data\hexcasting\recipes\stonecutting\amethyst_tiles.json +b0b1c5fff194b92ff8c5d6468e177271fd910abd data\hexcasting\advancements\recipes\hexcasting.creative_tab\dye_colorizer_red.json +7f165b1783a871cf69db2e9978290f8993665649 data\hexcasting\advancements\recipes\hexcasting.creative_tab\cypher.json +c386a7294db6ed97f9b131cb8402ca6203092b63 data\hexcasting\recipes\akashic_wood_stripped.json +66e51300dc72c27ed8024ddf852ac9a6208a66b1 data\hexcasting\advancements\recipes\hexcasting.creative_tab\akashic_bookshelf.json +bdf848284137f0116ddf4725b0dda6eaa0cef5fd data\hexcasting\loot_tables\blocks\akashic_wood_stripped.json +d8825a8cbaf100d309b4bd8ac26ed22b020011cb data\hexcasting\advancements\recipes\hexcasting.creative_tab\scroll_medium.json +f32ccb2d36d773215d91dee46bec70a20af501c3 data\hexcasting\advancements\recipes\hexcasting.creative_tab\wand_birch.json +eb06eb90c08b051ff6c42215fb7c91123e240a66 data\hexcasting\recipes\dye_colorizer_purple.json +eb4bfbd7fc7632a5c16aa1d50d6090a1f466069b data\minecraft\tags\blocks\mineable\pickaxe.json +456ae69977612b6f62c109783518e9006287e77b data\hexcasting\recipes\pride_colorizer_genderqueer.json +b8b58bbaf1ddca3514896af14db83f304e415305 data\minecraft\tags\items\trapdoors.json +b8b58bbaf1ddca3514896af14db83f304e415305 data\minecraft\tags\blocks\trapdoors.json +5a17fa9a1496f5fbedd0362f94a5231e0e5ebbfc data\hexcasting\advancements\recipes\hexcasting.creative_tab\ageing_scroll_paper_lantern.json +eb771389a05a4cdfb98286942f2a65bf2a77458f data\hexcasting\advancements\recipes\hexcasting.creative_tab\pride_colorizer_lesbian.json +8334a42636f045b4dc34c0fe5b3b3d3902aa4b7e data\hexcasting\recipes\scroll_small.json +d7f85ce9d46aacc7ec89dc7aa0f88a331ccfbae7 data\hexcasting\recipes\brainsweep\akashic_record.json +5703cc53d18f6b3a14bb030b639d286981c4c754 data\hexcasting\recipes\spellbook.json +4d1c771493f5968a0878c142342ceb8717a5784f data\hexcasting\recipes\dye_colorizer_magenta.json +b107ec9af9e08d124f3d4f14d85911f55a5b905b data\hexcasting\recipes\akashic_pressure_plate.json +86ee80768fef41cf9b517564b733f4586094f367 data\hexcasting\recipes\scroll_medium.json +bb5c04fa0e6d0b3322f3b24d49d1a30a5b790889 data\hexcasting\loot_tables\blocks\akashic_slab.json +149179e18b1b8db5dc3fb96e6faa6cb6ffaecb75 data\hexcasting\advancements\recipes\hexcasting.creative_tab\akashic_panel.json +d189977c9c5d2048ba1ba40ee49d182af2836330 data\create\recipes\crushing\amethyst_block.json +ccc33b4f1a43c8ecd3352ad36ae2dd2191317b5b data\hexcasting\advancements\recipes\hexcasting.creative_tab\dye_colorizer_white.json +32e3d36398fa63e017ed6c46e7e19d7ba041c3d9 data\hexcasting\recipes\pride_colorizer_bisexual.json +9c857c4aeda8a1b3d7a1b5d341871a9434b5816f data\hexcasting\advancements\recipes\hexcasting.creative_tab\dye_colorizer_yellow.json +02dcee696b1e162f20dbfcf02bdb9e2144a64a27 data\hexcasting\recipes\pride_colorizer_gay.json +8df59ac1ca676bf1a506f3116fd273d6379f238e data\hexcasting\recipes\dye_colorizer_gray.json +59000d9f3edb942081f7d1e03d753e9cd59690cc data\hexcasting\advancements\recipes\hexcasting.creative_tab\sub_sandwich.json +b8b58bbaf1ddca3514896af14db83f304e415305 data\minecraft\tags\items\wooden_trapdoors.json +8dab47781281a29e39cb8e6c4da6a27f916e0646 data\hexcasting\advancements\recipes\hexcasting.creative_tab\pride_colorizer_nonbinary.json +55dded121a8dddb2ee7fb1f3ffcdcd1ada4afbd5 data\hexcasting\advancements\recipes\hexcasting.creative_tab\akashic_wood.json +6f33e68b62de15df1673b772d37171b130e3c9bb data\hexcasting\advancements\recipes\hexcasting.creative_tab\pride_colorizer_plural.json +8886e95ddd696288c1f5706cbd63878a4a2bae3a data\hexcasting\loot_tables\blocks\akashic_planks.json +ccf4ea841ea9a66738253385c659ff86c85a73f5 data\hexcasting\recipes\scroll_paper.json +9ddd0b27bb747d433eef17a9f1bd4f055e444f7a data\hexcasting\loot_tables\blocks\akashic_leaves2.json +337c4370fd24b66a6b4b3f6c296a33d9a799034e data\hexcasting\advancements\recipes\hexcasting.creative_tab\amethyst_sconce.json +7cb828138a8ea2dae399011ee02bb909ca5f993e data\hexcasting\loot_tables\blocks\akashic_log_stripped.json +f089ab17470c5fa0065438c5533d5fafb3ee8eaf data\hexcasting\advancements\recipes\hexcasting.creative_tab\focus.json +22ad2496732633bb5539a1fa761051d7add48055 data\hexcasting\advancements\recipes\hexcasting.creative_tab\slate.json +3b1c077f88f625c0b2653324c7b94fd3f2b3a538 data\hexcasting\loot_tables\blocks\akashic_tile.json +aab3082b3303f358cc265fb10bc9bbe08c96eef0 data\hexcasting\recipes\trinket.json +1dc89dff5d4fadb95d9b5a2a5a910f63ea4b02bf data\minecraft\tags\blocks\crystal_sound_blocks.json +e5ae652aee1567ac2e626fa0f88f160993a6f9a5 data\hexcasting\advancements\recipes\hexcasting.creative_tab\amethyst_dust_unpacking.json +c25784941d6416744fb2ca2d43a3203e5c3e7c8a data\minecraft\tags\blocks\leaves.json +ef016ca292fa4edc7496b64e6f2931f4e7d90636 data\hexcasting\recipes\amethyst_dust_packing.json +cd7e618d7c08ffff67683852f799362fb8aaebaf data\hexcasting\recipes\pride_colorizer_nonbinary.json +b8825decc5079bbe72c8a189e36bda2efefaf26f data\hexcasting\recipes\compat\farmersdelight\cutting\akashic_log.json +f7bbc60f547a02378ddb1f23395add4822725fed data\hexcasting\recipes\wand_oak.json +3fe1fcf17e1e25aebede47c537f92888330ccf9f data\hexcasting\advancements\recipes\hexcasting.creative_tab\abacus.json +2d80cb505efc0ba0d34d1768413128fcda17630f data\hexcasting\advancements\recipes\hexcasting.creative_tab\pride_colorizer_demigirl.json +b42dae604eab34ae3831fa16c063af852c175791 data\hexcasting\advancements\recipes\hexcasting.creative_tab\ancient_scroll_paper.json +c375ba3f7105d6f57ef982f6f4e9326ad88a947d data\hexcasting\loot_tables\blocks\ancient_scroll_paper_lantern.json +62b120d8943a9e73778ad1468f12532b21774994 data\hexcasting\recipes\akashic_trapdoor.json +48e782ce4fbd486dd0d6ceb9fdcb94d0e0c727d4 data\minecraft\tags\blocks\wooden_slabs.json +c521621c409275e219f72abf5c6089d60408e646 data\hexcasting\loot_tables\blocks\impetus_rightclick.json +a952d33cda8b805237052b602cf066683c4bf261 data\hexcasting\recipes\empty_directrix.json +f3a33396e071f3afd61eadab2aabdb9acf2ae775 data\hexcasting\recipes\slate.json +48e782ce4fbd486dd0d6ceb9fdcb94d0e0c727d4 data\minecraft\tags\blocks\slabs.json +05e86742a71afd740f47639be62f93bc9898fcde data\c\tags\items\gems.json +0a72e213fec8dd32b1ea9623a242484ce8318c47 data\hexcasting\recipes\pride_colorizer_asexual.json +918075a87ccc30a489aa8cafa2de992dd179aeac data\hexcasting\advancements\recipes\hexcasting.creative_tab\dye_colorizer_lime.json +0295cb6a13069d4e211c18132a2a40d57145b45c data\hexcasting\loot_tables\blocks\scroll_paper.json +e454c9f48ec394f4d353c5a6c04641c9871b8798 data\hexcasting\advancements\recipes\hexcasting.creative_tab\pride_colorizer_transgender.json +804f0e5c6c32c7310129437ccca3ffc148bb973b data\hexcasting\advancements\recipes\hexcasting.creative_tab\wand_acacia.json +1af91ec74694bf90fb7f53b6d55078c7e21460cc data\hexcasting\advancements\recipes\hexcasting.creative_tab\pride_colorizer_genderqueer.json +b596d96eebb4f7bad5930f4eebc589f292b59c98 data\hexcasting\tags\blocks\akashic_planks.json +16705d340500a2796facb4256852fd3d8e9775f8 data\hexcasting\loot_tables\blocks\akashic_wood.json +99aae9efc13ff2b8a4612579b2f865ed2fbe8985 data\hexcasting\advancements\recipes\hexcasting.creative_tab\akashic_tile.json +5f3e3813757d8300acad523d45ac7c4d85728399 data\minecraft\tags\items\buttons.json +556d2e6068965e90c307a435b372ae761cd1c606 data\minecraft\tags\items\wooden_doors.json +a2ea936ff220d9faa168ffbc60a9823de2119ac5 data\hexcasting\recipes\cypher.json +5f9f0962f407062e7b6dd0e8c5f8c55ce13962a5 data\hexcasting\advancements\recipes\brainsweep\brainsweep\impetus_rightclick.json +779b7b9be93062e935972af1cff9c79fa5440a23 data\hexcasting\recipes\amethyst_sconce.json +f6fab3a3296d157a2b969af0c86eb0e5a9f14df4 data\hexcasting\recipes\wand_birch.json +d5c6f9a31a8310ec440fc8c14da8988f0d166586 data\hexcasting\recipes\brainsweep\impetus_storedplayer.json +db8a00478e1c4b0f9b143b5946d1ba25e489591d data\hexcasting\recipes\dynamic\seal_focus.json +b684bfa3755ca25996e74152d2efecbc9d6387d8 data\hexcasting\advancements\recipes\hexcasting.creative_tab\stonecutting\amethyst_tiles.json +cd63a4179aa8c6aff90b251995bc4e8e1a71a784 data\hexcasting\loot_tables\blocks\akashic_leaves3.json +135fed59cd8298b79c2a478cdb711bdc782d571f data\hexcasting\tags\items\grants_root_advancement.json +67d4c536be3762833a4af33cd7cdfc68eb4ad629 data\hexcasting\advancements\recipes\hexcasting.creative_tab\wand_dark_oak.json +48e782ce4fbd486dd0d6ceb9fdcb94d0e0c727d4 data\minecraft\tags\items\wooden_slabs.json +b596d96eebb4f7bad5930f4eebc589f292b59c98 data\minecraft\tags\items\planks.json +05d435799cbf3ee1b51c5b4ffeace507691bcf2a data\hexcasting\advancements\recipes\hexcasting.creative_tab\pride_colorizer_gay.json +771e22cb013a2566773da73f3bd3dd48bef34830 data\hexcasting\loot_tables\blocks\akashic_trapdoor.json +30950c6dd31102cf145f8f7d2979df0736a7ba1e data\hexcasting\advancements\recipes\hexcasting.creative_tab\wand_oak.json +d4328adfccf702d2de3eb6098a47c95e429b7b28 data\hexcasting\loot_tables\blocks\akashic_door.json +0529b25d154715d6b1c030d87e59e6f9d41d91d6 data\hexcasting\recipes\focus.json +023c32e8834eb313c4fa94a84a8f6390ee951ef0 data\hexcasting\advancements\recipes\hexcasting.creative_tab\empty_impetus.json +db09b7fc38bdaffa15b57bd361da8529c7bc943e data\hexcasting\recipes\wand_warped.json +8da0de2d4c31c117431a2133f70f8681ca6b5f17 data\hexcasting\advancements\recipes\hexcasting.creative_tab\scroll_small.json +5861845c3cd84021c7c19ac4f5b3bcc8e1bd3916 data\hexcasting\recipes\brainsweep\impetus_look.json +7c08784f2de139be380b5299f8ea8b8c78126ed8 data\minecraft\tags\blocks\mineable\axe.json +6b4459635b3d53cc2b6836fa97d29244a65b412d data\hexcasting\recipes\abacus.json +29260d23193f414236b0278a5abd7fe1f7ba8b46 data\hexcasting\advancements\recipes\hexcasting.creative_tab\dye_colorizer_black.json +9f7a9ba332e1018098d21a5ec474440fca7f6c73 data\hexcasting\recipes\brainsweep\directrix_redstone.json +556d2e6068965e90c307a435b372ae761cd1c606 data\minecraft\tags\blocks\doors.json +64686e6d1a10a4bd16ec0378dc9ce720eff3b4d7 data\hexcasting\recipes\dye_colorizer_light_gray.json +556d2e6068965e90c307a435b372ae761cd1c606 data\minecraft\tags\blocks\wooden_doors.json +cf855b595844c6f2522c0ad18030519279b396ad data\hexcasting\advancements\recipes\hexcasting.creative_tab\dye_colorizer_magenta.json +3a376402af89128dc37adaa0a72b6de66d58309d data\hexcasting\recipes\dynamic\seal_spellbook.json +42441ca3b389ea4db8a4153ec363847f0ca6e714 data\hexcasting\loot_tables\blocks\akashic_panel.json +f3c6b6917e504e1c3d5d8875f7cce6f311e791d2 data\minecraft\tags\items\logs_that_burn.json +a4f3fed2e6ddc8e60a19a1a51bd5b54904a43fa8 data\hexcasting\advancements\recipes\hexcasting.creative_tab\pride_colorizer_agender.json +49508c455626eeca18c957edc0cde016e823f7b0 data\hexcasting\recipes\scroll.json +ddd7bd92b9e1586cebd2cee658315a9336a80a76 data\hexcasting\advancements\recipes\hexcasting.creative_tab\amethyst_dust_packing.json +4d4caaea035ae4ee878843dd2455042b299b4e5e data\c\tags\items\amethyst_dusts.json +2d52419f3fcdc10643cdb8cef89858efc0ad4d11 data\hexcasting\advancements\recipes\hexcasting.creative_tab\wand_akashic.json +3147422bed290cb47ea3763dbdc6f0e96eed5c2a data\hexcasting\loot_tables\inject\scroll_loot_few.json +1b96773128b11946ff4f30d5aa4040f9e04d0d40 data\hexcasting\recipes\pride_colorizer_demiboy.json +b3583f65db5e1eaae0426b14416c076982ca3685 data\hexcasting\advancements\recipes\hexcasting.creative_tab\pride_colorizer_aroace.json +cd3ca380294544b07e91ce85d97808c30ffa5d17 data\hexcasting\advancements\recipes\hexcasting.creative_tab\spellbook.json +c64f5e56ca18eb68d2e58827920ca0e3ae4617ca data\hexcasting\recipes\dye_colorizer_blue.json +7c0107192c0e24ff9f23ab0f59834b6081ca5b33 data\hexcasting\advancements\recipes\hexcasting.creative_tab\wand_crimson.json diff --git a/Fabric/src/generated/resources/data/hexcasting/tags/items/grants_root_advancement.json b/Fabric/src/generated/resources/data/hexcasting/tags/items/grants_root_advancement.json new file mode 100644 index 00000000..afdfee51 --- /dev/null +++ b/Fabric/src/generated/resources/data/hexcasting/tags/items/grants_root_advancement.json @@ -0,0 +1,8 @@ +{ + "replace": false, + "values": [ + "hexcasting:amethyst_dust", + "minecraft:amethyst_shard", + "hexcasting:charged_amethyst" + ] +} \ No newline at end of file diff --git a/Forge/src/generated/resources/.cache/cache b/Forge/src/generated/resources/.cache/cache index 0df6f7df..6bb313d5 100644 --- a/Forge/src/generated/resources/.cache/cache +++ b/Forge/src/generated/resources/.cache/cache @@ -227,6 +227,7 @@ f3c6b6917e504e1c3d5d8875f7cce6f311e791d2 data/hexcasting/tags/blocks/akashic_log b596d96eebb4f7bad5930f4eebc589f292b59c98 data/hexcasting/tags/blocks/akashic_planks.json f3c6b6917e504e1c3d5d8875f7cce6f311e791d2 data/hexcasting/tags/items/akashic_logs.json b596d96eebb4f7bad5930f4eebc589f292b59c98 data/hexcasting/tags/items/akashic_planks.json +135fed59cd8298b79c2a478cdb711bdc782d571f data/hexcasting/tags/items/grants_root_advancement.json fe60c763bfe0afa0a266b7390edfc62bde8941b7 data/hexcasting/tags/items/phial_base.json 3a60e7980813438657c180cc0650a7e96e3c9a65 data/hexcasting/tags/items/wands.json 5f3e3813757d8300acad523d45ac7c4d85728399 data/minecraft/tags/blocks/buttons.json diff --git a/Forge/src/generated/resources/data/hexcasting/tags/items/grants_root_advancement.json b/Forge/src/generated/resources/data/hexcasting/tags/items/grants_root_advancement.json new file mode 100644 index 00000000..afdfee51 --- /dev/null +++ b/Forge/src/generated/resources/data/hexcasting/tags/items/grants_root_advancement.json @@ -0,0 +1,8 @@ +{ + "replace": false, + "values": [ + "hexcasting:amethyst_dust", + "minecraft:amethyst_shard", + "hexcasting:charged_amethyst" + ] +} \ No newline at end of file From c914f349422d55fb38e5335af8462d7807cd0b53 Mon Sep 17 00:00:00 2001 From: "yrsegal@gmail.com" Date: Sun, 28 Aug 2022 22:48:25 -0400 Subject: [PATCH 086/117] fix gradle being painfully slow, but again --- .../assets/hexcasting/lang/en_us.json | 2 +- Forge/build.gradle | 18 +----------------- 2 files changed, 2 insertions(+), 18 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 ca0b2d72..645700be 100644 --- a/Common/src/main/resources/assets/hexcasting/lang/en_us.json +++ b/Common/src/main/resources/assets/hexcasting/lang/en_us.json @@ -952,7 +952,7 @@ "hexcasting.page.blockworks.bonemeal": "Encourage a plant or sapling at the target position to grow, as if $(item)Bonemeal/$ was applied. Costs a bit more than one $(l:items/amethyst)$(item)Amethyst Dust/$.", "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.page.blockworks.extinguish": "Extinguish blocks in a large area. Costs about six $(l:items/amethyst)$(item)Amethyst Dust/$s.", "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.", diff --git a/Forge/build.gradle b/Forge/build.gradle index 103f93bd..ecb80b88 100644 --- a/Forge/build.gradle +++ b/Forge/build.gradle @@ -156,6 +156,7 @@ dependencies { } mixin { + add project(":Common").sourceSets.main, "hexcasting.mixins.refmap.json" add sourceSets.main, "hexcasting.mixins.refmap.json" config "hexplat.mixins.json" config "hexcasting_forge.mixins.json" @@ -171,23 +172,6 @@ compileTestKotlin { source(project(":Common").sourceSets.main.kotlin) } - -// https://discord.com/channels/313125603924639766/733055378371117127/980968358658838540 -// > It wint generate a refmap if there are jo changes source files -// > Since the last build -// > Gradle task execution avoidance breaks it that way -// > At one point i got it to work reliably bu forcing some specific task to always run i just don't remember the syntax and which task it was -// > It might have been compileJava -build { - println "Forcing re-compile of Java to include refmap" - tasks.withType(JavaCompile) { - outputs.upToDateWhen { false } - } - compileKotlin { - outputs.upToDateWhen { false } - } -} - sourceSets { main.resources.srcDirs += ['src/generated/resources', '../Common/src/generated/resources'] main.kotlin.srcDirs += 'src/main/java' From 95b3b3f4b86ad0764b173902e7f73d52313cd26b Mon Sep 17 00:00:00 2001 From: gamma-delta <29877714+gamma-delta@users.noreply.github.com> Date: Sun, 28 Aug 2022 22:03:22 -0500 Subject: [PATCH 087/117] [Release] 0.9.2 release! It's a doozy: - Flight is no longer able to be cast for free - Create Crushing recipes now include Hex amethyst - Edified logs can be stripped on Farmer's Delight cutting boards - Drawing patterns too fast no longer causes visual errors - Edified button is no longer solid - Identity Purification once again acts as documented - Thoth's Gambit now properly increases evaluation depth - Scroll direction is now configurable - Overgrow, Greater Sentinels, and Swindler's Gambit have had their costs updated - Casting items can affect themselves with Erase and Recharge - Raycasting outside your range is not possible - Clipping through the world border is not possible - Casting now respects chunk claims and adventure mode - Changed pigment recipes - Reworked Greater Teleport with regards to teleporting entity stacks and dropping player items for players other than the caster. It also now respects Curse of Binding. - The lens sees the bees. And also rails - Fixed an exploit that let you overcast for free - Fix Craft Phial occasionally being generated as a number literal - Weather patterns now properly change the weather timer, making it take the normal amount of time before the next rainfall - Excisor's Distillation no longer acts like Flock's Disintegration if passed an out-of-bounds index. - Ignite Block now works on Create empty Blaze Burners - JEI/REI/EMI integration for Craft Phial and Edify Sapling - Vector Projection is now mathematically correct - Phials now always show their media amount in dust - Fluid creation hexes can partially insert into tanks, and Destroy Liquid can empty tanks - Fixed some mod armors blocking overcast damage - Make some advancements clearer in what they require and have you do --- gradle.properties | 1 + 1 file changed, 1 insertion(+) diff --git a/gradle.properties b/gradle.properties index 11397170..fadb1a23 100644 --- a/gradle.properties +++ b/gradle.properties @@ -17,3 +17,4 @@ patchouliVersion=69 jeiVersion=9.5.3.143 pehkuiVersion=3.3.2 + From a7c827b66213112090946c29ff2f336b91590b92 Mon Sep 17 00:00:00 2001 From: "yrsegal@gmail.com" Date: Sun, 28 Aug 2022 23:09:22 -0400 Subject: [PATCH 088/117] AAAARGH --- Common/src/main/resources/assets/hexcasting/lang/en_us.json | 2 +- 1 file changed, 1 insertion(+), 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 645700be..ca0b2d72 100644 --- a/Common/src/main/resources/assets/hexcasting/lang/en_us.json +++ b/Common/src/main/resources/assets/hexcasting/lang/en_us.json @@ -952,7 +952,7 @@ "hexcasting.page.blockworks.bonemeal": "Encourage a plant or sapling at the target position to grow, as if $(item)Bonemeal/$ was applied. Costs a bit more than one $(l:items/amethyst)$(item)Amethyst Dust/$.", "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/$s.", + "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.", From 1ba580f4442dcfef312d7ce330a55beba78a6f6e Mon Sep 17 00:00:00 2001 From: gamma-delta <29877714+gamma-delta@users.noreply.github.com> Date: Mon, 29 Aug 2022 04:18:41 +0100 Subject: [PATCH 089/117] [Release] 0.9.2 release! ... again wire pushed some code at the same time I was building 0.9.2 and I forgot to merge @gattsuru 's PR. The 0.9.2 is dead, long live the 0.9.2. --- i_hate_git | 0 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 i_hate_git diff --git a/i_hate_git b/i_hate_git new file mode 100644 index 00000000..e69de29b From 9aa301957134ed59347c04a4ffc253937a515696 Mon Sep 17 00:00:00 2001 From: "yrsegal@gmail.com" Date: Mon, 29 Aug 2022 12:20:08 -0400 Subject: [PATCH 090/117] fix gradle again... by specifying jar it should still be faster in general, but... --- .../casting/operators/spells/OpExtinguish.kt | 2 -- Forge/build.gradle | 17 ++++++++++++++++- 2 files changed, 16 insertions(+), 3 deletions(-) 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 7810b976..84a12c7b 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 @@ -46,8 +46,6 @@ object OpExtinguish : SpellOperator { var successes = 0 while (todo.isNotEmpty() && successes <= MAX_DESTROY_COUNT) { val here = todo.removeFirst() - val distFromFocus = - ctx.caster.position().distanceToSqr(Vec3.atCenterOf(here)) val distFromTarget = target.distanceTo(Vec3.atCenterOf(here)) // max distance to prevent runaway shenanigans if (ctx.canEditBlockAt(here) && distFromTarget < 10 && seen.add(here)) { diff --git a/Forge/build.gradle b/Forge/build.gradle index ecb80b88..68d4a3c4 100644 --- a/Forge/build.gradle +++ b/Forge/build.gradle @@ -156,7 +156,6 @@ dependencies { } mixin { - add project(":Common").sourceSets.main, "hexcasting.mixins.refmap.json" add sourceSets.main, "hexcasting.mixins.refmap.json" config "hexplat.mixins.json" config "hexcasting_forge.mixins.json" @@ -178,6 +177,22 @@ sourceSets { test.kotlin.srcDirs += 'src/main/java' } +// https://discord.com/channels/313125603924639766/733055378371117127/980968358658838540 +// > It wint generate a refmap if there are jo changes source files +// > Since the last build +// > Gradle task execution avoidance breaks it that way +// > At one point i got it to work reliably bu forcing some specific task to always run i just don't remember the syntax and which task it was +// > It might have been compileJava +jar { + println "Forcing re-compile of Java to include refmap" + tasks.withType(JavaCompile) { + outputs.upToDateWhen { false } + } + compileKotlin { + outputs.upToDateWhen { false } + } +} + processResources { from project(":Common").sourceSets.main.resources inputs.property "version", project.version From 73596a244e038aa6796f6dc3dfd342153a08c60b Mon Sep 17 00:00:00 2001 From: "yrsegal@gmail.com" Date: Mon, 29 Aug 2022 17:39:43 -0400 Subject: [PATCH 091/117] ok I actually 100% for sure got gradle faster now --- Forge/build.gradle | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/Forge/build.gradle b/Forge/build.gradle index 68d4a3c4..eb2bc604 100644 --- a/Forge/build.gradle +++ b/Forge/build.gradle @@ -183,13 +183,15 @@ sourceSets { // > Gradle task execution avoidance breaks it that way // > At one point i got it to work reliably bu forcing some specific task to always run i just don't remember the syntax and which task it was // > It might have been compileJava -jar { - println "Forcing re-compile of Java to include refmap" - tasks.withType(JavaCompile) { - outputs.upToDateWhen { false } - } - compileKotlin { - outputs.upToDateWhen { false } +build { + doFirst { + println "Forcing re-compile of Java to include refmap" + tasks.withType(JavaCompile) { + outputs.upToDateWhen { false } + } + compileKotlin { + outputs.upToDateWhen { false } + } } } From 92985b985482b61d4fd0048cfc601a82d6079a1b Mon Sep 17 00:00:00 2001 From: gamma-delta <29877714+gamma-delta@users.noreply.github.com> Date: Mon, 29 Aug 2022 22:12:35 -0500 Subject: [PATCH 092/117] [Release] 0.9.3 release 0.9.2 had some problems with building on Forge. This release should be identical to the 0.9.2 one on both platforms except Forge won't immediately crash on startup. --- gradle.properties | 1 - i_hate_git | 0 2 files changed, 1 deletion(-) delete mode 100644 i_hate_git diff --git a/gradle.properties b/gradle.properties index fadb1a23..11397170 100644 --- a/gradle.properties +++ b/gradle.properties @@ -17,4 +17,3 @@ patchouliVersion=69 jeiVersion=9.5.3.143 pehkuiVersion=3.3.2 - diff --git a/i_hate_git b/i_hate_git deleted file mode 100644 index e69de29b..00000000 From 73e13a576de833a6e862e1bd2c27bdcf6096cf7f Mon Sep 17 00:00:00 2001 From: "yrsegal@gmail.com" Date: Mon, 29 Aug 2022 23:27:14 -0400 Subject: [PATCH 093/117] fix gradle I promise --- Forge/build.gradle | 36 +++++++++++++++++++++--------------- 1 file changed, 21 insertions(+), 15 deletions(-) diff --git a/Forge/build.gradle b/Forge/build.gradle index eb2bc604..2a304ed1 100644 --- a/Forge/build.gradle +++ b/Forge/build.gradle @@ -161,12 +161,32 @@ mixin { config "hexcasting_forge.mixins.json" } +// https://discord.com/channels/313125603924639766/733055378371117127/980968358658838540 +// > It wint generate a refmap if there are jo changes source files +// > Since the last build +// > Gradle task execution avoidance breaks it that way +// > At one point i got it to work reliably bu forcing some specific task to always run i just don't remember the syntax and which task it was +// > It might have been compileJava +task invalidateJavaForRefmap { + doFirst { + tasks.withType(JavaCompile) { + outputs.upToDateWhen { false } + } + compileKotlin { + outputs.upToDateWhen { false } + } + } +} + tasks.withType(JavaCompile) { source(project(":Common").sourceSets.main.allSource) + shouldRunAfter(invalidateJavaForRefmap) } + compileKotlin { source(project(":Common").sourceSets.main.kotlin) } + compileTestKotlin { source(project(":Common").sourceSets.main.kotlin) } @@ -177,22 +197,8 @@ sourceSets { test.kotlin.srcDirs += 'src/main/java' } -// https://discord.com/channels/313125603924639766/733055378371117127/980968358658838540 -// > It wint generate a refmap if there are jo changes source files -// > Since the last build -// > Gradle task execution avoidance breaks it that way -// > At one point i got it to work reliably bu forcing some specific task to always run i just don't remember the syntax and which task it was -// > It might have been compileJava build { - doFirst { - println "Forcing re-compile of Java to include refmap" - tasks.withType(JavaCompile) { - outputs.upToDateWhen { false } - } - compileKotlin { - outputs.upToDateWhen { false } - } - } + dependsOn(invalidateJavaForRefmap) } processResources { From 1ea617f1119d407692b5326ef2da570208cf9d95 Mon Sep 17 00:00:00 2001 From: gamma-delta <29877714+gamma-delta@users.noreply.github.com> Date: Mon, 29 Aug 2022 22:48:38 -0500 Subject: [PATCH 094/117] [Release] 0.9.3 but gradle actually works this time --- gradle.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle.properties b/gradle.properties index 11397170..bd673c2f 100644 --- a/gradle.properties +++ b/gradle.properties @@ -10,7 +10,7 @@ jetbrainsAnnotationsVersion=23.0.0 minecraftVersion=1.18.2 kotlinVersion=1.6.21 -modVersion=0.9.2 +modVersion=0.9.3 paucalVersion=0.4.6 patchouliVersion=69 From a66a1f0cf987b3e67668469b7db772bb6608cd5d Mon Sep 17 00:00:00 2001 From: "yrsegal@gmail.com" Date: Tue, 30 Aug 2022 09:39:35 -0400 Subject: [PATCH 095/117] does THIS make it include the refmap? it did on my end --- Forge/build.gradle | 1 + 1 file changed, 1 insertion(+) diff --git a/Forge/build.gradle b/Forge/build.gradle index 2a304ed1..51706be6 100644 --- a/Forge/build.gradle +++ b/Forge/build.gradle @@ -185,6 +185,7 @@ tasks.withType(JavaCompile) { compileKotlin { source(project(":Common").sourceSets.main.kotlin) + shouldRunAfter(invalidateJavaForRefmap) } compileTestKotlin { From ee05eb1a4eb48e81a0aa1866e64bc440938d0329 Mon Sep 17 00:00:00 2001 From: "yrsegal@gmail.com" Date: Tue, 30 Aug 2022 09:45:55 -0400 Subject: [PATCH 096/117] please let this work i'm begging you --- Forge/build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Forge/build.gradle b/Forge/build.gradle index 51706be6..5ba6cba5 100644 --- a/Forge/build.gradle +++ b/Forge/build.gradle @@ -198,7 +198,7 @@ sourceSets { test.kotlin.srcDirs += 'src/main/java' } -build { +jar { dependsOn(invalidateJavaForRefmap) } From 77bd0e4341d20ddbe08d6170e4e6c580e8f2dec6 Mon Sep 17 00:00:00 2001 From: gamma-delta <29877714+gamma-delta@users.noreply.github.com> Date: Mon, 5 Sep 2022 11:36:09 -0500 Subject: [PATCH 097/117] [Release] aaauuughhhhh --- gradle.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle.properties b/gradle.properties index bd673c2f..9f7951d4 100644 --- a/gradle.properties +++ b/gradle.properties @@ -10,7 +10,7 @@ jetbrainsAnnotationsVersion=23.0.0 minecraftVersion=1.18.2 kotlinVersion=1.6.21 -modVersion=0.9.3 +modVersion=0.9.4 paucalVersion=0.4.6 patchouliVersion=69 From b8c3331592ffd1c46cc3463ad4e32a92584d1e49 Mon Sep 17 00:00:00 2001 From: "yrsegal@gmail.com" Date: Sun, 18 Sep 2022 11:47:50 -0400 Subject: [PATCH 098/117] fix a concerning exploit with dividing by zero --- .../java/at/petrak/hexcasting/api/spell/mishaps/Mishap.kt | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) 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 06f69a01..449dae3d 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 @@ -24,7 +24,7 @@ import net.minecraft.world.item.DyeColor import net.minecraft.world.item.ItemStack import net.minecraft.world.phys.Vec3 -sealed class Mishap : Throwable() { +abstract class Mishap : Throwable() { /** Mishaps spray half-red, half-this-color. */ abstract fun accentColor(ctx: CastingContext, errorCtx: Context): FrozenColorizer @@ -113,7 +113,11 @@ sealed class Mishap : Throwable() { else entity.lastHurt -= amount } - if (!entity.hurt(source, amount)) { + if (!entity.hurt(source, amount) && + !entity.isInvulnerableTo(source) && + !entity.level.isClientSide && + !entity.isDeadOrDying) { + // Ok, if you REALLY don't want to play nice... entity.health = targetHealth entity.markHurt() From 2e45a0229864e0b093533c0ac5a5add841d343f9 Mon Sep 17 00:00:00 2001 From: gamma-delta <29877714+gamma-delta@users.noreply.github.com> Date: Tue, 20 Sep 2022 20:33:53 -0500 Subject: [PATCH 099/117] version bump --- gradle.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle.properties b/gradle.properties index 9f7951d4..7d6d1263 100644 --- a/gradle.properties +++ b/gradle.properties @@ -10,7 +10,7 @@ jetbrainsAnnotationsVersion=23.0.0 minecraftVersion=1.18.2 kotlinVersion=1.6.21 -modVersion=0.9.4 +modVersion=0.9.5 paucalVersion=0.4.6 patchouliVersion=69 From 4acfc707a7682f2ea90730ffe0626d8b40692ec6 Mon Sep 17 00:00:00 2001 From: gamma-delta <29877714+gamma-delta@users.noreply.github.com> Date: Thu, 22 Sep 2022 09:18:19 -0500 Subject: [PATCH 100/117] bang on #253. this in no way fixes it and i'm halfway convinced it's a FD error --- .../hexcasting/datagen/IXplatIngredients.java | 6 +- .../FarmersDelightCuttingRecipeBuilder.java | 216 +++++++++--------- ...java => FarmersDelightToolIngredient.java} | 2 +- Fabric/gradle.properties | 2 +- Fabric/src/generated/resources/.cache/cache | 8 +- .../farmersdelight/cutting/akashic_door.json | 2 +- .../farmersdelight/cutting/akashic_log.json | 2 +- .../cutting/akashic_trapdoor.json | 2 +- .../farmersdelight/cutting/akashic_wood.json | 2 +- .../datagen/HexFabricDataGenerators.java | 10 +- .../fabric/xplat/FabricXplatImpl.java | 10 +- .../forge/datagen/HexForgeDataGenerators.java | 7 +- 12 files changed, 137 insertions(+), 132 deletions(-) rename Common/src/main/java/at/petrak/hexcasting/datagen/recipe/builders/{ToolIngredient.java => FarmersDelightToolIngredient.java} (71%) diff --git a/Common/src/main/java/at/petrak/hexcasting/datagen/IXplatIngredients.java b/Common/src/main/java/at/petrak/hexcasting/datagen/IXplatIngredients.java index 274de8b9..e3784386 100644 --- a/Common/src/main/java/at/petrak/hexcasting/datagen/IXplatIngredients.java +++ b/Common/src/main/java/at/petrak/hexcasting/datagen/IXplatIngredients.java @@ -1,6 +1,6 @@ package at.petrak.hexcasting.datagen; -import at.petrak.hexcasting.datagen.recipe.builders.ToolIngredient; +import at.petrak.hexcasting.datagen.recipe.builders.FarmersDelightToolIngredient; import net.minecraft.world.item.DyeColor; import net.minecraft.world.item.crafting.Ingredient; @@ -27,7 +27,7 @@ public interface IXplatIngredients { Ingredient whenModIngredient(Ingredient defaultIngredient, String modid, Ingredient modIngredient); - ToolIngredient axeStrip(); + FarmersDelightToolIngredient axeStrip(); - ToolIngredient axeDig(); + FarmersDelightToolIngredient axeDig(); } diff --git a/Common/src/main/java/at/petrak/hexcasting/datagen/recipe/builders/FarmersDelightCuttingRecipeBuilder.java b/Common/src/main/java/at/petrak/hexcasting/datagen/recipe/builders/FarmersDelightCuttingRecipeBuilder.java index 5efb614d..e2a35d3e 100644 --- a/Common/src/main/java/at/petrak/hexcasting/datagen/recipe/builders/FarmersDelightCuttingRecipeBuilder.java +++ b/Common/src/main/java/at/petrak/hexcasting/datagen/recipe/builders/FarmersDelightCuttingRecipeBuilder.java @@ -22,144 +22,144 @@ import java.util.List; import java.util.function.Consumer; public class FarmersDelightCuttingRecipeBuilder implements RecipeBuilder { - private String group = ""; - private final List outputs = Lists.newArrayList(); - private Ingredient input; - private ToolIngredient toolAction; - private SoundEvent sound; + private String group = ""; + private final List outputs = Lists.newArrayList(); + private Ingredient input; + private FarmersDelightToolIngredient toolAction; + private SoundEvent sound; - @Override - public FarmersDelightCuttingRecipeBuilder unlockedBy(String s, CriterionTriggerInstance criterionTriggerInstance) { - return this; - } + @Override + public FarmersDelightCuttingRecipeBuilder unlockedBy(String s, CriterionTriggerInstance criterionTriggerInstance) { + return this; + } - @Override - public @NotNull FarmersDelightCuttingRecipeBuilder group(@Nullable String name) { - group = name; - return this; - } + @Override + public @NotNull FarmersDelightCuttingRecipeBuilder group(@Nullable String name) { + group = name; + return this; + } - @Override - public Item getResult() { - return Items.AIR; // Irrelevant, we implement serialization ourselves - } + @Override + public Item getResult() { + return Items.AIR; // Irrelevant, we implement serialization ourselves + } - public FarmersDelightCuttingRecipeBuilder withInput(ItemLike item) { - return withInput(Ingredient.of(item)); - } + public FarmersDelightCuttingRecipeBuilder withInput(ItemLike item) { + return withInput(Ingredient.of(item)); + } - public FarmersDelightCuttingRecipeBuilder withInput(ItemStack stack) { - return withInput(Ingredient.of(stack)); - } + public FarmersDelightCuttingRecipeBuilder withInput(ItemStack stack) { + return withInput(Ingredient.of(stack)); + } - public FarmersDelightCuttingRecipeBuilder withInput(Ingredient ingredient) { - this.input = ingredient; - return this; - } + public FarmersDelightCuttingRecipeBuilder withInput(Ingredient ingredient) { + this.input = ingredient; + return this; + } - public FarmersDelightCuttingRecipeBuilder withOutput(ItemLike output) { - return withOutput(1f, output, 1); - } + public FarmersDelightCuttingRecipeBuilder withOutput(ItemLike output) { + return withOutput(1f, output, 1); + } - public FarmersDelightCuttingRecipeBuilder withOutput(float chance, ItemLike output) { - return withOutput(chance, output, 1); - } + public FarmersDelightCuttingRecipeBuilder withOutput(float chance, ItemLike output) { + return withOutput(chance, output, 1); + } - public FarmersDelightCuttingRecipeBuilder withOutput(ItemLike output, int count) { - return withOutput(1f, output, count); - } + public FarmersDelightCuttingRecipeBuilder withOutput(ItemLike output, int count) { + return withOutput(1f, output, count); + } - public FarmersDelightCuttingRecipeBuilder withOutput(float chance, ItemLike output, int count) { - return withOutput(new ItemStack(output, count), chance); - } + public FarmersDelightCuttingRecipeBuilder withOutput(float chance, ItemLike output, int count) { + return withOutput(new ItemStack(output, count), chance); + } - public FarmersDelightCuttingRecipeBuilder withOutput(ItemStack output, float chance) { - this.outputs.add(new ItemProcessingOutput(output, chance)); - return this; - } + public FarmersDelightCuttingRecipeBuilder withOutput(ItemStack output, float chance) { + this.outputs.add(new ItemProcessingOutput(output, chance)); + return this; + } - public FarmersDelightCuttingRecipeBuilder withOutput(String name) { - return withOutput(1f, name, 1); - } + public FarmersDelightCuttingRecipeBuilder withOutput(String name) { + return withOutput(1f, name, 1); + } - public FarmersDelightCuttingRecipeBuilder withOutput(String name, int count) { - return withOutput(1f, name, count); - } + public FarmersDelightCuttingRecipeBuilder withOutput(String name, int count) { + return withOutput(1f, name, count); + } - public FarmersDelightCuttingRecipeBuilder withOutput(float chance, String name) { - return withOutput(chance, name, 1); - } + public FarmersDelightCuttingRecipeBuilder withOutput(float chance, String name) { + return withOutput(chance, name, 1); + } - public FarmersDelightCuttingRecipeBuilder withOutput(float chance, String name, int count) { - this.outputs.add(new CompatProcessingOutput(name, count, chance)); - return this; - } + public FarmersDelightCuttingRecipeBuilder withOutput(float chance, String name, int count) { + this.outputs.add(new CompatProcessingOutput(name, count, chance)); + return this; + } - public FarmersDelightCuttingRecipeBuilder withTool(ToolIngredient ingredient) { - this.toolAction = ingredient; - return this; - } + public FarmersDelightCuttingRecipeBuilder withTool(FarmersDelightToolIngredient ingredient) { + this.toolAction = ingredient; + return this; + } - public FarmersDelightCuttingRecipeBuilder withSound(SoundEvent sound) { - this.sound = sound; - return this; - } + public FarmersDelightCuttingRecipeBuilder withSound(SoundEvent sound) { + this.sound = sound; + return this; + } - @Override - public void save(Consumer consumer, ResourceLocation resourceLocation) { - consumer.accept(new CuttingRecipe(resourceLocation)); - } + @Override + public void save(Consumer consumer, ResourceLocation resourceLocation) { + consumer.accept(new CuttingRecipe(resourceLocation)); + } - public class CuttingRecipe implements FinishedRecipe { + public class CuttingRecipe implements FinishedRecipe { - private final ResourceLocation id; + private final ResourceLocation id; - public CuttingRecipe(ResourceLocation id) { - this.id = id; - } + public CuttingRecipe(ResourceLocation id) { + this.id = id; + } - @Override - public void serializeRecipeData(@NotNull JsonObject json) { - json.addProperty("type", "farmersdelight:cutting"); + @Override + public void serializeRecipeData(@NotNull JsonObject json) { + json.addProperty("type", "farmersdelight:cutting"); - if (!group.isEmpty()) { - json.addProperty("group", group); - } + if (!group.isEmpty()) { + json.addProperty("group", group); + } - JsonArray jsonIngredients = new JsonArray(); - JsonArray jsonOutputs = new JsonArray(); + JsonArray jsonIngredients = new JsonArray(); + JsonArray jsonOutputs = new JsonArray(); - jsonIngredients.add(input.toJson()); + jsonIngredients.add(input.toJson()); - outputs.forEach(o -> jsonOutputs.add(o.serialize())); + outputs.forEach(o -> jsonOutputs.add(o.serialize())); - json.add("ingredients", jsonIngredients); - json.add("tool", toolAction.serialize()); - json.add("result", jsonOutputs); + json.add("ingredients", jsonIngredients); + json.add("tool", toolAction.serialize()); + json.add("result", jsonOutputs); - if (sound != null) { - json.addProperty("sound", Registry.SOUND_EVENT.getKey(sound).toString()); - } - } + if (sound != null) { + json.addProperty("sound", Registry.SOUND_EVENT.getKey(sound).toString()); + } + } - @Override - public @NotNull ResourceLocation getId() { - return id; - } + @Override + public @NotNull ResourceLocation getId() { + return id; + } - @Override - public @NotNull RecipeSerializer getType() { - return RecipeSerializer.SHAPELESS_RECIPE; // Irrelevant, we implement serialization ourselves - } + @Override + public @NotNull RecipeSerializer getType() { + return RecipeSerializer.SHAPELESS_RECIPE; // Irrelevant, we implement serialization ourselves + } - @Override - public JsonObject serializeAdvancement() { - return null; - } + @Override + public JsonObject serializeAdvancement() { + return null; + } - @Override - public ResourceLocation getAdvancementId() { - return null; - } - } + @Override + public ResourceLocation getAdvancementId() { + return null; + } + } } diff --git a/Common/src/main/java/at/petrak/hexcasting/datagen/recipe/builders/ToolIngredient.java b/Common/src/main/java/at/petrak/hexcasting/datagen/recipe/builders/FarmersDelightToolIngredient.java similarity index 71% rename from Common/src/main/java/at/petrak/hexcasting/datagen/recipe/builders/ToolIngredient.java rename to Common/src/main/java/at/petrak/hexcasting/datagen/recipe/builders/FarmersDelightToolIngredient.java index a9f5b5ee..0c77dcb0 100644 --- a/Common/src/main/java/at/petrak/hexcasting/datagen/recipe/builders/ToolIngredient.java +++ b/Common/src/main/java/at/petrak/hexcasting/datagen/recipe/builders/FarmersDelightToolIngredient.java @@ -2,6 +2,6 @@ package at.petrak.hexcasting.datagen.recipe.builders; import com.google.gson.JsonObject; -public interface ToolIngredient { +public interface FarmersDelightToolIngredient { JsonObject serialize(); } diff --git a/Fabric/gradle.properties b/Fabric/gradle.properties index a2a13e5c..1535864e 100644 --- a/Fabric/gradle.properties +++ b/Fabric/gradle.properties @@ -4,7 +4,7 @@ fabricLoaderVersion=0.14.5 fiberVersion=0.23.0-2 cardinalComponentsVersion=4.2.0 -serializationHooksVersion=0.1.0+1.18.095e8a6 +serializationHooksVersion=0.3.24 reiVersion=8.0.442 emiVersion=0.1.0+1.18.2 diff --git a/Fabric/src/generated/resources/.cache/cache b/Fabric/src/generated/resources/.cache/cache index daf916d5..3285a1e5 100644 --- a/Fabric/src/generated/resources/.cache/cache +++ b/Fabric/src/generated/resources/.cache/cache @@ -64,13 +64,13 @@ fa04d5bc32f5646cd67bc8e8b572bdb7849b735e data\hexcasting\recipes\akashic_bookshe 3f9756b2c5137b285c4faa88ab43c4996b6b2bb6 data\hexcasting\recipes\ancient_scroll_paper_lantern.json 1157a6545ece0e2b8734b8a1428f9a3c021c8b73 data\hexcasting\recipes\wand_akashic.json 2c542a616b312e41537fb25a2362877dd50d2692 data\hexcasting\recipes\akashic_connector.json -ffe8e09c41222b5b909626436dbd7099e01ccc64 data\hexcasting\recipes\compat\farmersdelight\cutting\akashic_door.json +23ce84fdf212622afcb49f059d1362ae47a89b29 data\hexcasting\recipes\compat\farmersdelight\cutting\akashic_door.json 2d79a41ba8697f9e1fa26b1bff48f33c824d3823 data\minecraft\tags\blocks\pressure_plates.json 1ba431aef086bb60bfe8fe01b4d2bf5dfb7593c4 data\hexcasting\loot_tables\blocks\impetus_look.json f3e78a96f17dc5ed54047bb24be58dbf3151c8fa data\hexcasting\advancements\recipes\hexcasting.creative_tab\ancient_scroll_paper_lantern.json fc57d15e9f9f11347a2170dd06053954345368d2 data\hexcasting\advancements\recipes\hexcasting.creative_tab\lens.json 5c471f81cc168826f1652a39a71aeb85e786ea16 data\hexcasting\recipes\scroll_paper_lantern.json -4d8667ebdad42e7220009f69a1f6f465a73b2a9a data\hexcasting\recipes\compat\farmersdelight\cutting\akashic_wood.json +47adb42c3e28de093c673588904ddf5056db2c27 data\hexcasting\recipes\compat\farmersdelight\cutting\akashic_wood.json 9d4704f96cc4cfa3275092fb58ff90c98449abe3 data\hexcasting\loot_tables\blocks\ancient_scroll_paper.json ab5d271371323d93ff6eed18179ee4f7fd8c939c data\hexcasting\recipes\brainsweep\impetus_rightclick.json 48e782ce4fbd486dd0d6ceb9fdcb94d0e0c727d4 data\minecraft\tags\items\slabs.json @@ -104,7 +104,7 @@ c11dc4388c18dadff5d93126eb0f7ae848d627b9 data\hexcasting\advancements\recipes\br 186dc05888e66e17af0217bd0680648dc3da3968 data\hexcasting\recipes\dye_colorizer_orange.json d3ad9a9e92dd125f872d9671930d4e57f24894ed data\hexcasting\recipes\pride_colorizer_demigirl.json 2ad42dd4a4877a23cb7f45e8b75c9f53f58d12f5 data\hexcasting\recipes\wand_acacia.json -77afbbd8280136eb11d1aab1219d6057063e8f75 data\hexcasting\recipes\compat\farmersdelight\cutting\akashic_trapdoor.json +da367b70498fdf51c87238322537ddfbf26809d3 data\hexcasting\recipes\compat\farmersdelight\cutting\akashic_trapdoor.json 2d79a41ba8697f9e1fa26b1bff48f33c824d3823 data\minecraft\tags\items\wooden_pressure_plates.json ce79c9e183b57bfbdb75cd074d7ff6e48894d05c data\hexcasting\loot_tables\blocks\akashic_connector.json d7213631b2f9075c9bdef0d5a48ca28f85f5a090 data\hexcasting\advancements\recipes\hexcasting.creative_tab\scroll_paper.json @@ -195,7 +195,7 @@ e5ae652aee1567ac2e626fa0f88f160993a6f9a5 data\hexcasting\advancements\recipes\he c25784941d6416744fb2ca2d43a3203e5c3e7c8a data\minecraft\tags\blocks\leaves.json ef016ca292fa4edc7496b64e6f2931f4e7d90636 data\hexcasting\recipes\amethyst_dust_packing.json cd7e618d7c08ffff67683852f799362fb8aaebaf data\hexcasting\recipes\pride_colorizer_nonbinary.json -b8825decc5079bbe72c8a189e36bda2efefaf26f data\hexcasting\recipes\compat\farmersdelight\cutting\akashic_log.json +11c4b7fb3901161324a952ff0760f5d52e1c2c26 data\hexcasting\recipes\compat\farmersdelight\cutting\akashic_log.json f7bbc60f547a02378ddb1f23395add4822725fed data\hexcasting\recipes\wand_oak.json 3fe1fcf17e1e25aebede47c537f92888330ccf9f data\hexcasting\advancements\recipes\hexcasting.creative_tab\abacus.json 2d80cb505efc0ba0d34d1768413128fcda17630f data\hexcasting\advancements\recipes\hexcasting.creative_tab\pride_colorizer_demigirl.json diff --git a/Fabric/src/generated/resources/data/hexcasting/recipes/compat/farmersdelight/cutting/akashic_door.json b/Fabric/src/generated/resources/data/hexcasting/recipes/compat/farmersdelight/cutting/akashic_door.json index 701b7c6f..a68deb2c 100644 --- a/Fabric/src/generated/resources/data/hexcasting/recipes/compat/farmersdelight/cutting/akashic_door.json +++ b/Fabric/src/generated/resources/data/hexcasting/recipes/compat/farmersdelight/cutting/akashic_door.json @@ -7,7 +7,7 @@ ], "tool": { "type": "farmersdelight:tool", - "tag": "fabric:tools/axes" + "tag": "c:tools/axes" }, "result": [ { diff --git a/Fabric/src/generated/resources/data/hexcasting/recipes/compat/farmersdelight/cutting/akashic_log.json b/Fabric/src/generated/resources/data/hexcasting/recipes/compat/farmersdelight/cutting/akashic_log.json index 1e13e009..3f0fea02 100644 --- a/Fabric/src/generated/resources/data/hexcasting/recipes/compat/farmersdelight/cutting/akashic_log.json +++ b/Fabric/src/generated/resources/data/hexcasting/recipes/compat/farmersdelight/cutting/akashic_log.json @@ -7,7 +7,7 @@ ], "tool": { "type": "farmersdelight:tool", - "tag": "fabric:tools/axes" + "tag": "c:tools/axes" }, "result": [ { diff --git a/Fabric/src/generated/resources/data/hexcasting/recipes/compat/farmersdelight/cutting/akashic_trapdoor.json b/Fabric/src/generated/resources/data/hexcasting/recipes/compat/farmersdelight/cutting/akashic_trapdoor.json index 90fc66af..4397c24d 100644 --- a/Fabric/src/generated/resources/data/hexcasting/recipes/compat/farmersdelight/cutting/akashic_trapdoor.json +++ b/Fabric/src/generated/resources/data/hexcasting/recipes/compat/farmersdelight/cutting/akashic_trapdoor.json @@ -7,7 +7,7 @@ ], "tool": { "type": "farmersdelight:tool", - "tag": "fabric:tools/axes" + "tag": "c:tools/axes" }, "result": [ { diff --git a/Fabric/src/generated/resources/data/hexcasting/recipes/compat/farmersdelight/cutting/akashic_wood.json b/Fabric/src/generated/resources/data/hexcasting/recipes/compat/farmersdelight/cutting/akashic_wood.json index 95286f7e..c4833f7c 100644 --- a/Fabric/src/generated/resources/data/hexcasting/recipes/compat/farmersdelight/cutting/akashic_wood.json +++ b/Fabric/src/generated/resources/data/hexcasting/recipes/compat/farmersdelight/cutting/akashic_wood.json @@ -7,7 +7,7 @@ ], "tool": { "type": "farmersdelight:tool", - "tag": "fabric:tools/axes" + "tag": "c:tools/axes" }, "result": [ { 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 3dcd23de..5e4239df 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 @@ -6,7 +6,7 @@ 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.ToolIngredient; +import at.petrak.hexcasting.datagen.recipe.builders.FarmersDelightToolIngredient; import at.petrak.hexcasting.fabric.recipe.FabricModConditionalIngredient; import at.petrak.hexcasting.xplat.IXplatAbstractions; import com.google.gson.JsonObject; @@ -121,20 +121,20 @@ public class HexFabricDataGenerators implements DataGeneratorEntrypoint { return FabricModConditionalIngredient.of(defaultIngredient, modid, modIngredient); } - private final ToolIngredient AXE_INGREDIENT = () -> { + private final FarmersDelightToolIngredient AXE_INGREDIENT = () -> { JsonObject object = new JsonObject(); object.addProperty("type", "farmersdelight:tool"); - object.addProperty("tag", "fabric:tools/axes"); + object.addProperty("tag", "c:tools/axes"); return object; }; @Override - public ToolIngredient axeStrip() { + public FarmersDelightToolIngredient axeStrip() { return AXE_INGREDIENT; } @Override - public ToolIngredient axeDig() { + public FarmersDelightToolIngredient axeDig() { return AXE_INGREDIENT; } }; 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 7e289421..57d43683 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 @@ -253,8 +253,9 @@ public class FabricXplatImpl implements IXplatAbstractions { @SuppressWarnings("UnstableApiUsage") public boolean tryPlaceFluid(Level level, InteractionHand hand, BlockPos pos, Fluid fluid) { Storage target = FluidStorage.SIDED.find(level, pos, Direction.UP); - if (target == null) + if (target == null) { return false; + } try (Transaction transaction = Transaction.openOuter()) { long insertedAmount = target.insert(FluidVariant.of(fluid), FluidConstants.BUCKET, transaction); if (insertedAmount > 0) { @@ -269,8 +270,9 @@ public class FabricXplatImpl implements IXplatAbstractions { @SuppressWarnings("UnstableApiUsage") public boolean drainAllFluid(Level level, BlockPos pos) { Storage target = FluidStorage.SIDED.find(level, pos, Direction.UP); - if (target == null) + if (target == null) { return false; + } try (Transaction transaction = Transaction.openOuter()) { boolean any = false; for (var view : target.iterable(transaction)) { @@ -396,7 +398,8 @@ public class FabricXplatImpl implements IXplatAbstractions { @Override public boolean isBreakingAllowed(Level world, BlockPos pos, BlockState state, Player player) { - return PlayerBlockBreakEvents.BEFORE.invoker().beforeBlockBreak(world, player, pos, state, world.getBlockEntity(pos)); + return PlayerBlockBreakEvents.BEFORE.invoker() + .beforeBlockBreak(world, player, pos, state, world.getBlockEntity(pos)); } @Override @@ -431,4 +434,5 @@ public class FabricXplatImpl implements IXplatAbstractions { } return PEHKUI_API; } + } 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 50b5fa10..64ca1979 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 @@ -3,7 +3,7 @@ package at.petrak.hexcasting.forge.datagen; import at.petrak.hexcasting.api.HexAPI; import at.petrak.hexcasting.datagen.*; import at.petrak.hexcasting.datagen.recipe.HexplatRecipes; -import at.petrak.hexcasting.datagen.recipe.builders.ToolIngredient; +import at.petrak.hexcasting.datagen.recipe.builders.FarmersDelightToolIngredient; import at.petrak.hexcasting.forge.datagen.xplat.HexBlockStatesAndModels; import at.petrak.hexcasting.forge.datagen.xplat.HexItemModels; import at.petrak.hexcasting.forge.recipe.ForgeModConditionalIngredient; @@ -128,8 +128,9 @@ public class HexForgeDataGenerators { return ForgeModConditionalIngredient.of(defaultIngredient, modid, modIngredient); } + // https://github.com/vectorwing/FarmersDelight/blob/1.18.2/src/generated/resources/data/farmersdelight/recipes/cutting/amethyst_block.json @Override - public ToolIngredient axeStrip() { + public FarmersDelightToolIngredient axeStrip() { return () -> { JsonObject object = new JsonObject(); object.addProperty("type", "farmersdelight:tool_action"); @@ -139,7 +140,7 @@ public class HexForgeDataGenerators { } @Override - public ToolIngredient axeDig() { + public FarmersDelightToolIngredient axeDig() { return () -> { JsonObject object = new JsonObject(); object.addProperty("type", "farmersdelight:tool_action"); From 9d34fcf1b7431b342b389146fee96bd821db7d92 Mon Sep 17 00:00:00 2001 From: "yrsegal@gmail.com" Date: Fri, 30 Sep 2022 20:29:01 -0400 Subject: [PATCH 101/117] Close #258 --- .../at/petrak/hexcasting/api/spell/casting/CastingContext.kt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Common/src/main/java/at/petrak/hexcasting/api/spell/casting/CastingContext.kt b/Common/src/main/java/at/petrak/hexcasting/api/spell/casting/CastingContext.kt index 4dba1d3a..24a9519b 100644 --- a/Common/src/main/java/at/petrak/hexcasting/api/spell/casting/CastingContext.kt +++ b/Common/src/main/java/at/petrak/hexcasting/api/spell/casting/CastingContext.kt @@ -104,12 +104,12 @@ data class CastingContext( if (this.spellCircle != null) { // we use the eye position cause thats where the caster gets their "position" from val range = this.caster.bbHeight - if (this.spellCircle.activatorAlwaysInRange && vec.distanceToSqr(this.caster.eyePosition) < range * range) + if (this.spellCircle.activatorAlwaysInRange && vec.distanceToSqr(this.caster.eyePosition) <= range * range) return true return this.spellCircle.aabb.contains(vec) } - if (vec.distanceToSqr(this.caster.position()) < Operator.MAX_DISTANCE * Operator.MAX_DISTANCE) + if (vec.distanceToSqr(this.caster.position()) <= Operator.MAX_DISTANCE * Operator.MAX_DISTANCE) return true return false From 44c96f1ee0accfd7132fa271c3dc283bc31b5229 Mon Sep 17 00:00:00 2001 From: "yrsegal@gmail.com" Date: Fri, 30 Sep 2022 20:31:25 -0400 Subject: [PATCH 102/117] Close #240 This doesn't completely eliminate the issue but it does mitigate it significantly --- .../hexcasting/common/casting/operators/OpBlockAxisRaycast.kt | 2 ++ .../hexcasting/common/casting/operators/OpBlockRaycast.kt | 2 ++ .../hexcasting/common/casting/operators/OpEntityRaycast.kt | 2 ++ 3 files changed, 6 insertions(+) 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 0070be12..6b7095be 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 @@ -14,6 +14,8 @@ object OpBlockAxisRaycast : ConstManaOperator { val origin: Vec3 = args.getChecked(0, argc) val look: Vec3 = args.getChecked(1, argc) + ctx.assertVecInRange(origin) + val blockHitResult = ctx.world.clip( ClipContext( origin, 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 0da0082b..70ff9005 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 @@ -14,6 +14,8 @@ object OpBlockRaycast : ConstManaOperator { val origin: Vec3 = args.getChecked(0, argc) val look: Vec3 = args.getChecked(1, argc) + ctx.assertVecInRange(origin) + val blockHitResult = ctx.world.clip( ClipContext( origin, 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 8dfff6c6..0e779e5c 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 @@ -15,6 +15,8 @@ object OpEntityRaycast : ConstManaOperator { val look: Vec3 = args.getChecked(1, argc) val endp = Operator.raycastEnd(origin, look) + ctx.assertVecInRange(origin) + val entityHitResult = ProjectileUtil.getEntityHitResult( ctx.caster, origin, From 4be578ecdd5898f3783f062bb1727dc3153831e3 Mon Sep 17 00:00:00 2001 From: "yrsegal@gmail.com" Date: Fri, 30 Sep 2022 20:33:51 -0400 Subject: [PATCH 103/117] Fix #239 --- Common/src/main/resources/assets/hexcasting/lang/en_us.json | 4 ++-- 1 file changed, 2 insertions(+), 2 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 1844119f..25e628d4 100644 --- a/Common/src/main/resources/assets/hexcasting/lang/en_us.json +++ b/Common/src/main/resources/assets/hexcasting/lang/en_us.json @@ -833,7 +833,7 @@ "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. Costs an amount of media that starts negligible and scales up as the numerical code does.", + "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", @@ -845,7 +845,7 @@ "hexcasting.page.logic.equals": "If the first argument equals the second (within a small tolerance), return 1. Otherwise, return 0.", "hexcasting.page.logic.not_equals": "If the first argument does not equal the second (outside a small tolerance), return 1. Otherwise, return 0.", "hexcasting.page.logic.not": "If the argument is 0 or $(l:casting/influences)$(thing)Null/$, return 1. Otherwise, return 0.", - "hexcasting.page.logic.identity": "If the argument is 0, return $(l:casting/influences)$(thing)Null/$. If it's $(l:casting/influences)$(thing)Null/$, return 0. Otherwise, return the argument", + "hexcasting.page.logic.identity": "If the argument is 0, return $(l:casting/influences)$(thing)Null/$. If it's $(l:casting/influences)$(thing)Null/$, return 0. Otherwise, return the argument.", "hexcasting.page.logic.or": "If the first argument is not $(l:casting/influences)$(thing)Null/$, return it. Otherwise, return the second argument.", "hexcasting.page.logic.and": "If the first argument is $(l:casting/influences)$(thing)Null/$, return $(l:casting/influences)$(thing)Null/$. Otherwise, return the second argument.", "hexcasting.page.logic.xor": "If either argument (but not both) is $(l:casting/influences)$(thing)Null/$, return the non-$(l:casting/influences)$(thing)Null/$ argument. Otherwise, return $(l:casting/influences)$(thing)Null/$.", From 0c3dfa902086f6ccf25f95be255161b32c92ac46 Mon Sep 17 00:00:00 2001 From: "yrsegal@gmail.com" Date: Fri, 30 Sep 2022 20:41:21 -0400 Subject: [PATCH 104/117] Fix #243 --- .../casting/operators/spells/OpBlink.kt | 3 ++- .../operators/spells/great/OpTeleport.kt | 13 ++++++--- .../hexcasting/common/lib/HexEntityTags.java | 1 + .../tags/entity_types/cannot_teleport.json | 27 +++++++++++++++++++ 4 files changed, 39 insertions(+), 5 deletions(-) create mode 100644 Common/src/main/resources/data/hexcasting/tags/entity_types/cannot_teleport.json 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 d5e1e189..015cabcd 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 @@ -6,6 +6,7 @@ import at.petrak.hexcasting.api.spell.casting.CastingContext 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.max import kotlin.math.roundToInt @@ -20,7 +21,7 @@ object OpBlink : SpellOperator { val delta = max(0.0, args.getChecked(1, argc)) ctx.assertEntityInRange(target) - if (!target.canChangeDimensions()) + if (!target.canChangeDimensions() || target.type.`is`(HexEntityTags.CANNOT_TELEPORT)) throw MishapImmuneEntity(target) val dvec = target.lookAngle.scale(delta) 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 ef2cba1f..fefa9965 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 @@ -24,7 +24,7 @@ object OpTeleport : SpellOperator { val delta = args.getChecked(1, argc) ctx.assertEntityInRange(teleportee) - if (!teleportee.canChangeDimensions()) + if (!teleportee.canChangeDimensions() || teleportee.type.`is`(HexEntityTags.CANNOT_TELEPORT)) throw MishapImmuneEntity(teleportee) val targetPos = teleportee.position().add(delta) @@ -83,16 +83,21 @@ object OpTeleport : SpellOperator { } fun teleportRespectSticky(teleportee: Entity, delta: Vec3) { - val base = teleportee.rootVehicle val playersToUpdate = mutableListOf() + val indirect = base.indirectPassengers - if (base.indirectPassengers.any { it.type.`is`(HexEntityTags.STICKY_TELEPORTERS) }) { + val sticky = indirect.any { it.type.`is`(HexEntityTags.STICKY_TELEPORTERS) } + val cannotSticky = indirect.none { it.type.`is`(HexEntityTags.CANNOT_TELEPORT) } + if (sticky && cannotSticky) + return + + if (sticky) { // this handles teleporting the passengers val target = base.position().add(delta) base.teleportTo(target.x, target.y, target.z) - base.indirectPassengers + indirect .filterIsInstance() .forEach(playersToUpdate::add) } else { 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 index 6e9656c0..f7980b9e 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/lib/HexEntityTags.java +++ b/Common/src/main/java/at/petrak/hexcasting/common/lib/HexEntityTags.java @@ -8,6 +8,7 @@ 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/resources/data/hexcasting/tags/entity_types/cannot_teleport.json b/Common/src/main/resources/data/hexcasting/tags/entity_types/cannot_teleport.json new file mode 100644 index 00000000..47f8fc29 --- /dev/null +++ b/Common/src/main/resources/data/hexcasting/tags/entity_types/cannot_teleport.json @@ -0,0 +1,27 @@ +{ + "replace": false, + "values": [ + { + "id": "create:carriage_contraption", + "required": false + }, + { + "id": "create:super_glue", + "required": false + }, + { + "id": "create:crafting_blueprint", + "required": false + }, + { + "id": "create:seat", + "required": false + }, + "minecraft:wither", + "minecraft:end_crystal", + "minecraft:ender_dragon", + "minecraft:item_frame", + "minecraft:painting", + "minecraft:leash_knot" + ] +} From 6e6a2f60aeaf65a57c3df10125e63b8392fa83d2 Mon Sep 17 00:00:00 2001 From: "yrsegal@gmail.com" Date: Fri, 30 Sep 2022 20:50:07 -0400 Subject: [PATCH 105/117] fix #257 --- .../petrak/hexcasting/api/spell/casting/CastingContext.kt | 5 +---- .../hexcasting/tags/entity_types/cannot_teleport.json | 8 ++++++++ 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/Common/src/main/java/at/petrak/hexcasting/api/spell/casting/CastingContext.kt b/Common/src/main/java/at/petrak/hexcasting/api/spell/casting/CastingContext.kt index 24a9519b..deb795da 100644 --- a/Common/src/main/java/at/petrak/hexcasting/api/spell/casting/CastingContext.kt +++ b/Common/src/main/java/at/petrak/hexcasting/api/spell/casting/CastingContext.kt @@ -109,10 +109,7 @@ data class CastingContext( return this.spellCircle.aabb.contains(vec) } - if (vec.distanceToSqr(this.caster.position()) <= Operator.MAX_DISTANCE * Operator.MAX_DISTANCE) - return true - - return false + return vec.distanceToSqr(this.caster.eyePosition) <= Operator.MAX_DISTANCE * Operator.MAX_DISTANCE } fun isEntityInWorld(entity: Entity) = isVecInWorld(entity.position()) diff --git a/Common/src/main/resources/data/hexcasting/tags/entity_types/cannot_teleport.json b/Common/src/main/resources/data/hexcasting/tags/entity_types/cannot_teleport.json index 47f8fc29..74f04d27 100644 --- a/Common/src/main/resources/data/hexcasting/tags/entity_types/cannot_teleport.json +++ b/Common/src/main/resources/data/hexcasting/tags/entity_types/cannot_teleport.json @@ -1,6 +1,14 @@ { "replace": false, "values": [ + { + "id": "create:stationary_contraption", + "required": false + }, + { + "id": "create:gantry_contraption", + "required": false + }, { "id": "create:carriage_contraption", "required": false From c3184afb282152e77a9aa47143d8e6d2e32b93aa Mon Sep 17 00:00:00 2001 From: "yrsegal@gmail.com" Date: Fri, 30 Sep 2022 21:00:30 -0400 Subject: [PATCH 106/117] fix #248 --- .../hexcasting/fabric/FabricHexClientInitializer.kt | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) 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 8a3859b6..280faaba 100644 --- a/Fabric/src/main/java/at/petrak/hexcasting/fabric/FabricHexClientInitializer.kt +++ b/Fabric/src/main/java/at/petrak/hexcasting/fabric/FabricHexClientInitializer.kt @@ -20,15 +20,8 @@ object FabricHexClientInitializer : ClientModInitializer { override fun onInitializeClient() { FabricPacketHandler.initClient() - WorldRenderEvents.LAST.register { ctx -> - // https://www.3dgep.com/understanding-quaternions/ - val quat = ctx.camera().rotation().copy() - quat.mul(-1f) // this should invert it? - ctx.matrixStack().pushPose() - ctx.matrixStack().mulPose(quat) - ctx.matrixStack().scale(-1f, 1f, -1f) + WorldRenderEvents.AFTER_TRANSLUCENT.register { ctx -> HexAdditionalRenderers.overlayLevel(ctx.matrixStack(), ctx.tickDelta()) - ctx.matrixStack().popPose() } HudRenderCallback.EVENT.register(HexAdditionalRenderers::overlayGui) WorldRenderEvents.START.register { ClientTickCounter.renderTickStart(it.tickDelta()) } From 051a334e85a7cdecc50f1aeb20fc3b7ae5c34e4f Mon Sep 17 00:00:00 2001 From: "yrsegal@gmail.com" Date: Fri, 30 Sep 2022 22:23:45 -0400 Subject: [PATCH 107/117] "empty" is clearer than "0 tall" --- .../api/spell/mishaps/MishapNotEnoughArgs.kt | 12 +++++++----- .../main/resources/assets/hexcasting/lang/en_us.json | 1 + 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/Common/src/main/java/at/petrak/hexcasting/api/spell/mishaps/MishapNotEnoughArgs.kt b/Common/src/main/java/at/petrak/hexcasting/api/spell/mishaps/MishapNotEnoughArgs.kt index 33ef2159..a824a1d9 100644 --- a/Common/src/main/java/at/petrak/hexcasting/api/spell/mishaps/MishapNotEnoughArgs.kt +++ b/Common/src/main/java/at/petrak/hexcasting/api/spell/mishaps/MishapNotEnoughArgs.kt @@ -1,10 +1,9 @@ package at.petrak.hexcasting.api.spell.mishaps -import at.petrak.hexcasting.api.spell.SpellDatum -import at.petrak.hexcasting.api.spell.casting.CastingContext -import at.petrak.hexcasting.api.spell.Widget import at.petrak.hexcasting.api.misc.FrozenColorizer -import net.minecraft.network.chat.Component +import at.petrak.hexcasting.api.spell.SpellDatum +import at.petrak.hexcasting.api.spell.Widget +import at.petrak.hexcasting.api.spell.casting.CastingContext import net.minecraft.world.item.DyeColor class MishapNotEnoughArgs(val expected: Int, val got: Int) : Mishap() { @@ -17,5 +16,8 @@ class MishapNotEnoughArgs(val expected: Int, val got: Int) : Mishap() { } override fun errorMessage(ctx: CastingContext, errorCtx: Context) = - error("not_enough_args", actionName(errorCtx.action), expected, got) + if (got == 0) + error("no_args", actionName(errorCtx.action), expected) + else + error("not_enough_args", actionName(errorCtx.action), expected, got) } 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 25e628d4..37aea32b 100644 --- a/Common/src/main/resources/assets/hexcasting/lang/en_us.json +++ b/Common/src/main/resources/assets/hexcasting/lang/en_us.json @@ -426,6 +426,7 @@ "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.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_out_of_world": "%s is not within the world", From 1d6bb8786419b10f754aa81794541d2a5c2f77b5 Mon Sep 17 00:00:00 2001 From: "yrsegal@gmail.com" Date: Sat, 1 Oct 2022 12:52:37 -0400 Subject: [PATCH 108/117] Close #123 --- .../api/spell/mishaps/MishapBadEntity.kt | 33 ++++++++ .../api/spell/mishaps/MishapImmuneEntity.kt | 3 +- .../casting/operators/OpTheCoolerRead.kt | 15 ++-- .../hexcasting/xplat/IXplatAbstractions.java | 4 + .../assets/hexcasting/lang/en_us.json | 2 + .../hexcasting/fabric/cc/CCDataHolder.java | 63 +------------- .../fabric/cc/CCEntityDataHolder.java | 82 +++++++++++++++++++ .../fabric/cc/CCItemDataHolder.java | 65 +++++++++++++++ .../fabric/cc/HexCardinalComponents.java | 11 ++- .../fabric/xplat/FabricXplatImpl.java | 7 ++ .../hexcasting/forge/ForgeHexInitializer.java | 1 + .../forge/cap/ForgeCapabilityHandler.java | 29 +++++++ .../forge/xplat/ForgeXplatImpl.java | 6 ++ 13 files changed, 249 insertions(+), 72 deletions(-) create mode 100644 Common/src/main/java/at/petrak/hexcasting/api/spell/mishaps/MishapBadEntity.kt create mode 100644 Fabric/src/main/java/at/petrak/hexcasting/fabric/cc/CCEntityDataHolder.java create mode 100644 Fabric/src/main/java/at/petrak/hexcasting/fabric/cc/CCItemDataHolder.java diff --git a/Common/src/main/java/at/petrak/hexcasting/api/spell/mishaps/MishapBadEntity.kt b/Common/src/main/java/at/petrak/hexcasting/api/spell/mishaps/MishapBadEntity.kt new file mode 100644 index 00000000..2ef830f4 --- /dev/null +++ b/Common/src/main/java/at/petrak/hexcasting/api/spell/mishaps/MishapBadEntity.kt @@ -0,0 +1,33 @@ +package at.petrak.hexcasting.api.spell.mishaps + +import at.petrak.hexcasting.api.misc.FrozenColorizer +import at.petrak.hexcasting.api.spell.SpellDatum +import at.petrak.hexcasting.api.spell.casting.CastingContext +import at.petrak.hexcasting.api.utils.aqua +import at.petrak.hexcasting.api.utils.asTranslatedComponent +import net.minecraft.network.chat.Component +import net.minecraft.world.entity.Entity +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 = + dyeColor(DyeColor.BROWN) + + override fun execute(ctx: CastingContext, errorCtx: Context, stack: MutableList>) { + yeetHeldItemsTowards(ctx, entity.position()) + } + + override fun errorMessage(ctx: CastingContext, errorCtx: Context) = + error("bad_entity", actionName(errorCtx.action), wanted, entity.displayName.plainCopy().aqua) + + companion object { + @JvmStatic + fun of(entity: Entity, stub: String): Mishap { + val component = "hexcasting.mishap.bad_item.$stub".asTranslatedComponent + if (entity is ItemEntity) + return MishapBadItem(entity, component) + return MishapBadEntity(entity, component) + } + } +} diff --git a/Common/src/main/java/at/petrak/hexcasting/api/spell/mishaps/MishapImmuneEntity.kt b/Common/src/main/java/at/petrak/hexcasting/api/spell/mishaps/MishapImmuneEntity.kt index a0d6a79b..20596ac2 100644 --- a/Common/src/main/java/at/petrak/hexcasting/api/spell/mishaps/MishapImmuneEntity.kt +++ b/Common/src/main/java/at/petrak/hexcasting/api/spell/mishaps/MishapImmuneEntity.kt @@ -3,6 +3,7 @@ package at.petrak.hexcasting.api.spell.mishaps import at.petrak.hexcasting.api.misc.FrozenColorizer import at.petrak.hexcasting.api.spell.SpellDatum 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 @@ -15,5 +16,5 @@ class MishapImmuneEntity(val entity: Entity) : Mishap() { } override fun errorMessage(ctx: CastingContext, errorCtx: Context) = - error("immune_entity", actionName(errorCtx.action), entity.displayName) + error("immune_entity", actionName(errorCtx.action), entity.displayName.plainCopy().aqua) } diff --git a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/OpTheCoolerRead.kt b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/OpTheCoolerRead.kt index a4be799a..83d2327b 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/OpTheCoolerRead.kt +++ b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/OpTheCoolerRead.kt @@ -1,12 +1,12 @@ package at.petrak.hexcasting.common.casting.operators import at.petrak.hexcasting.api.spell.ConstManaOperator -import at.petrak.hexcasting.api.spell.getChecked import at.petrak.hexcasting.api.spell.SpellDatum import at.petrak.hexcasting.api.spell.casting.CastingContext -import at.petrak.hexcasting.api.spell.mishaps.MishapBadItem +import at.petrak.hexcasting.api.spell.getChecked +import at.petrak.hexcasting.api.spell.mishaps.MishapBadEntity import at.petrak.hexcasting.xplat.IXplatAbstractions -import net.minecraft.world.entity.item.ItemEntity +import net.minecraft.world.entity.Entity object OpTheCoolerRead : ConstManaOperator { override val argc = 1 @@ -15,17 +15,16 @@ object OpTheCoolerRead : ConstManaOperator { args: List>, ctx: CastingContext ): List> { - val target = args.getChecked(0, argc) + val target = args.getChecked(0, argc) ctx.assertEntityInRange(target) - val stack = target.item - val datumHolder = IXplatAbstractions.INSTANCE.findDataHolder(stack) - ?: throw MishapBadItem.of(target, "iota.read") + val datumHolder = IXplatAbstractions.INSTANCE.findDataHolder(target) + ?: throw MishapBadEntity.of(target, "iota.read") val datum = datumHolder.readDatum(ctx.world) ?: datumHolder.emptyDatum() - ?: throw MishapBadItem.of(target, "iota.read") + ?: throw MishapBadEntity.of(target, "iota.read") return listOf(datum) } } 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 2b6b3659..d62263a0 100644 --- a/Common/src/main/java/at/petrak/hexcasting/xplat/IXplatAbstractions.java +++ b/Common/src/main/java/at/petrak/hexcasting/xplat/IXplatAbstractions.java @@ -17,6 +17,7 @@ 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; @@ -99,6 +100,9 @@ public interface IXplatAbstractions { @Nullable DataHolder findDataHolder(ItemStack stack); + @Nullable + DataHolder findDataHolder(Entity entity); + @Nullable HexHolder findHexHolder(ItemStack stack); 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 37aea32b..142444e0 100644 --- a/Common/src/main/resources/assets/hexcasting/lang/en_us.json +++ b/Common/src/main/resources/assets/hexcasting/lang/en_us.json @@ -69,6 +69,7 @@ "item.hexcasting.creative_unlocker.tooltip": "Consume to unlock all %s knowledge.", "item.hexcasting.creative_unlocker.mod_name": "Hexcasting", + "entity.hexcasting.wall_scroll": "Hanging Scroll", "block.hexcasting.conjured": "Conjured Block", "block.hexcasting.slate.blank": "Blank Slate", @@ -437,6 +438,7 @@ "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.bad_item.iota": "a place to store iotas", diff --git a/Fabric/src/main/java/at/petrak/hexcasting/fabric/cc/CCDataHolder.java b/Fabric/src/main/java/at/petrak/hexcasting/fabric/cc/CCDataHolder.java index 14b07778..43d3bf65 100644 --- a/Fabric/src/main/java/at/petrak/hexcasting/fabric/cc/CCDataHolder.java +++ b/Fabric/src/main/java/at/petrak/hexcasting/fabric/cc/CCDataHolder.java @@ -1,66 +1,7 @@ package at.petrak.hexcasting.fabric.cc; import at.petrak.hexcasting.api.addldata.DataHolder; -import at.petrak.hexcasting.api.item.DataHolderItem; -import at.petrak.hexcasting.api.spell.SpellDatum; -import dev.onyxstudios.cca.api.v3.item.ItemComponent; -import net.minecraft.nbt.CompoundTag; -import net.minecraft.world.item.ItemStack; -import org.jetbrains.annotations.Nullable; +import dev.onyxstudios.cca.api.v3.component.Component; -import java.util.function.Function; - -public abstract class CCDataHolder extends ItemComponent implements DataHolder { - public CCDataHolder(ItemStack stack) { - super(stack, HexCardinalComponents.DATA_HOLDER); - } - - public static class ItemBased extends CCDataHolder { - private final DataHolderItem dataHolder; - - public ItemBased(ItemStack stack) { - super(stack); - if (!(stack.getItem() instanceof DataHolderItem data)) { - throw new IllegalStateException("item is not a data holder: " + stack); - } - this.dataHolder = data; - } - - @Override - public @Nullable CompoundTag readRawDatum() { - return this.dataHolder.readDatumTag(this.stack); - } - - @Override - public boolean writeDatum(@Nullable SpellDatum datum, boolean simulate) { - var canWrite = this.dataHolder.canWrite(this.stack, datum); - if (!canWrite) { - return false; - } - if (!simulate) { - this.dataHolder.writeDatum(this.stack, datum); - } - return true; - } - } - - public static class Static extends CCDataHolder { - private final Function> provider; - - public Static(ItemStack stack, Function> provider) { - super(stack); - this.provider = provider; - } - - @Override - public @Nullable CompoundTag readRawDatum() { - SpellDatum datum = this.provider.apply(this.stack); - return datum == null ? null : datum.serializeToNBT(); - } - - @Override - public boolean writeDatum(@Nullable SpellDatum datum, boolean simulate) { - return false; - } - } +public interface CCDataHolder extends DataHolder, Component { } diff --git a/Fabric/src/main/java/at/petrak/hexcasting/fabric/cc/CCEntityDataHolder.java b/Fabric/src/main/java/at/petrak/hexcasting/fabric/cc/CCEntityDataHolder.java new file mode 100644 index 00000000..e2433ab9 --- /dev/null +++ b/Fabric/src/main/java/at/petrak/hexcasting/fabric/cc/CCEntityDataHolder.java @@ -0,0 +1,82 @@ +package at.petrak.hexcasting.fabric.cc; + +import at.petrak.hexcasting.api.addldata.DataHolder; +import at.petrak.hexcasting.api.spell.SpellDatum; +import at.petrak.hexcasting.common.entities.EntityWallScroll; +import at.petrak.hexcasting.xplat.IXplatAbstractions; +import net.minecraft.nbt.CompoundTag; +import net.minecraft.server.level.ServerLevel; +import net.minecraft.world.entity.decoration.ItemFrame; +import net.minecraft.world.entity.item.ItemEntity; +import net.minecraft.world.item.ItemStack; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; + +import java.util.function.Supplier; + +public abstract class CCEntityDataHolder implements CCDataHolder { + @Override + public void writeToNbt(@NotNull CompoundTag tag) { + // NO-OP + } + + @Override + public void readFromNbt(@NotNull CompoundTag tag) { + // NO-OP + } + + public static class ItemDelegating extends CCEntityDataHolder { + private final Supplier item; + + public ItemDelegating(Supplier stackSupplier) { + this.item = stackSupplier; + } + + @Override + public @Nullable CompoundTag readRawDatum() { + DataHolder delegate = IXplatAbstractions.INSTANCE.findDataHolder(item.get()); + return delegate == null ? null : delegate.readRawDatum(); + } + + @Override + public boolean writeDatum(@Nullable SpellDatum datum, boolean simulate) { + DataHolder delegate = IXplatAbstractions.INSTANCE.findDataHolder(item.get()); + return delegate != null && delegate.writeDatum(datum, simulate); + } + + @Override + public @Nullable SpellDatum readDatum(ServerLevel world) { + DataHolder delegate = IXplatAbstractions.INSTANCE.findDataHolder(item.get()); + return delegate == null ? null : delegate.readDatum(world); + } + + @Override + public @Nullable SpellDatum emptyDatum() { + DataHolder delegate = IXplatAbstractions.INSTANCE.findDataHolder(item.get()); + return delegate == null ? null : delegate.emptyDatum(); + } + } + + public static class EntityItemDelegating extends ItemDelegating { + public EntityItemDelegating(ItemEntity entity) { + super(entity::getItem); + } + } + + public static class ItemFrameDelegating extends ItemDelegating { + public ItemFrameDelegating(ItemFrame entity) { + super(entity::getItem); + } + } + + public static class ScrollDelegating extends ItemDelegating { + public ScrollDelegating(EntityWallScroll entity) { + super(() -> entity.scroll); + } + + @Override + public boolean writeDatum(@Nullable SpellDatum datum, boolean simulate) { + return false; + } + } +} diff --git a/Fabric/src/main/java/at/petrak/hexcasting/fabric/cc/CCItemDataHolder.java b/Fabric/src/main/java/at/petrak/hexcasting/fabric/cc/CCItemDataHolder.java new file mode 100644 index 00000000..69a40f2c --- /dev/null +++ b/Fabric/src/main/java/at/petrak/hexcasting/fabric/cc/CCItemDataHolder.java @@ -0,0 +1,65 @@ +package at.petrak.hexcasting.fabric.cc; + +import at.petrak.hexcasting.api.item.DataHolderItem; +import at.petrak.hexcasting.api.spell.SpellDatum; +import dev.onyxstudios.cca.api.v3.item.ItemComponent; +import net.minecraft.nbt.CompoundTag; +import net.minecraft.world.item.ItemStack; +import org.jetbrains.annotations.Nullable; + +import java.util.function.Function; + +public abstract class CCItemDataHolder extends ItemComponent implements CCDataHolder { + public CCItemDataHolder(ItemStack stack) { + super(stack, HexCardinalComponents.DATA_HOLDER); + } + + public static class ItemBased extends CCItemDataHolder { + private final DataHolderItem dataHolder; + + public ItemBased(ItemStack stack) { + super(stack); + if (!(stack.getItem() instanceof DataHolderItem data)) { + throw new IllegalStateException("item is not a data holder: " + stack); + } + this.dataHolder = data; + } + + @Override + public @Nullable CompoundTag readRawDatum() { + return this.dataHolder.readDatumTag(this.stack); + } + + @Override + public boolean writeDatum(@Nullable SpellDatum datum, boolean simulate) { + var canWrite = this.dataHolder.canWrite(this.stack, datum); + if (!canWrite) { + return false; + } + if (!simulate) { + this.dataHolder.writeDatum(this.stack, datum); + } + return true; + } + } + + public static class Static extends CCItemDataHolder { + private final Function> provider; + + public Static(ItemStack stack, Function> provider) { + super(stack); + this.provider = provider; + } + + @Override + public @Nullable CompoundTag readRawDatum() { + SpellDatum datum = this.provider.apply(this.stack); + return datum == null ? null : datum.serializeToNBT(); + } + + @Override + public boolean writeDatum(@Nullable SpellDatum datum, boolean simulate) { + return false; + } + } +} 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 19c4bcd3..9c790709 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 @@ -6,6 +6,7 @@ import at.petrak.hexcasting.api.item.HexHolderItem; import at.petrak.hexcasting.api.item.ManaHolderItem; import at.petrak.hexcasting.api.mod.HexConfig; import at.petrak.hexcasting.api.spell.SpellDatum; +import at.petrak.hexcasting.common.entities.EntityWallScroll; import at.petrak.hexcasting.common.lib.HexItems; import dev.onyxstudios.cca.api.v3.component.ComponentKey; import dev.onyxstudios.cca.api.v3.component.ComponentRegistry; @@ -16,6 +17,8 @@ import dev.onyxstudios.cca.api.v3.item.ItemComponentFactoryRegistry; import dev.onyxstudios.cca.api.v3.item.ItemComponentInitializer; import net.minecraft.server.level.ServerPlayer; import net.minecraft.world.entity.Mob; +import net.minecraft.world.entity.decoration.ItemFrame; +import net.minecraft.world.entity.item.ItemEntity; import net.minecraft.world.item.Items; import static at.petrak.hexcasting.api.HexAPI.modLoc; @@ -53,16 +56,20 @@ public class HexCardinalComponents implements EntityComponentInitializer, ItemCo registry.registerFor(ServerPlayer.class, FLIGHT, CCFlight::new); registry.registerFor(ServerPlayer.class, HARNESS, CCHarness::new); registry.registerFor(ServerPlayer.class, PATTERNS, CCPatterns::new); + + registry.registerFor(ItemEntity.class, DATA_HOLDER, CCEntityDataHolder.EntityItemDelegating::new); + registry.registerFor(ItemFrame.class, DATA_HOLDER, CCEntityDataHolder.ItemFrameDelegating::new); + registry.registerFor(EntityWallScroll.class, DATA_HOLDER, CCEntityDataHolder.ScrollDelegating::new); } @Override public void registerItemComponentFactories(ItemComponentFactoryRegistry registry) { registry.register(i -> i instanceof ColorizerItem, COLORIZER, CCColorizer.ItemBased::new); - registry.register(i -> i instanceof DataHolderItem, DATA_HOLDER, CCDataHolder.ItemBased::new); + registry.register(i -> i instanceof DataHolderItem, DATA_HOLDER, CCItemDataHolder.ItemBased::new); // oh havoc, you think you're so funny // the worst part is you're /right/ - registry.register(Items.PUMPKIN_PIE, DATA_HOLDER, stack -> new CCDataHolder.Static(stack, + registry.register(Items.PUMPKIN_PIE, DATA_HOLDER, stack -> new CCItemDataHolder.Static(stack, s -> SpellDatum.make(Math.PI * s.getCount()))); registry.register(i -> i instanceof ManaHolderItem, MANA_HOLDER, CCManaHolder.ItemBased::new); 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 57d43683..b438f593 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 @@ -225,6 +225,13 @@ public class FabricXplatImpl implements IXplatAbstractions { return cc.orElse(null); } + @Override + public @Nullable + DataHolder findDataHolder(Entity entity) { + var cc = HexCardinalComponents.DATA_HOLDER.maybeGet(entity); + return cc.orElse(null); + } + @Override public @Nullable HexHolder findHexHolder(ItemStack stack) { 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 8339ef34..79ee632d 100644 --- a/Forge/src/main/java/at/petrak/hexcasting/forge/ForgeHexInitializer.java +++ b/Forge/src/main/java/at/petrak/hexcasting/forge/ForgeHexInitializer.java @@ -216,6 +216,7 @@ public class ForgeHexInitializer { 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); 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 c8c930a7..fc653057 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 @@ -11,11 +11,15 @@ import at.petrak.hexcasting.api.item.HexHolderItem; import at.petrak.hexcasting.api.item.ManaHolderItem; import at.petrak.hexcasting.api.mod.HexConfig; import at.petrak.hexcasting.api.spell.SpellDatum; +import at.petrak.hexcasting.common.entities.EntityWallScroll; import at.petrak.hexcasting.common.lib.HexItems; import net.minecraft.core.Direction; import net.minecraft.nbt.CompoundTag; import net.minecraft.resources.ResourceLocation; import net.minecraft.server.level.ServerLevel; +import net.minecraft.world.entity.Entity; +import net.minecraft.world.entity.decoration.ItemFrame; +import net.minecraft.world.entity.item.ItemEntity; import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.Items; import net.minecraft.world.level.block.entity.BlockEntity; @@ -84,12 +88,37 @@ public class ForgeCapabilityHandler { () -> new ItemBasedColorizer(colorizer, stack))); } + public static void attachEntityCaps(AttachCapabilitiesEvent evt) { + if (evt.getObject() instanceof ItemEntity item) { + evt.addCapability(DATA_HOLDER_CAPABILITY, delegateTo(item::getItem)); // Delegate to the item + } else if (evt.getObject() instanceof ItemFrame frame) { + evt.addCapability(DATA_HOLDER_CAPABILITY, delegateTo(frame::getItem)); + } else if (evt.getObject() instanceof EntityWallScroll scroll) { + evt.addCapability(DATA_HOLDER_CAPABILITY, delegateTo(() -> scroll.scroll)); + } + } + public static void attachBlockEntityCaps(AttachCapabilitiesEvent evt) { if (evt.getObject() instanceof BlockEntityAbstractImpetus impetus) evt.addCapability(IMPETUS_HANDLER, provide(impetus, CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, () -> new ForgeImpetusCapability(impetus))); } + private static ICapabilityProvider delegateTo(Supplier provider) { + return new ICapabilityProvider() { + @NotNull + @Override + public LazyOptional getCapability(@NotNull Capability cap, @Nullable Direction side) { + var providerInst = provider.get(); + return providerInst == null ? LazyOptional.empty() : providerInst.getCapability(cap, side); + } + }; + } + + private static SimpleProvider provide(Entity entity, Capability capability, NonNullSupplier supplier) { + return provide(entity::isRemoved, capability, supplier); + } + private static SimpleProvider provide(BlockEntity be, Capability capability, NonNullSupplier supplier) { return provide(be::isRemoved, capability, supplier); } 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 916c1626..32d07a9e 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 @@ -265,6 +265,12 @@ public class ForgeXplatImpl implements IXplatAbstractions { return maybeCap.orElse(null); } + @Override + public @Nullable DataHolder findDataHolder(Entity entity) { + var maybeCap = entity.getCapability(HexCapabilities.DATUM).resolve(); + return maybeCap.orElse(null); + } + @Override public @Nullable HexHolder findHexHolder(ItemStack stack) { From 51275356ab0e021a48387c5d38ec1d13e139a3e2 Mon Sep 17 00:00:00 2001 From: "yrsegal@gmail.com" Date: Sat, 1 Oct 2022 12:57:03 -0400 Subject: [PATCH 109/117] change cooler readable as well --- .../common/casting/operators/OpTheCoolerReadable.kt | 12 ++++++------ .../main/resources/assets/hexcasting/lang/en_us.json | 4 ++-- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/OpTheCoolerReadable.kt b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/OpTheCoolerReadable.kt index 39252905..7dbb065d 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/OpTheCoolerReadable.kt +++ b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/OpTheCoolerReadable.kt @@ -6,7 +6,7 @@ import at.petrak.hexcasting.api.spell.asSpellResult import at.petrak.hexcasting.api.spell.casting.CastingContext import at.petrak.hexcasting.api.spell.getChecked import at.petrak.hexcasting.xplat.IXplatAbstractions -import net.minecraft.world.entity.item.ItemEntity +import net.minecraft.world.entity.Entity object OpTheCoolerReadable : ConstManaOperator { override val argc = 1 @@ -15,15 +15,15 @@ object OpTheCoolerReadable : ConstManaOperator { args: List>, ctx: CastingContext ): List> { - val target = args.getChecked(0, argc) + val target = args.getChecked(0, OpTheCoolerRead.argc) ctx.assertEntityInRange(target) - val stack = target.item - val datumHolder = IXplatAbstractions.INSTANCE.findDataHolder(stack) + val datumHolder = IXplatAbstractions.INSTANCE.findDataHolder(target) ?: return false.asSpellResult - if (datumHolder.readDatum(ctx.world) == null && datumHolder.emptyDatum() == null) - return false.asSpellResult + datumHolder.readDatum(ctx.world) + ?: datumHolder.emptyDatum() + ?: return false.asSpellResult return true.asSpellResult } 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 142444e0..ddf6623c 100644 --- a/Common/src/main/resources/assets/hexcasting/lang/en_us.json +++ b/Common/src/main/resources/assets/hexcasting/lang/en_us.json @@ -899,8 +899,8 @@ "hexcasting.entry.readwrite": "Reading and Writing", "hexcasting.page.readwrite.read": "Copy the iota stored in the item (such as a $(l:items/scroll)$(item)Scroll/$, $(l:items/focus)$(item)Focus/$, $(l:items/abacus)$(item)Abacus/$ or $(l:items/spellbook)$(item)Spellbook/$) in my other hand, and add it to the stack.", "hexcasting.page.readwrite.readable": "If the item in my other hand holds an iota I can read, returns 1. Otherwise, returns 0.", - "hexcasting.page.readwrite.read/entity": "Like $(l:patterns/readwrite#hexcasting:read)$(action)Scribe's Reflection/$, but the iota is read out of an item entity instead of my other hand.", - "hexcasting.page.readwrite.readable/entity": "Also like $(l:patterns/readwrite#hexcasting:readable)$(action)Auditor's Reflection/$, but the status is once again read out of an item entity instead of my other hand.", + "hexcasting.page.readwrite.read/entity": "Like $(l:patterns/readwrite#hexcasting:read)$(action)Scribe's Reflection/$, but the iota is read out of an entity instead of my other hand. Pairs well with $(l:items/scroll)$(item)Scrolls/$ or $(item)Item Frames/$.", + "hexcasting.page.readwrite.readable/entity": "Also like $(l:patterns/readwrite#hexcasting:readable)$(action)Auditor's Reflection/$, but the status is once again read out of an entity instead of my other hand.", "hexcasting.page.readwrite.write.1": "Remove the top iota from the stack, and save it into the item in my other hand.", "hexcasting.page.readwrite.write.2": "I can use this spell to save iotas into an (unsealed) $(l:items/focus)$(item)Focus/$ or $(l:items/spellbook)$(item)Spellbook/$, or I can copy patterns onto $(l:items/scroll)$(item)Scrolls/$ or $(l:items/slate)$(item)Slates/$ with the help of $(l:patterns/patterns_as_iotas#hexcasting:escape)$(action)Consideration/$.$(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.", "hexcasting.page.readwrite.writable": "If I could save the given iota into the item in my other hand, returns 1. Otherwise, returns 0.", From 505a97266ce68e0de5f649df2e637b59c0db58ec Mon Sep 17 00:00:00 2001 From: "yrsegal@gmail.com" Date: Sat, 1 Oct 2022 13:04:45 -0400 Subject: [PATCH 110/117] this is probably something we shouldn't let teleport --- .../data/hexcasting/tags/entity_types/cannot_teleport.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Common/src/main/resources/data/hexcasting/tags/entity_types/cannot_teleport.json b/Common/src/main/resources/data/hexcasting/tags/entity_types/cannot_teleport.json index 74f04d27..e84ae30e 100644 --- a/Common/src/main/resources/data/hexcasting/tags/entity_types/cannot_teleport.json +++ b/Common/src/main/resources/data/hexcasting/tags/entity_types/cannot_teleport.json @@ -30,6 +30,7 @@ "minecraft:ender_dragon", "minecraft:item_frame", "minecraft:painting", - "minecraft:leash_knot" + "minecraft:leash_knot", + "minecraft:marker" ] } From 67a019945f38defef34d2a8d47c4d72612602e55 Mon Sep 17 00:00:00 2001 From: "yrsegal@gmail.com" Date: Tue, 4 Oct 2022 10:30:42 -0400 Subject: [PATCH 111/117] euler paths avoid clashes, generate new great spells --- .../petrak/hexcasting/api/PatternRegistry.kt | 51 ++++- .../api/spell/math/EulerPathFinder.kt | 23 +- .../common/casting/RegisterPatterns.java | 1 - .../common/command/ListPatternsCommand.java | 206 ++++++++++-------- .../assets/hexcasting/lang/en_us.json | 4 +- 5 files changed, 190 insertions(+), 95 deletions(-) diff --git a/Common/src/main/java/at/petrak/hexcasting/api/PatternRegistry.kt b/Common/src/main/java/at/petrak/hexcasting/api/PatternRegistry.kt index d8027d4a..ff75472c 100644 --- a/Common/src/main/java/at/petrak/hexcasting/api/PatternRegistry.kt +++ b/Common/src/main/java/at/petrak/hexcasting/api/PatternRegistry.kt @@ -95,6 +95,7 @@ object PatternRegistry { val ds = overworld.dataStorage val perWorldPatterns: Save = ds.computeIfAbsent(Save.Companion::load, { Save.create(overworld.seed) }, TAG_SAVED_DATA) + perWorldPatterns.fillMissingEntries(overworld.seed) perWorldPatterns.lookup[sig]?.let { val op = this.operatorLookup[it.first]!! return op to it.first @@ -178,7 +179,10 @@ object PatternRegistry { /** * Maps angle sigs to resource locations and their preferred start dir so we can look them up in the main registry */ - class Save(val lookup: MutableMap>) : SavedData() { + + class Save(val lookup: MutableMap>, var missingEntries: Boolean) : SavedData() { + constructor(lookup: MutableMap>) : this(lookup, missingAny(lookup)) + override fun save(tag: CompoundTag): CompoundTag { for ((sig, rhs) in this.lookup) { val (id, startDir) = rhs @@ -190,25 +194,60 @@ object PatternRegistry { return tag } + fun fillMissingEntries(seed: Long) { + if (missingEntries) { + var doneAny = false + + val allIds = lookup.values.map { it.first } + for ((prototype, opId) in perWorldPatternLookup.values) { + if (opId !in allIds) { + scrungle(lookup, prototype, opId, seed) + doneAny = true + } + } + + if (doneAny) { + setDirty() + missingEntries = false + } + } + } + companion object { + fun missingAny(lookup: MutableMap>): Boolean { + val allIds = lookup.values.map { it.first } + return perWorldPatternLookup.values.any { it.opId !in allIds } + } + fun load(tag: CompoundTag): Save { val map = HashMap>() + val allIds = mutableSetOf() for (sig in tag.allKeys) { val entry = tag.getCompound(sig) val opId = ResourceLocation.tryParse(entry.getString(TAG_OP_ID)) ?: continue + allIds.add(opId) val startDir = HexDir.values().getSafe(entry.getByte(TAG_START_DIR)) map[sig] = opId to startDir } - return Save(map) + val missingEntries = perWorldPatternLookup.values.any { it.opId !in allIds } + return Save(map, missingEntries) + } + + fun scrungle(lookup: MutableMap>, prototype: HexPattern, opId: ResourceLocation, seed: Long) { + val scrungled = EulerPathFinder.findAltDrawing(prototype, seed) { + val sig = it.anglesSignature() + !lookup.contains(sig) && + !regularPatternLookup.contains(sig) + && specialHandlers.none { handler -> handler.handler.handlePattern(it) != null } + } + lookup[scrungled.anglesSignature()] = opId to scrungled.startDir } @JvmStatic fun create(seed: Long): Save { val map = mutableMapOf>() - for ((opId, entry) in PatternRegistry.perWorldPatternLookup) { - // waugh why doesn't kotlin recursively destructure things - val scrungled = EulerPathFinder.findAltDrawing(entry.prototype, seed) - map[scrungled.anglesSignature()] = opId to scrungled.startDir + for ((prototype, opId) in perWorldPatternLookup.values) { + scrungle(map, prototype, opId, seed) } val save = Save(map) save.setDirty() diff --git a/Common/src/main/java/at/petrak/hexcasting/api/spell/math/EulerPathFinder.kt b/Common/src/main/java/at/petrak/hexcasting/api/spell/math/EulerPathFinder.kt index a9fbe5d4..efdbe780 100644 --- a/Common/src/main/java/at/petrak/hexcasting/api/spell/math/EulerPathFinder.kt +++ b/Common/src/main/java/at/petrak/hexcasting/api/spell/math/EulerPathFinder.kt @@ -1,5 +1,6 @@ package at.petrak.hexcasting.api.spell.math +import at.petrak.hexcasting.api.HexAPI import java.util.* import kotlin.random.Random @@ -8,11 +9,31 @@ object EulerPathFinder { * Find an alternative way to draw the given pattern, based on a random seed. */ @JvmStatic - fun findAltDrawing(original: HexPattern, seed: Long): HexPattern { + @JvmOverloads + fun findAltDrawing(original: HexPattern, seed: Long, rule: (HexPattern) -> Boolean = { true }): HexPattern { // http://www.graph-magics.com/articles/euler.php val rand = Random(seed) + // Don't try for too long, in case all paths are exhausted. + // Unlikely to ever actually reach this limit, and can only happen if the same pattern + // is registered both as a Great Pattern and as a special handler or regular pattern, + // or if the random seed has some sort of strange repeating property to it. + var iterationsLeft = 100 + var path: HexPattern + while (iterationsLeft > 0) { + iterationsLeft-- + path = walkPath(original, rand) + if (rule(path)) { + return path + } + } + + HexAPI.LOGGER.warn("Didn't find alternate path for {} in time", original) + return original + } + + private fun walkPath(original: HexPattern, rand: Random): HexPattern { val graph = toGraph(original) val oddNodes = graph.filter { (_, dirs) -> dirs.size % 2 == 1 } var current: HexCoord = when (oddNodes.size) { diff --git a/Common/src/main/java/at/petrak/hexcasting/common/casting/RegisterPatterns.java b/Common/src/main/java/at/petrak/hexcasting/common/casting/RegisterPatterns.java index 520a04d2..871e4911 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/casting/RegisterPatterns.java +++ b/Common/src/main/java/at/petrak/hexcasting/common/casting/RegisterPatterns.java @@ -293,7 +293,6 @@ public class RegisterPatterns { 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), 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 701b6895..49797055 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 @@ -8,6 +8,7 @@ import at.petrak.hexcasting.common.lib.HexItems; import com.mojang.brigadier.CommandDispatcher; import net.minecraft.commands.CommandSourceStack; import net.minecraft.commands.Commands; +import net.minecraft.commands.arguments.EntityArgument; import net.minecraft.commands.arguments.ResourceLocationArgument; import net.minecraft.nbt.CompoundTag; import net.minecraft.network.chat.TextComponent; @@ -16,98 +17,133 @@ import net.minecraft.resources.ResourceLocation; import net.minecraft.server.level.ServerPlayer; import net.minecraft.world.item.ItemStack; +import java.util.Collection; +import java.util.List; + public class ListPatternsCommand { public static void register(CommandDispatcher dispatcher) { dispatcher.register(Commands.literal("hexcasting:patterns") - .requires(dp -> dp.hasPermission(Commands.LEVEL_ADMINS)) - .then(Commands.literal("list").executes(ctx -> { - - var lookup = PatternRegistry.getPerWorldPatterns(ctx.getSource().getLevel()); - var listing = lookup.entrySet() - .stream() - .sorted((a, b) -> compareResLoc(a.getValue().getFirst(), b.getValue().getFirst())) - .toList(); - - ctx.getSource().sendSuccess(new TranslatableComponent("command.hexcasting.pats.listing"), false); - for (var pair : listing) { - ctx.getSource().sendSuccess(new TextComponent(pair.getValue().getFirst().toString()) - .append(": ") - .append(SpellDatum.make(HexPattern.fromAngles(pair.getKey(), pair.getValue().getSecond())) - .display()), false); - } - - - return lookup.size(); - })) + .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 -> { - var sender = ctx.getSource().getEntity(); - if (sender instanceof ServerPlayer player) { - var targetId = ResourceLocationArgument.getId(ctx, "patternName"); - var pat = PatternResLocArgument.getPattern(ctx, "patternName"); - - - var tag = new CompoundTag(); - tag.putString(ItemScroll.TAG_OP_ID, targetId.toString()); - tag.put(ItemScroll.TAG_PATTERN, - pat.serializeToNBT()); - - var stack = new ItemStack(HexItems.SCROLL_LARGE); - stack.setTag(tag); - - ctx.getSource().sendSuccess( - new TranslatableComponent( - "command.hexcasting.pats.specific.success", - stack.getDisplayName(), - targetId), - true); - - var stackEntity = player.drop(stack, false); - if (stackEntity != null) { - stackEntity.setNoPickUpDelay(); - stackEntity.setOwner(player.getUUID()); - } - - return 1; - } else { - return 0; - } - } - ))) - .then(Commands.literal("giveAll").executes(ctx -> { - var sender = ctx.getSource().getEntity(); - if (sender instanceof ServerPlayer player) { - var lookup = PatternRegistry.getPerWorldPatterns(ctx.getSource().getLevel()); - - lookup.forEach((pattern, entry) -> { - var opId = entry.component1(); - var startDir = entry.component2(); - - var tag = new CompoundTag(); - tag.putString(ItemScroll.TAG_OP_ID, opId.toString()); - tag.put(ItemScroll.TAG_PATTERN, - HexPattern.fromAngles(pattern, startDir).serializeToNBT()); - - var stack = new ItemStack(HexItems.SCROLL_LARGE); - stack.setTag(tag); - - var stackEntity = player.drop(stack, false); - if (stackEntity != null) { - stackEntity.setNoPickUpDelay(); - stackEntity.setOwner(player.getUUID()); - } - }); - - ctx.getSource().sendSuccess( - new TranslatableComponent("command.hexcasting.pats.all", lookup.size()), true); - return lookup.size(); - } else { - return 0; - } - })) + .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") + .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); + } + return List.of(); + } + + private static int list(CommandSourceStack source) { + var lookup = PatternRegistry.getPerWorldPatterns(source.getLevel()); + var listing = lookup.entrySet() + .stream() + .sorted((a, b) -> compareResLoc(a.getValue().getFirst(), b.getValue().getFirst())) + .toList(); + + source.sendSuccess(new TranslatableComponent("command.hexcasting.pats.listing"), false); + for (var pair : listing) { + source.sendSuccess(new TextComponent(pair.getValue().getFirst().toString()) + .append(": ") + .append(SpellDatum.make(HexPattern.fromAngles(pair.getKey(), pair.getValue().getSecond())) + .display()), false); + } + + + return lookup.size(); + } + + private static int giveAll(CommandSourceStack source, Collection targets) { + if (!targets.isEmpty()) { + var lookup = PatternRegistry.getPerWorldPatterns(source.getLevel()); + + lookup.forEach((pattern, entry) -> { + var opId = entry.component1(); + var startDir = entry.component2(); + + var tag = new CompoundTag(); + tag.putString(ItemScroll.TAG_OP_ID, opId.toString()); + tag.put(ItemScroll.TAG_PATTERN, + HexPattern.fromAngles(pattern, startDir).serializeToNBT()); + + var stack = new ItemStack(HexItems.SCROLL_LARGE); + stack.setTag(tag); + + for (var player : targets) { + var stackEntity = player.drop(stack, false); + if (stackEntity != null) { + stackEntity.setNoPickUpDelay(); + stackEntity.setOwner(player.getUUID()); + } + } + }); + + source.sendSuccess( + new TranslatableComponent("command.hexcasting.pats.all", + lookup.size(), + targets.size() == 1 ? targets.iterator().next().getDisplayName() : targets.size()), + true); + return lookup.size(); + } else { + return 0; + } + } + + 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()); + + var stack = new ItemStack(HexItems.SCROLL_LARGE); + stack.setTag(tag); + + source.sendSuccess( + new TranslatableComponent( + "command.hexcasting.pats.specific.success", + stack.getDisplayName(), + patternName, + targets.size() == 1 ? targets.iterator().next().getDisplayName() : targets.size()), + true); + + for (var player : targets) { + var stackEntity = player.drop(stack, false); + if (stackEntity != null) { + stackEntity.setNoPickUpDelay(); + stackEntity.setOwner(player.getUUID()); + } + } + + return targets.size(); + } else { + return 0; + } + } + private static int compareResLoc(ResourceLocation a, ResourceLocation b) { var ns = a.getNamespace().compareTo(b.getNamespace()); if (ns != 0) { 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 ddf6623c..75d89e4b 100644 --- a/Common/src/main/resources/assets/hexcasting/lang/en_us.json +++ b/Common/src/main/resources/assets/hexcasting/lang/en_us.json @@ -175,8 +175,8 @@ "death.attack.hexcasting.overcast": "%s's mind was subsumed into energy", "command.hexcasting.pats.listing": "Patterns in this world:", - "command.hexcasting.pats.all": "Gave you all %d scrolls", - "command.hexcasting.pats.specific.success": "Gave you %s with id %s", + "command.hexcasting.pats.all": "Gave all %d scrolls to %s", + "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", From 96c3daeca4c73897ea936e93ac77cb1ed304db68 Mon Sep 17 00:00:00 2001 From: "yrsegal@gmail.com" Date: Sat, 15 Oct 2022 21:12:13 -0400 Subject: [PATCH 112/117] fix #264 --- .../api/spell/mishaps/MishapNoSpellCircle.kt | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/Common/src/main/java/at/petrak/hexcasting/api/spell/mishaps/MishapNoSpellCircle.kt b/Common/src/main/java/at/petrak/hexcasting/api/spell/mishaps/MishapNoSpellCircle.kt index b5f3e8b9..54fe1cbc 100644 --- a/Common/src/main/java/at/petrak/hexcasting/api/spell/mishaps/MishapNoSpellCircle.kt +++ b/Common/src/main/java/at/petrak/hexcasting/api/spell/mishaps/MishapNoSpellCircle.kt @@ -3,14 +3,31 @@ package at.petrak.hexcasting.api.spell.mishaps import at.petrak.hexcasting.api.misc.FrozenColorizer import at.petrak.hexcasting.api.spell.SpellDatum import at.petrak.hexcasting.api.spell.casting.CastingContext +import net.minecraft.world.entity.player.Player import net.minecraft.world.item.DyeColor +import net.minecraft.world.item.ItemStack +import net.minecraft.world.item.enchantment.EnchantmentHelper class MishapNoSpellCircle : Mishap() { override fun accentColor(ctx: CastingContext, errorCtx: Context): FrozenColorizer = dyeColor(DyeColor.LIGHT_BLUE) + private inline fun dropAll(player: Player, stacks: MutableList, filter: (ItemStack) -> Boolean = { true }) { + for (index in stacks.indices) { + val item = stacks[index] + if (!item.isEmpty && filter(item)) { + player.drop(item, true, false) + stacks[index] = ItemStack.EMPTY + } + } + } + override fun execute(ctx: CastingContext, errorCtx: Context, stack: MutableList>) { - ctx.caster.inventory.dropAll() + dropAll(ctx.caster, ctx.caster.inventory.items) + dropAll(ctx.caster, ctx.caster.inventory.offhand) + dropAll(ctx.caster, ctx.caster.inventory.armor) { + !EnchantmentHelper.hasBindingCurse(it) + } } override fun errorMessage(ctx: CastingContext, errorCtx: Context) = From 7e9ffbee7aa8c706f8fe5f4ce7ded13092c94aab Mon Sep 17 00:00:00 2001 From: "yrsegal@gmail.com" Date: Sat, 15 Oct 2022 21:13:52 -0400 Subject: [PATCH 113/117] fix #263 --- .../at/petrak/hexcasting/client/ShiftScrollListener.java | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/Common/src/main/java/at/petrak/hexcasting/client/ShiftScrollListener.java b/Common/src/main/java/at/petrak/hexcasting/client/ShiftScrollListener.java index 9b4c21c7..cd1d95b8 100644 --- a/Common/src/main/java/at/petrak/hexcasting/client/ShiftScrollListener.java +++ b/Common/src/main/java/at/petrak/hexcasting/client/ShiftScrollListener.java @@ -26,6 +26,11 @@ public class ShiftScrollListener { // not .isCrouching! that fails for players who are not on the ground // yes, this does work if you remap your sneak key if (player != null && (player.isShiftKeyDown() || !needsSneaking)) { + // Spectators shouldn't interact with items! + if (player.isSpectator()) { + return false; + } + if (IsScrollableItem(player.getMainHandItem().getItem())) { mainHandDelta += delta; return true; From cf1d65cae0803a5083e88d39052fbc3ea7050512 Mon Sep 17 00:00:00 2001 From: "yrsegal@gmail.com" Date: Mon, 17 Oct 2022 21:52:30 -0400 Subject: [PATCH 114/117] fix frozen colorizers being weird on fabric --- .../hexcasting/common/casting/operators/spells/OpColorize.kt | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) 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 29d6854c..fb88367a 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 @@ -35,10 +35,12 @@ object OpColorize : SpellOperator { private data class Spell(val stack: ItemStack) : RenderedSpell { override fun cast(ctx: CastingContext) { + val copy = stack.copy() + copy.count = 1 if (ctx.withdrawItem(stack, 1, true)) { IXplatAbstractions.INSTANCE.setColorizer( ctx.caster, - FrozenColorizer(stack, ctx.caster.uuid) + FrozenColorizer(copy, ctx.caster.uuid) ) } } From 5193a20a0a909a68b60cbafc9115c9833c18cc45 Mon Sep 17 00:00:00 2001 From: "yrsegal@gmail.com" Date: Mon, 17 Oct 2022 21:53:19 -0400 Subject: [PATCH 115/117] Another debug cube feature --- .../api/misc/DiscoveryHandlers.java | 16 ++++++ .../api/spell/casting/CastingContext.kt | 5 ++ .../api/spell/casting/CastingHarness.kt | 15 +++++- .../items/magic/ItemCreativeUnlocker.java | 52 +++++++++++++------ .../assets/hexcasting/lang/en_us.json | 8 +-- .../interop/trinkets/TrinketsApiInterop.java | 12 ++--- .../interop/curios/CuriosApiInterop.java | 16 +++--- 7 files changed, 88 insertions(+), 36 deletions(-) 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 05f0cdcd..497dacdc 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 @@ -10,6 +10,7 @@ import net.minecraft.world.item.ItemStack; import java.util.ArrayList; import java.util.List; +import java.util.function.BiFunction; import java.util.function.Function; import java.util.function.Predicate; @@ -19,6 +20,7 @@ public class DiscoveryHandlers { 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> DEBUG_DISCOVERER = new ArrayList<>(); public static boolean hasLens(Player player) { for (var predicate : HAS_LENS_PREDICATE) { @@ -61,6 +63,16 @@ public class DiscoveryHandlers { return stacks; } + public static ItemStack findDebugItem(Player player, String type) { + for (var discoverer : DEBUG_DISCOVERER) { + var stack = discoverer.apply(player, type); + if (!stack.isEmpty()) { + return stack; + } + } + return ItemStack.EMPTY; + } + public static void addLensPredicate(Predicate predicate) { HAS_LENS_PREDICATE.add(predicate); } @@ -80,4 +92,8 @@ public class DiscoveryHandlers { public static void addOperativeSlotDiscoverer(Function> discoverer) { OPERATIVE_SLOT_DISCOVERER.add(discoverer); } + + public static void addDebugItemDiscoverer(BiFunction discoverer) { + DEBUG_DISCOVERER.add(discoverer); + } } diff --git a/Common/src/main/java/at/petrak/hexcasting/api/spell/casting/CastingContext.kt b/Common/src/main/java/at/petrak/hexcasting/api/spell/casting/CastingContext.kt index deb795da..3cd3119b 100644 --- a/Common/src/main/java/at/petrak/hexcasting/api/spell/casting/CastingContext.kt +++ b/Common/src/main/java/at/petrak/hexcasting/api/spell/casting/CastingContext.kt @@ -8,6 +8,7 @@ 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.utils.otherHand +import at.petrak.hexcasting.common.items.magic.ItemCreativeUnlocker import at.petrak.hexcasting.xplat.IXplatAbstractions import net.minecraft.core.BlockPos import net.minecraft.server.level.ServerLevel @@ -200,6 +201,10 @@ data class CastingContext( return advs.getOrStartProgress(adv!!).isDone } + val debugPatterns: Boolean by lazy { + !DiscoveryHandlers.findDebugItem(this.caster, ItemCreativeUnlocker.DISPLAY_PATTERNS).isEmpty + } + companion object { init { DiscoveryHandlers.addItemSlotDiscoverer { 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 d4493fce..e824339a 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 @@ -15,6 +15,7 @@ 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.xplat.IXplatAbstractions +import net.minecraft.Util import net.minecraft.nbt.CompoundTag import net.minecraft.nbt.Tag import net.minecraft.resources.ResourceLocation @@ -47,6 +48,12 @@ class CastingHarness private constructor( */ fun executeIota(iota: SpellDatum<*>, world: ServerLevel): ControllerInfo = executeIotas(listOf(iota), world) + private fun displayPattern(pattern: Operator?, iota: SpellDatum<*>) { + if (this.ctx.debugPatterns) { + this.ctx.caster.sendMessage(pattern?.displayName ?: iota.display(), Util.NIL_UUID) + } + } + private fun getOperatorForPattern(iota: SpellDatum<*>, world: ServerLevel): Operator? { if (iota.getType() == DatumType.PATTERN) return PatternRegistry.matchPattern(iota.payload as HexPattern, world) @@ -192,6 +199,7 @@ class CastingHarness private constructor( var cont2 = continuation if (!unenlightened || pattern.alwaysProcessGreatSpell) { + displayPattern(pattern, SpellDatum.make(newPat)) val result = pattern.operate( continuation, this.stack.toMutableList(), @@ -311,7 +319,7 @@ class CastingHarness private constructor( } } - return if (this.parenCount > 0) { + val out = if (this.parenCount > 0) { if (this.escapeNext) { val newParens = this.parenthesized.toMutableList() newParens.add(iota) @@ -380,6 +388,11 @@ class CastingHarness private constructor( } else { null } + + if (out != null) { + displayPattern(operator, iota) + } + return out } /** diff --git a/Common/src/main/java/at/petrak/hexcasting/common/items/magic/ItemCreativeUnlocker.java b/Common/src/main/java/at/petrak/hexcasting/common/items/magic/ItemCreativeUnlocker.java index 8c088177..a1d751b1 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/items/magic/ItemCreativeUnlocker.java +++ b/Common/src/main/java/at/petrak/hexcasting/common/items/magic/ItemCreativeUnlocker.java @@ -36,40 +36,58 @@ import static at.petrak.hexcasting.api.HexAPI.modLoc; public class ItemCreativeUnlocker extends Item implements ManaHolderItem { - static { - DiscoveryHandlers.addManaHolderDiscoverer(harness -> { - var player = harness.getCtx().getCaster(); - if (!player.isCreative()) - return List.of(); + public static final String DISPLAY_MEDIA = "media"; + public static final String DISPLAY_PATTERNS = "patterns"; + static { + DiscoveryHandlers.addDebugItemDiscoverer((player, type) -> { for (ItemStack item : player.getInventory().items) { - if (isDebug(item)) { - return List.of(new DebugUnlockerHolder(item)); + if (isDebug(item, type)) { + return item; } } // Technically possible with commands! for (ItemStack item : player.getInventory().armor) { - if (isDebug(item)) { - return List.of(new DebugUnlockerHolder(item)); + if (isDebug(item, type)) { + return item; } } for (ItemStack item : player.getInventory().offhand) { - if (isDebug(item)) { - return List.of(new DebugUnlockerHolder(item)); + if (isDebug(item, type)) { + return item; } } + return ItemStack.EMPTY; + }); + DiscoveryHandlers.addManaHolderDiscoverer(harness -> { + var player = harness.getCtx().getCaster(); + if (!player.isCreative()) + return List.of(); + + ItemStack stack = DiscoveryHandlers.findDebugItem(player, DISPLAY_MEDIA); + if (!stack.isEmpty()) + return List.of(new DebugUnlockerHolder(stack)); return List.of(); }); } public static boolean isDebug(ItemStack stack) { - return stack.is(HexItems.CREATIVE_UNLOCKER) - && stack.hasCustomHoverName() - && stack.getHoverName().getString().toLowerCase(Locale.ROOT).contains("debug"); + return isDebug(stack, null); + } + + public static boolean isDebug(ItemStack stack, String flag) { + if (!stack.is(HexItems.CREATIVE_UNLOCKER) || !stack.hasCustomHoverName()) { + return false; + } + var keywords = Arrays.asList(stack.getHoverName().getString().toLowerCase(Locale.ROOT).split(" ")); + if (!keywords.contains("debug")) { + return false; + } + return flag == null || keywords.contains(flag); } public static Component infiniteMedia(Level level) { @@ -129,7 +147,7 @@ public class ItemCreativeUnlocker extends Item implements ManaHolderItem { @Override public int withdrawMana(ItemStack stack, int cost, boolean simulate) { // In case it's withdrawn through other means - if (!simulate && isDebug(stack)) { + if (!simulate && isDebug(stack, DISPLAY_MEDIA)) { addToIntArray(stack, TAG_EXTRACTIONS, cost); } @@ -139,7 +157,7 @@ public class ItemCreativeUnlocker extends Item implements ManaHolderItem { @Override public int insertMana(ItemStack stack, int amount, boolean simulate) { // In case it's inserted through other means - if (!simulate && isDebug(stack)) { + if (!simulate && isDebug(stack, DISPLAY_MEDIA)) { addToIntArray(stack, TAG_INSERTIONS, amount); } @@ -153,7 +171,7 @@ public class ItemCreativeUnlocker extends Item implements ManaHolderItem { @Override public void inventoryTick(ItemStack stack, Level level, Entity entity, int slot, boolean selected) { - if (isDebug(stack) && !level.isClientSide) { + if (isDebug(stack, DISPLAY_MEDIA) && !level.isClientSide) { debugDisplay(stack, TAG_EXTRACTIONS, "withdrawn", "all_mana", entity); debugDisplay(stack, TAG_INSERTIONS, "inserted", "infinite_mana", entity); } 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 75d89e4b..8ea33522 100644 --- a/Common/src/main/resources/assets/hexcasting/lang/en_us.json +++ b/Common/src/main/resources/assets/hexcasting/lang/en_us.json @@ -182,10 +182,10 @@ "command.hexcasting.brainsweep.fail.badtype": "%s is not a villager", "command.hexcasting.brainsweep.fail.already": "%s is already empty", "hexcasting.pattern.unknown": "Unknown pattern resource location %s", - "hexcasting.debug.mana_withdrawn": "%s - Mana withdrawn: %s", - "hexcasting.debug.mana_withdrawn.with_dust": "%s - Mana withdrawn: %s (%s in dust)", - "hexcasting.debug.mana_inserted": "%s - Mana inserted: %s", - "hexcasting.debug.mana_inserted.with_dust": "%s - Mana inserted: %s (%s in dust)", + "hexcasting.debug.mana_withdrawn": "%s - Media withdrawn: %s", + "hexcasting.debug.mana_withdrawn.with_dust": "%s - Media withdrawn: %s (%s in dust)", + "hexcasting.debug.mana_inserted": "%s - Media inserted: %s", + "hexcasting.debug.mana_inserted.with_dust": "%s - Media inserted: %s (%s in dust)", "hexcasting.debug.all_mana": "Entire contents", "hexcasting.debug.infinite_mana": "Infinite", diff --git a/Fabric/src/main/java/at/petrak/hexcasting/fabric/interop/trinkets/TrinketsApiInterop.java b/Fabric/src/main/java/at/petrak/hexcasting/fabric/interop/trinkets/TrinketsApiInterop.java index de184b2a..21abc71f 100644 --- a/Fabric/src/main/java/at/petrak/hexcasting/fabric/interop/trinkets/TrinketsApiInterop.java +++ b/Fabric/src/main/java/at/petrak/hexcasting/fabric/interop/trinkets/TrinketsApiInterop.java @@ -2,7 +2,6 @@ package at.petrak.hexcasting.fabric.interop.trinkets; import at.petrak.hexcasting.api.misc.DiscoveryHandlers; import at.petrak.hexcasting.api.utils.ManaHelper; -import at.petrak.hexcasting.common.items.magic.DebugUnlockerHolder; import at.petrak.hexcasting.common.items.magic.ItemCreativeUnlocker; import at.petrak.hexcasting.common.lib.HexItems; import at.petrak.hexcasting.xplat.IXplatAbstractions; @@ -12,6 +11,7 @@ import dev.emi.trinkets.api.client.TrinketRendererRegistry; import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; import net.minecraft.util.Tuple; +import net.minecraft.world.item.ItemStack; import java.util.List; import java.util.Objects; @@ -41,16 +41,16 @@ public class TrinketsApiInterop { return List.of(); }); - DiscoveryHandlers.addManaHolderDiscoverer(harness -> { - Optional optional = TrinketsApi.getTrinketComponent(harness.getCtx().getCaster()); + DiscoveryHandlers.addDebugItemDiscoverer((player, type) -> { + Optional optional = TrinketsApi.getTrinketComponent(player); if (optional.isPresent()) { TrinketComponent component = optional.get(); - var equipped = component.getEquipped(ItemCreativeUnlocker::isDebug); + var equipped = component.getEquipped(stack -> ItemCreativeUnlocker.isDebug(stack, type)); if (!equipped.isEmpty()) { - return List.of(new DebugUnlockerHolder(equipped.get(0).getB())); + return equipped.get(0).getB(); } } - return List.of(); + return ItemStack.EMPTY; }); } diff --git a/Forge/src/main/java/at/petrak/hexcasting/forge/interop/curios/CuriosApiInterop.java b/Forge/src/main/java/at/petrak/hexcasting/forge/interop/curios/CuriosApiInterop.java index f90fa3f2..8a9fa71f 100644 --- a/Forge/src/main/java/at/petrak/hexcasting/forge/interop/curios/CuriosApiInterop.java +++ b/Forge/src/main/java/at/petrak/hexcasting/forge/interop/curios/CuriosApiInterop.java @@ -3,12 +3,12 @@ package at.petrak.hexcasting.forge.interop.curios; import at.petrak.hexcasting.api.addldata.ManaHolder; import at.petrak.hexcasting.api.misc.DiscoveryHandlers; import at.petrak.hexcasting.api.utils.ManaHelper; -import at.petrak.hexcasting.common.items.magic.DebugUnlockerHolder; import at.petrak.hexcasting.common.items.magic.ItemCreativeUnlocker; import at.petrak.hexcasting.common.lib.HexItems; import at.petrak.hexcasting.interop.HexInterop; import at.petrak.hexcasting.xplat.IXplatAbstractions; import com.google.common.collect.Lists; +import net.minecraft.world.item.ItemStack; import net.minecraftforge.fml.InterModComms; import net.minecraftforge.fml.event.lifecycle.FMLClientSetupEvent; import net.minecraftforge.fml.event.lifecycle.InterModEnqueueEvent; @@ -19,6 +19,7 @@ import top.theillusivec4.curios.api.type.inventory.ICurioStacksHandler; import java.util.List; import java.util.concurrent.atomic.AtomicBoolean; +import java.util.concurrent.atomic.AtomicReference; public class CuriosApiInterop { @@ -61,22 +62,21 @@ public class CuriosApiInterop { return holders; }); - - DiscoveryHandlers.addManaHolderDiscoverer(harness -> { - List holders = Lists.newArrayList(); - harness.getCtx().getCaster().getCapability(CuriosCapability.INVENTORY).ifPresent(handler -> { + DiscoveryHandlers.addDebugItemDiscoverer((player, type) -> { + AtomicReference result = new AtomicReference<>(ItemStack.EMPTY); + player.getCapability(CuriosCapability.INVENTORY).ifPresent(handler -> { for (var stacksHandler : handler.getCurios().values()) { var stacks = stacksHandler.getStacks(); for (int i = 0; i < stacks.getSlots(); i++) { var stack = stacks.getStackInSlot(i); - if (ItemCreativeUnlocker.isDebug(stack)) { - holders.add(new DebugUnlockerHolder(stack)); + if (ItemCreativeUnlocker.isDebug(stack, type)) { + result.set(stack); return; } } } }); - return holders; + return result.get(); }); } From a8ec68a8460f550ec62d4eff32d478058e775742 Mon Sep 17 00:00:00 2001 From: "yrsegal@gmail.com" Date: Mon, 24 Oct 2022 12:37:31 -0400 Subject: [PATCH 116/117] fix draining items having weird behavior if passed a stack it can drain from --- .../at/petrak/hexcasting/api/spell/casting/CastingContext.kt | 4 +++- .../hexcasting/common/casting/operators/spells/OpColorize.kt | 3 +-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/Common/src/main/java/at/petrak/hexcasting/api/spell/casting/CastingContext.kt b/Common/src/main/java/at/petrak/hexcasting/api/spell/casting/CastingContext.kt index 3cd3119b..790bd07b 100644 --- a/Common/src/main/java/at/petrak/hexcasting/api/spell/casting/CastingContext.kt +++ b/Common/src/main/java/at/petrak/hexcasting/api/spell/casting/CastingContext.kt @@ -154,11 +154,13 @@ data class CastingContext( fun withdrawItem(item: ItemStack, count: Int, actuallyRemove: Boolean): Boolean { if (this.caster.isCreative) return true + val operativeItem = item.copy() + // TODO: withdraw from ender chest given a specific ender charm? val stacksToExamine = DiscoveryHandlers.collectItemSlots(this) fun matches(stack: ItemStack): Boolean = - !stack.isEmpty && ItemStack.isSameItemSameTags(item, stack) + !stack.isEmpty && ItemStack.isSameItemSameTags(operativeItem, stack) val presentCount = stacksToExamine.fold(0) { acc, stack -> acc + if (matches(stack)) stack.count else 0 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 fb88367a..47179a7b 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 @@ -36,8 +36,7 @@ object OpColorize : SpellOperator { private data class Spell(val stack: ItemStack) : RenderedSpell { override fun cast(ctx: CastingContext) { val copy = stack.copy() - copy.count = 1 - if (ctx.withdrawItem(stack, 1, true)) { + if (ctx.withdrawItem(copy, 1, true)) { IXplatAbstractions.INSTANCE.setColorizer( ctx.caster, FrozenColorizer(copy, ctx.caster.uuid) From 6900328e442e8144b7dcdc829702cce25a74bb24 Mon Sep 17 00:00:00 2001 From: "yrsegal@gmail.com" Date: Mon, 24 Oct 2022 12:41:16 -0400 Subject: [PATCH 117/117] fix documentation not taking into account %% --- doc/collate_data.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/collate_data.py b/doc/collate_data.py index 0bf422a1..b8ea6da2 100755 --- a/doc/collate_data.py +++ b/doc/collate_data.py @@ -112,7 +112,7 @@ def parse_style(sty): raise ValueError("Unknown style: " + sty) def localize(i18n, string, default=None): - return i18n.get(string, default if default else string) if i18n else string + return (i18n.get(string, default if default else string) if i18n else string).replace("%%", "%") format_re = re.compile(r"\$\(([^)]*)\)") def format_string(root_data, string):