diff --git a/Common/src/main/java/at/petrak/hexcasting/common/recipe/ingredient/StateIngredientTag.java b/Common/src/main/java/at/petrak/hexcasting/common/recipe/ingredient/StateIngredientTag.java index 11a59450..923a43d7 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/recipe/ingredient/StateIngredientTag.java +++ b/Common/src/main/java/at/petrak/hexcasting/common/recipe/ingredient/StateIngredientTag.java @@ -19,81 +19,81 @@ import java.util.stream.Stream; import java.util.stream.StreamSupport; public class StateIngredientTag extends StateIngredientBlocks { - private final TagKey tag; + private final TagKey tag; - public StateIngredientTag(ResourceLocation tag) { - super(ImmutableSet.of()); - this.tag = TagKey.create(Registry.BLOCK_REGISTRY, tag); - } + public StateIngredientTag(ResourceLocation tag) { + super(ImmutableSet.of()); + this.tag = TagKey.create(Registry.BLOCK_REGISTRY, tag); + } - public Stream resolve() { - return StreamSupport.stream(Registry.BLOCK.getTagOrEmpty(tag).spliterator(), false) - .map(Holder::value); - } + public Stream resolve() { + return StreamSupport.stream(Registry.BLOCK.getTagOrEmpty(tag).spliterator(), false) + .map(Holder::value); + } - @Override - public boolean test(BlockState state) { - return state.is(tag); - } + @Override + public boolean test(BlockState state) { + return state.is(tag); + } - @Override - public BlockState pick(Random random) { - var values = resolve().toList(); - if (values.isEmpty()) { - return null; - } - return values.get(random.nextInt(values.size())).defaultBlockState(); - } + @Override + public BlockState pick(Random random) { + var values = resolve().toList(); + if (values.isEmpty()) { + return null; + } + return values.get(random.nextInt(values.size())).defaultBlockState(); + } - @Override - public JsonObject serialize() { - JsonObject object = new JsonObject(); - object.addProperty("type", "tag"); - object.addProperty("tag", tag.toString()); - return object; - } + @Override + public JsonObject serialize() { + JsonObject object = new JsonObject(); + object.addProperty("type", "tag"); + object.addProperty("tag", tag.location().toString()); + return object; + } - @Override - public List getDisplayedStacks() { - return resolve() - .filter(b -> b.asItem() != Items.AIR) - .map(ItemStack::new) - .collect(Collectors.toList()); - } + @Override + public List getDisplayedStacks() { + return resolve() + .filter(b -> b.asItem() != Items.AIR) + .map(ItemStack::new) + .collect(Collectors.toList()); + } - @Nonnull - @Override - protected List getBlocks() { - return resolve().toList(); - } + @Nonnull + @Override + protected List getBlocks() { + return resolve().toList(); + } - @Override - public List getDisplayed() { - return resolve().map(Block::defaultBlockState).collect(Collectors.toList()); - } + @Override + public List getDisplayed() { + return resolve().map(Block::defaultBlockState).collect(Collectors.toList()); + } - public ResourceLocation getTagId() { - return tag.location(); - } + public ResourceLocation getTagId() { + return tag.location(); + } - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - return tag.equals(((StateIngredientTag) o).tag); - } + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + return tag.equals(((StateIngredientTag) o).tag); + } - @Override - public int hashCode() { - return tag.hashCode(); - } + @Override + public int hashCode() { + return tag.hashCode(); + } - @Override - public String toString() { - return "StateIngredientTag{" + tag + "}"; - } + @Override + public String toString() { + return "StateIngredientTag{" + tag + "}"; + } } diff --git a/Common/src/main/java/at/petrak/hexcasting/common/recipe/ingredient/brainsweep/BrainsweepeeIngredient.java b/Common/src/main/java/at/petrak/hexcasting/common/recipe/ingredient/brainsweep/BrainsweepeeIngredient.java index 4a06ba8e..293857d6 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/recipe/ingredient/brainsweep/BrainsweepeeIngredient.java +++ b/Common/src/main/java/at/petrak/hexcasting/common/recipe/ingredient/brainsweep/BrainsweepeeIngredient.java @@ -16,9 +16,13 @@ import java.util.Locale; // Partially based on: // https://github.com/SlimeKnights/Mantle/blob/1.18.2/src/main/java/slimeknights/mantle/recipe/ingredient/EntityIngredient.java // Licensed under MIT +// +// .equals must make sense public abstract class BrainsweepeeIngredient { public abstract boolean test(Entity entity, ServerLevel level); + public abstract Component getName(); + public abstract List getTooltip(boolean advanced); public abstract JsonObject serialize(); @@ -33,6 +37,10 @@ public abstract class BrainsweepeeIngredient { @Nullable public abstract Entity exampleEntity(ClientLevel level); + public abstract Type ingrType(); + + public abstract String getSomeKindOfReasonableIDForEmi(); + public static BrainsweepeeIngredient read(FriendlyByteBuf buf) { var type = buf.readVarInt(); return switch (Type.values()[type]) { diff --git a/Common/src/main/java/at/petrak/hexcasting/common/recipe/ingredient/brainsweep/EntityTagIngredient.java b/Common/src/main/java/at/petrak/hexcasting/common/recipe/ingredient/brainsweep/EntityTagIngredient.java index e37b1432..1224ab6e 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/recipe/ingredient/brainsweep/EntityTagIngredient.java +++ b/Common/src/main/java/at/petrak/hexcasting/common/recipe/ingredient/brainsweep/EntityTagIngredient.java @@ -16,6 +16,7 @@ import net.minecraft.world.entity.EntityType; import java.util.ArrayList; import java.util.List; +import java.util.Objects; public class EntityTagIngredient extends BrainsweepeeIngredient { public final TagKey> entityTypeTag; @@ -29,12 +30,25 @@ public class EntityTagIngredient extends BrainsweepeeIngredient { return entity.getType().is(this.entityTypeTag); } + private static String tagKey(ResourceLocation tagLoc) { + return "tag." + + tagLoc.getNamespace() + + "." + + tagLoc.getPath().replace('/', '.'); + } + + @Override + public Component getName() { + String key = tagKey(this.entityTypeTag.location()); + boolean moddersDidAGoodJob = I18n.exists(key); + return moddersDidAGoodJob + ? Component.translatable(key) + : Component.literal("#" + entityTypeTag); + } + @Override public List getTooltip(boolean advanced) { - String key = "tag." - + this.entityTypeTag.location().getNamespace() - + "." - + this.entityTypeTag.location().getPath().replace('/', '.'); + String key = tagKey(this.entityTypeTag.location()); boolean moddersDidAGoodJob = I18n.exists(key); var out = new ArrayList(); @@ -76,8 +90,8 @@ public class EntityTagIngredient extends BrainsweepeeIngredient { } public static EntityTagIngredient deserialize(JsonObject obj) { - var typeLoc = ResourceLocation.tryParse(GsonHelper.getAsString(obj, "entityType")); - var type = TagKey.create(Registry.ENTITY_TYPE_REGISTRY, typeLoc); + var tagLoc = ResourceLocation.tryParse(GsonHelper.getAsString(obj, "tag")); + var type = TagKey.create(Registry.ENTITY_TYPE_REGISTRY, tagLoc); return new EntityTagIngredient(type); } @@ -86,4 +100,30 @@ public class EntityTagIngredient extends BrainsweepeeIngredient { var type = TagKey.create(Registry.ENTITY_TYPE_REGISTRY, typeLoc); return new EntityTagIngredient(type); } + + @Override + public Type ingrType() { + return Type.ENTITY_TAG; + } + + @Override + public String getSomeKindOfReasonableIDForEmi() { + var resloc = this.entityTypeTag.location(); + return resloc.getNamespace() + + "//" + + resloc.getPath(); + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || getClass() != o.getClass()) return false; + EntityTagIngredient that = (EntityTagIngredient) o; + return Objects.equals(entityTypeTag, that.entityTypeTag); + } + + @Override + public int hashCode() { + return Objects.hashCode(this.entityTypeTag); + } } diff --git a/Common/src/main/java/at/petrak/hexcasting/common/recipe/ingredient/brainsweep/EntityTypeIngredient.java b/Common/src/main/java/at/petrak/hexcasting/common/recipe/ingredient/brainsweep/EntityTypeIngredient.java index 2b0bf664..c5b941a5 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/recipe/ingredient/brainsweep/EntityTypeIngredient.java +++ b/Common/src/main/java/at/petrak/hexcasting/common/recipe/ingredient/brainsweep/EntityTypeIngredient.java @@ -12,6 +12,7 @@ import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.EntityType; import java.util.List; +import java.util.Objects; public class EntityTypeIngredient extends BrainsweepeeIngredient { public final EntityType entityType; @@ -26,6 +27,11 @@ public class EntityTypeIngredient extends BrainsweepeeIngredient { return entity.getType() == this.entityType; } + @Override + public Component getName() { + return this.entityType.getDescription(); + } + @Override public List getTooltip(boolean advanced) { return List.of(this.entityType.getDescription()); @@ -64,4 +70,30 @@ public class EntityTypeIngredient extends BrainsweepeeIngredient { var tyId = buf.readVarInt(); return new EntityTypeIngredient(Registry.ENTITY_TYPE.byId(tyId)); } + + @Override + public Type ingrType() { + return Type.ENTITY_TYPE; + } + + @Override + public String getSomeKindOfReasonableIDForEmi() { + var resloc = Registry.ENTITY_TYPE.getKey(this.entityType); + return resloc.getNamespace() + + "//" + + resloc.getPath(); + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || getClass() != o.getClass()) return false; + EntityTypeIngredient that = (EntityTypeIngredient) o; + return Objects.equals(entityType, that.entityType); + } + + @Override + public int hashCode() { + return Objects.hash(entityType); + } } diff --git a/Common/src/main/java/at/petrak/hexcasting/common/recipe/ingredient/brainsweep/VillagerIngredient.java b/Common/src/main/java/at/petrak/hexcasting/common/recipe/ingredient/brainsweep/VillagerIngredient.java index ba62cfe1..c3b82581 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/recipe/ingredient/brainsweep/VillagerIngredient.java +++ b/Common/src/main/java/at/petrak/hexcasting/common/recipe/ingredient/brainsweep/VillagerIngredient.java @@ -26,13 +26,13 @@ import java.util.Objects; * Special case for villagers so we can have biome/profession/level reqs */ public class VillagerIngredient extends BrainsweepeeIngredient { - public final @Nullable ResourceLocation profession; - public final @Nullable ResourceLocation biome; + public final @Nullable VillagerProfession profession; + public final @Nullable VillagerType biome; public final int minLevel; public VillagerIngredient( - @Nullable ResourceLocation profession, - @Nullable ResourceLocation biome, // aka their "type" + @Nullable VillagerProfession profession, + @Nullable VillagerType biome, int minLevel ) { this.profession = profession; @@ -45,23 +45,18 @@ public class VillagerIngredient extends BrainsweepeeIngredient { if (!(entity instanceof Villager villager)) return false; var data = villager.getVillagerData(); - ResourceLocation profID = IXplatAbstractions.INSTANCE.getID(data.getProfession()); - return (this.profession == null || this.profession.equals(profID)) - && (this.biome == null || this.biome.equals(Registry.VILLAGER_TYPE.getKey(data.getType()))) + return (this.profession == null || this.profession.equals(data.getProfession())) + && (this.biome == null || this.biome.equals(data.getType())) && this.minLevel <= data.getLevel(); } @Override public Entity exampleEntity(ClientLevel level) { - var type = this.biome == null - ? VillagerType.PLAINS - : Registry.VILLAGER_TYPE.get(this.biome); - var out = new Villager(EntityType.VILLAGER, level, type); + var biome = Objects.requireNonNullElse(this.biome, VillagerType.PLAINS); + var out = new Villager(EntityType.VILLAGER, level, biome); - var profession = this.profession == null - ? VillagerProfession.TOOLSMITH - : Registry.VILLAGER_PROFESSION.get(this.profession); + var profession = Objects.requireNonNullElse(this.profession, VillagerProfession.TOOLSMITH); out.getVillagerData().setProfession(profession); out.getVillagerData().setLevel(Math.max(this.minLevel, 1)); return out; @@ -70,7 +65,7 @@ public class VillagerIngredient extends BrainsweepeeIngredient { @Override public List getTooltip(boolean advanced) { List tooltip = new ArrayList<>(); - tooltip.add(name()); + tooltip.add(this.getName()); if (advanced) { if (minLevel >= 5) { @@ -81,21 +76,22 @@ public class VillagerIngredient extends BrainsweepeeIngredient { .withStyle(ChatFormatting.DARK_GRAY)); } - if (biome != null) { - tooltip.add(Component.literal(biome.toString()).withStyle(ChatFormatting.DARK_GRAY)); + if (this.biome != null) { + tooltip.add(Component.literal(this.biome.toString()).withStyle(ChatFormatting.DARK_GRAY)); } - ResourceLocation displayId = Objects.requireNonNullElseGet(profession, - () -> Registry.ENTITY_TYPE.getKey(EntityType.VILLAGER)); - tooltip.add(Component.literal(displayId.toString()).withStyle(ChatFormatting.DARK_GRAY)); + if (this.profession != null) { + tooltip.add(Component.literal(this.profession.toString()).withStyle(ChatFormatting.DARK_GRAY)); + } } - tooltip.add(getModNameComponent()); + tooltip.add(this.getModNameComponent()); return tooltip; } - public Component name() { + @Override + public Component getName() { MutableComponent component = Component.literal(""); boolean addedAny = false; @@ -115,14 +111,19 @@ public class VillagerIngredient extends BrainsweepeeIngredient { if (addedAny) { component.append(" "); } - component.append(Component.translatable("biome.minecraft." + biome.getPath())); + var biomeLoc = Registry.VILLAGER_TYPE.getKey(this.biome); + component.append(Component.translatable("biome." + biomeLoc.getNamespace() + "." + biomeLoc.getPath())); addedAny = true; } if (profession != null) { // We've for sure added something component.append(" "); - component.append(Component.translatable("entity.minecraft.villager." + profession.getPath())); + var professionLoc = Registry.VILLAGER_PROFESSION.getKey(this.profession); + // TODO: what's the convention used for modded villager types? + // Villager::getTypeName implies that it there's no namespace information. + // i hope there is some convention + component.append(Component.translatable("entity.minecraft.villager." + professionLoc.getPath())); } else { if (addedAny) { component.append(" "); @@ -134,7 +135,9 @@ public class VillagerIngredient extends BrainsweepeeIngredient { } public Component getModNameComponent() { - String namespace = profession == null ? "minecraft" : profession.getNamespace(); + String namespace = profession == null + ? "minecraft" + : Registry.VILLAGER_PROFESSION.getKey(this.profession).getNamespace(); String mod = IXplatAbstractions.INSTANCE.getModName(namespace); return Component.literal(mod).withStyle(ChatFormatting.BLUE, ChatFormatting.ITALIC); } @@ -158,13 +161,13 @@ public class VillagerIngredient extends BrainsweepeeIngredient { public void write(FriendlyByteBuf buf) { if (this.profession != null) { buf.writeVarInt(1); - buf.writeResourceLocation(this.profession); + buf.writeVarInt(Registry.VILLAGER_PROFESSION.getId(this.profession)); } else { buf.writeVarInt(0); } if (this.biome != null) { buf.writeVarInt(1); - buf.writeResourceLocation(this.biome); + buf.writeVarInt(Registry.VILLAGER_TYPE.getId(this.biome)); } else { buf.writeVarInt(0); } @@ -172,31 +175,75 @@ public class VillagerIngredient extends BrainsweepeeIngredient { } public static VillagerIngredient deserialize(JsonObject json) { - ResourceLocation profession = null; + VillagerProfession profession = null; if (json.has("profession") && !json.get("profession").isJsonNull()) { - profession = new ResourceLocation(GsonHelper.getAsString(json, "profession")); + profession = Registry.VILLAGER_PROFESSION.get(new ResourceLocation(GsonHelper.getAsString(json, + "profession"))); } - ResourceLocation biome = null; + VillagerType biome = null; if (json.has("biome") && !json.get("biome").isJsonNull()) { - biome = new ResourceLocation(GsonHelper.getAsString(json, "biome")); + biome = Registry.VILLAGER_TYPE.get(new ResourceLocation(GsonHelper.getAsString(json, "biome"))); } int minLevel = GsonHelper.getAsInt(json, "minLevel"); - int cost = GsonHelper.getAsInt(json, "cost"); return new VillagerIngredient(profession, biome, minLevel); } public static VillagerIngredient read(FriendlyByteBuf buf) { - ResourceLocation profession = null; + VillagerProfession profession = null; var hasProfession = buf.readVarInt(); if (hasProfession != 0) { - profession = buf.readResourceLocation(); + profession = Registry.VILLAGER_PROFESSION.byId(buf.readVarInt()); } - ResourceLocation biome = null; + VillagerType biome = null; var hasBiome = buf.readVarInt(); if (hasBiome != 0) { - biome = buf.readResourceLocation(); + biome = Registry.VILLAGER_TYPE.byId(buf.readVarInt()); } int minLevel = buf.readInt(); return new VillagerIngredient(profession, biome, minLevel); } + + @Override + public Type ingrType() { + return Type.VILLAGER; + } + + @Override + public String getSomeKindOfReasonableIDForEmi() { + var bob = new StringBuilder(); + if (this.profession != null) { + var profLoc = Registry.VILLAGER_PROFESSION.getKey(this.profession); + bob.append(profLoc.getNamespace()) + .append("//") + .append(profLoc.getPath()); + } else { + bob.append("null"); + } + bob.append("_"); + if (this.biome != null) { + var biomeLoc = Registry.VILLAGER_TYPE.getKey(this.biome); + bob.append(biomeLoc.getNamespace()) + .append("//") + .append(biomeLoc.getPath()); + } else { + bob.append("null"); + } + + bob.append(this.minLevel); + return bob.toString(); + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || getClass() != o.getClass()) return false; + VillagerIngredient that = (VillagerIngredient) o; + return minLevel == that.minLevel && Objects.equals(profession, that.profession) && Objects.equals(biome, + that.biome); + } + + @Override + public int hashCode() { + return Objects.hash(profession, biome, minLevel); + } } diff --git a/Common/src/main/java/at/petrak/hexcasting/datagen/recipe/HexplatRecipes.java b/Common/src/main/java/at/petrak/hexcasting/datagen/recipe/HexplatRecipes.java new file mode 100644 index 00000000..84ce42d2 --- /dev/null +++ b/Common/src/main/java/at/petrak/hexcasting/datagen/recipe/HexplatRecipes.java @@ -0,0 +1,508 @@ +package at.petrak.hexcasting.datagen.recipe; + +import at.petrak.hexcasting.api.HexAPI; +import at.petrak.hexcasting.api.advancements.OvercastTrigger; +import at.petrak.hexcasting.api.misc.MediaConstants; +import at.petrak.hexcasting.api.mod.HexTags; +import at.petrak.hexcasting.common.items.ItemStaff; +import at.petrak.hexcasting.common.items.colorizer.ItemPrideColorizer; +import at.petrak.hexcasting.common.lib.HexBlocks; +import at.petrak.hexcasting.common.lib.HexItems; +import at.petrak.hexcasting.common.recipe.SealFocusRecipe; +import at.petrak.hexcasting.common.recipe.SealSpellbookRecipe; +import at.petrak.hexcasting.common.recipe.ingredient.StateIngredientHelper; +import at.petrak.hexcasting.common.recipe.ingredient.brainsweep.EntityTagIngredient; +import at.petrak.hexcasting.common.recipe.ingredient.brainsweep.EntityTypeIngredient; +import at.petrak.hexcasting.common.recipe.ingredient.brainsweep.VillagerIngredient; +import at.petrak.hexcasting.datagen.IXplatConditionsBuilder; +import at.petrak.hexcasting.datagen.IXplatIngredients; +import at.petrak.hexcasting.datagen.recipe.builders.BrainsweepRecipeBuilder; +import at.petrak.hexcasting.datagen.recipe.builders.CompatIngredientValue; +import at.petrak.hexcasting.datagen.recipe.builders.CreateCrushingRecipeBuilder; +import at.petrak.hexcasting.datagen.recipe.builders.FarmersDelightCuttingRecipeBuilder; +import at.petrak.paucal.api.datagen.PaucalRecipeProvider; +import net.minecraft.advancements.critereon.EntityPredicate; +import net.minecraft.advancements.critereon.MinMaxBounds; +import net.minecraft.core.Registry; +import net.minecraft.data.DataGenerator; +import net.minecraft.data.recipes.*; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.sounds.SoundEvents; +import net.minecraft.tags.BlockTags; +import net.minecraft.tags.EntityTypeTags; +import net.minecraft.tags.ItemTags; +import net.minecraft.world.entity.EntityType; +import net.minecraft.world.entity.npc.VillagerProfession; +import net.minecraft.world.item.DyeColor; +import net.minecraft.world.item.DyeItem; +import net.minecraft.world.item.Item; +import net.minecraft.world.item.Items; +import net.minecraft.world.item.crafting.Ingredient; +import net.minecraft.world.item.crafting.SimpleRecipeSerializer; +import net.minecraft.world.level.block.Blocks; + +import java.util.function.Consumer; +import java.util.function.Function; + +// TODO: need to do a big refactor of this class cause it's giant and unwieldy, probably as part of #360 +public class HexplatRecipes extends PaucalRecipeProvider { + private final DataGenerator generator; + private final IXplatIngredients ingredients; + private final Function conditions; + + public HexplatRecipes(DataGenerator generator, IXplatIngredients ingredients, + Function conditions) { + super(generator, HexAPI.MOD_ID); + this.generator = generator; + this.ingredients = ingredients; + this.conditions = conditions; + } + + @Override + protected void makeRecipes(Consumer recipes) { + specialRecipe(recipes, SealFocusRecipe.SERIALIZER); + specialRecipe(recipes, SealSpellbookRecipe.SERIALIZER); + + staffRecipe(recipes, HexItems.STAFF_OAK, Items.OAK_PLANKS); + staffRecipe(recipes, HexItems.STAFF_BIRCH, Items.BIRCH_PLANKS); + staffRecipe(recipes, HexItems.STAFF_SPRUCE, Items.SPRUCE_PLANKS); + staffRecipe(recipes, HexItems.STAFF_JUNGLE, Items.JUNGLE_PLANKS); + staffRecipe(recipes, HexItems.STAFF_DARK_OAK, Items.DARK_OAK_PLANKS); + staffRecipe(recipes, HexItems.STAFF_ACACIA, Items.ACACIA_PLANKS); + staffRecipe(recipes, HexItems.STAFF_CRIMSON, Items.CRIMSON_PLANKS); + staffRecipe(recipes, HexItems.STAFF_WARPED, Items.WARPED_PLANKS); + staffRecipe(recipes, HexItems.STAFF_EDIFIED, HexBlocks.EDIFIED_PLANKS.asItem()); + + ringCornered(HexItems.FOCUS, 1, + ingredients.glowstoneDust(), + ingredients.leather(), + Ingredient.of(HexItems.CHARGED_AMETHYST)) + .unlockedBy("has_item", hasItem(HexTags.Items.STAVES)) + .save(recipes); + + ShapedRecipeBuilder.shaped(HexItems.SPELLBOOK) + .define('N', ingredients.goldNugget()) + .define('B', Items.WRITABLE_BOOK) + .define('A', HexItems.CHARGED_AMETHYST) + .define('F', Items.CHORUS_FRUIT) // i wanna gate this behind the end SOMEHOW + // hey look its my gender ^^ + .pattern("NBA") + .pattern("NFA") + .pattern("NBA") + .unlockedBy("has_focus", hasItem(HexItems.FOCUS)) + .unlockedBy("has_chorus", hasItem(Items.CHORUS_FRUIT)).save(recipes); + + ringCornerless( + HexItems.CYPHER, 1, + ingredients.copperIngot(), + Ingredient.of(HexItems.AMETHYST_DUST)) + .unlockedBy("has_item", hasItem(HexTags.Items.STAVES)).save(recipes); + + ringCornerless( + HexItems.TRINKET, 1, + ingredients.ironIngot(), + Ingredient.of(Items.AMETHYST_SHARD)) + .unlockedBy("has_item", hasItem(HexTags.Items.STAVES)).save(recipes); + + ShapedRecipeBuilder.shaped(HexItems.ARTIFACT) + .define('F', ingredients.goldIngot()) + .define('A', HexItems.CHARGED_AMETHYST) + // why in god's name does minecraft have two different places for item tags + .define('D', ItemTags.MUSIC_DISCS) + .pattern(" F ") + .pattern("FAF") + .pattern(" D ") + .unlockedBy("has_item", hasItem(HexTags.Items.STAVES)).save(recipes); + + ringCornerless(HexItems.SCRYING_LENS, 1, Items.GLASS, HexItems.AMETHYST_DUST) + .unlockedBy("has_item", hasItem(HexTags.Items.STAVES)).save(recipes); + + ShapedRecipeBuilder.shaped(HexItems.ABACUS) + .define('S', Items.STICK) + .define('A', Items.AMETHYST_SHARD) + .define('W', ItemTags.PLANKS) + .pattern("WAW") + .pattern("SAS") + .pattern("WAW") + .unlockedBy("has_item", hasItem(HexTags.Items.STAVES)).save(recipes); + + // Why am I like this + ShapedRecipeBuilder.shaped(HexItems.SUBMARINE_SANDWICH) + .define('S', Items.STICK) + .define('A', Items.AMETHYST_SHARD) + .define('C', Items.COOKED_BEEF) + .define('B', Items.BREAD) + .pattern(" SA") + .pattern(" C ") + .pattern(" B ") + .unlockedBy("has_item", hasItem(Items.AMETHYST_SHARD)).save(recipes); + + for (var dye : DyeColor.values()) { + var item = HexItems.DYE_COLORIZERS.get(dye); + ShapedRecipeBuilder.shaped(item) + .define('D', HexItems.AMETHYST_DUST) + .define('C', DyeItem.byColor(dye)) + .pattern(" D ") + .pattern("DCD") + .pattern(" D ") + .unlockedBy("has_item", hasItem(HexItems.AMETHYST_DUST)).save(recipes); + } + + gayRecipe(recipes, ItemPrideColorizer.Type.AGENDER, Ingredient.of(Items.GLASS)); + gayRecipe(recipes, ItemPrideColorizer.Type.AROACE, Ingredient.of(Items.WHEAT_SEEDS)); + gayRecipe(recipes, ItemPrideColorizer.Type.AROMANTIC, Ingredient.of(Items.ARROW)); + gayRecipe(recipes, ItemPrideColorizer.Type.ASEXUAL, Ingredient.of(Items.BREAD)); + gayRecipe(recipes, ItemPrideColorizer.Type.BISEXUAL, Ingredient.of(Items.WHEAT)); + gayRecipe(recipes, ItemPrideColorizer.Type.DEMIBOY, Ingredient.of(Items.RAW_IRON)); + gayRecipe(recipes, ItemPrideColorizer.Type.DEMIGIRL, Ingredient.of(Items.RAW_COPPER)); + gayRecipe(recipes, ItemPrideColorizer.Type.GAY, Ingredient.of(Items.STONE_BRICK_WALL)); + gayRecipe(recipes, ItemPrideColorizer.Type.GENDERFLUID, Ingredient.of(Items.WATER_BUCKET)); + gayRecipe(recipes, ItemPrideColorizer.Type.GENDERQUEER, Ingredient.of(Items.GLASS_BOTTLE)); + gayRecipe(recipes, ItemPrideColorizer.Type.INTERSEX, Ingredient.of(Items.AZALEA)); + gayRecipe(recipes, ItemPrideColorizer.Type.LESBIAN, Ingredient.of(Items.HONEYCOMB)); + gayRecipe(recipes, ItemPrideColorizer.Type.NONBINARY, Ingredient.of(Items.MOSS_BLOCK)); + gayRecipe(recipes, ItemPrideColorizer.Type.PANSEXUAL, ingredients.whenModIngredient( + Ingredient.of(Items.CARROT), + "farmersdelight", + CompatIngredientValue.of("farmersdelight:skillet") + )); + gayRecipe(recipes, ItemPrideColorizer.Type.PLURAL, Ingredient.of(Items.REPEATER)); + gayRecipe(recipes, ItemPrideColorizer.Type.TRANSGENDER, Ingredient.of(Items.EGG)); + + ShapedRecipeBuilder.shaped(HexItems.UUID_COLORIZER) + .define('B', Items.BOWL) + .define('D', HexItems.AMETHYST_DUST) + .define('C', Items.AMETHYST_SHARD) + .pattern(" C ") + .pattern(" D ") + .pattern(" B ") + .unlockedBy("has_item", hasItem(HexItems.AMETHYST_DUST)).save(recipes); + + ShapedRecipeBuilder.shaped(HexItems.SCROLL_SMOL) + .define('P', Items.PAPER) + .define('A', Items.AMETHYST_SHARD) + .pattern(" A") + .pattern("P ") + .unlockedBy("has_item", hasItem(Items.AMETHYST_SHARD)).save(recipes); + + ShapedRecipeBuilder.shaped(HexItems.SCROLL_MEDIUM) + .define('P', Items.PAPER) + .define('A', Items.AMETHYST_SHARD) + .pattern(" A") + .pattern("PP ") + .pattern("PP ") + .unlockedBy("has_item", hasItem(Items.AMETHYST_SHARD)).save(recipes); + + ShapedRecipeBuilder.shaped(HexItems.SCROLL_LARGE) + .define('P', Items.PAPER) + .define('A', Items.AMETHYST_SHARD) + .pattern("PPA") + .pattern("PPP") + .pattern("PPP") + .unlockedBy("has_item", hasItem(Items.AMETHYST_SHARD)).save(recipes); + + ShapedRecipeBuilder.shaped(HexItems.SLATE, 6) + .define('S', Items.DEEPSLATE) + .define('A', HexItems.AMETHYST_DUST) + .pattern(" A ") + .pattern("SSS") + .unlockedBy("has_item", hasItem(HexItems.AMETHYST_DUST)).save(recipes); + + ShapedRecipeBuilder.shaped(HexItems.JEWELER_HAMMER) + .define('I', ingredients.ironIngot()) + .define('N', ingredients.ironNugget()) + .define('A', Items.AMETHYST_SHARD) + .define('S', ingredients.stick()) + .pattern("IAN") + .pattern(" S ") + .pattern(" S ") + .unlockedBy("has_item", hasItem(Items.AMETHYST_SHARD)).save(recipes); + + ShapedRecipeBuilder.shaped(HexBlocks.SLATE_BLOCK) + .define('S', HexItems.SLATE) + .pattern("S") + .pattern("S") + .unlockedBy("has_item", hasItem(HexItems.SLATE)) + .save(recipes, modLoc("slate_block_from_slates")); + + ringAll(HexBlocks.SLATE_BLOCK, 8, Blocks.DEEPSLATE, HexItems.AMETHYST_DUST) + .unlockedBy("has_item", hasItem(HexItems.SLATE)).save(recipes); + + packing(HexItems.AMETHYST_DUST, HexBlocks.AMETHYST_DUST_BLOCK.asItem(), "amethyst_dust", + false, recipes); + + ringAll(HexBlocks.AMETHYST_TILES, 8, Blocks.AMETHYST_BLOCK, HexItems.AMETHYST_DUST) + .unlockedBy("has_item", hasItem(HexItems.AMETHYST_DUST)).save(recipes); + + SingleItemRecipeBuilder.stonecutting(Ingredient.of(Blocks.AMETHYST_BLOCK), HexBlocks.AMETHYST_TILES) + .unlockedBy("has_item", hasItem(Blocks.AMETHYST_BLOCK)) + .save(recipes, modLoc("stonecutting/amethyst_tiles")); + + ringAll(HexBlocks.SCROLL_PAPER, 8, Items.PAPER, Items.AMETHYST_SHARD) + .unlockedBy("has_item", hasItem(Items.AMETHYST_SHARD)).save(recipes); + + ShapelessRecipeBuilder.shapeless(HexBlocks.ANCIENT_SCROLL_PAPER, 8) + .requires(ingredients.dyes().get(DyeColor.BROWN)) + .requires(HexBlocks.SCROLL_PAPER, 8) + .unlockedBy("has_item", hasItem(HexBlocks.SCROLL_PAPER)).save(recipes); + + stack(HexBlocks.SCROLL_PAPER_LANTERN, 1, HexBlocks.SCROLL_PAPER, Items.TORCH) + .unlockedBy("has_item", hasItem(HexBlocks.SCROLL_PAPER)).save(recipes); + + stack(HexBlocks.ANCIENT_SCROLL_PAPER_LANTERN, 1, HexBlocks.ANCIENT_SCROLL_PAPER, Items.TORCH) + .unlockedBy("has_item", hasItem(HexBlocks.ANCIENT_SCROLL_PAPER)).save(recipes); + + ShapelessRecipeBuilder.shapeless(HexBlocks.ANCIENT_SCROLL_PAPER_LANTERN, 8) + .requires(ingredients.dyes().get(DyeColor.BROWN)) + .requires(HexBlocks.SCROLL_PAPER_LANTERN, 8) + .unlockedBy("has_item", hasItem(HexBlocks.SCROLL_PAPER_LANTERN)) + .save(recipes, modLoc("ageing_scroll_paper_lantern")); + + stack(HexBlocks.SCONCE, 4, + Ingredient.of(HexItems.CHARGED_AMETHYST), + ingredients.copperIngot()) + .unlockedBy("has_item", hasItem(HexItems.CHARGED_AMETHYST)).save(recipes); + + ShapelessRecipeBuilder.shapeless(HexBlocks.EDIFIED_PLANKS, 4) + .requires(HexTags.Items.EDIFIED_LOGS) + .unlockedBy("has_item", hasItem(HexTags.Items.EDIFIED_LOGS)).save(recipes); + + ShapedRecipeBuilder.shaped(HexBlocks.EDIFIED_WOOD, 3) + .define('W', HexBlocks.EDIFIED_LOG) + .pattern("WW") + .pattern("WW") + .unlockedBy("has_item", hasItem(HexBlocks.EDIFIED_LOG)).save(recipes); + + ShapedRecipeBuilder.shaped(HexBlocks.STRIPPED_EDIFIED_WOOD, 3) + .define('W', HexBlocks.STRIPPED_EDIFIED_LOG) + .pattern("WW") + .pattern("WW") + .unlockedBy("has_item", hasItem(HexBlocks.STRIPPED_EDIFIED_LOG)).save(recipes); + + ring(HexBlocks.EDIFIED_PANEL, 8, + HexTags.Items.EDIFIED_PLANKS, null) + .unlockedBy("has_item", hasItem(HexTags.Items.EDIFIED_PLANKS)).save(recipes); + + ShapedRecipeBuilder.shaped(HexBlocks.EDIFIED_TILE, 6) + .define('W', HexTags.Items.EDIFIED_PLANKS) + .pattern("WW ") + .pattern("W W") + .pattern(" WW") + .unlockedBy("has_item", hasItem(HexTags.Items.EDIFIED_PLANKS)).save(recipes); + + ShapedRecipeBuilder.shaped(HexBlocks.EDIFIED_DOOR, 3) + .define('W', HexTags.Items.EDIFIED_PLANKS) + .pattern("WW") + .pattern("WW") + .pattern("WW") + .unlockedBy("has_item", hasItem(HexTags.Items.EDIFIED_PLANKS)).save(recipes); + + ShapedRecipeBuilder.shaped(HexBlocks.EDIFIED_TRAPDOOR, 2) + .define('W', HexTags.Items.EDIFIED_PLANKS) + .pattern("WWW") + .pattern("WWW") + .unlockedBy("has_item", hasItem(HexTags.Items.EDIFIED_PLANKS)).save(recipes); + + ShapedRecipeBuilder.shaped(HexBlocks.EDIFIED_STAIRS, 4) + .define('W', HexTags.Items.EDIFIED_PLANKS) + .pattern("W ") + .pattern("WW ") + .pattern("WWW") + .unlockedBy("has_item", hasItem(HexTags.Items.EDIFIED_PLANKS)).save(recipes); + + ShapedRecipeBuilder.shaped(HexBlocks.EDIFIED_SLAB, 6) + .define('W', HexTags.Items.EDIFIED_PLANKS) + .pattern("WWW") + .unlockedBy("has_item", hasItem(HexTags.Items.EDIFIED_PLANKS)).save(recipes); + + ShapedRecipeBuilder.shaped(HexBlocks.EDIFIED_PRESSURE_PLATE, 1) + .define('W', HexTags.Items.EDIFIED_PLANKS) + .pattern("WW") + .unlockedBy("has_item", hasItem(HexTags.Items.EDIFIED_PLANKS)).save(recipes); + + ShapelessRecipeBuilder.shapeless(HexBlocks.EDIFIED_BUTTON) + .requires(HexTags.Items.EDIFIED_PLANKS) + .unlockedBy("has_item", hasItem(HexTags.Items.EDIFIED_PLANKS)).save(recipes); + + // TODO: probably should have some constant enlightenment trigger somewhere + var enlightenment = new OvercastTrigger.Instance( + EntityPredicate.Composite.ANY, + MinMaxBounds.Ints.ANY, // add a little bit of slop here + MinMaxBounds.Doubles.atLeast(0.8), + MinMaxBounds.Doubles.between(0.1, 2.05) + ); + ShapedRecipeBuilder.shaped(HexBlocks.EMPTY_IMPETUS) + .define('B', Items.IRON_BARS) + .define('A', HexItems.CHARGED_AMETHYST) + .define('S', HexBlocks.SLATE_BLOCK) + .define('P', Items.PURPUR_BLOCK) + .pattern("PSS") + .pattern("BAB") + .pattern("SSP") + .unlockedBy("enlightenment", enlightenment).save(recipes); + + ShapedRecipeBuilder.shaped(HexBlocks.EMPTY_DIRECTRIX) + .define('C', Items.COMPARATOR) + .define('O', Items.OBSERVER) + .define('A', HexItems.CHARGED_AMETHYST) + .define('S', HexBlocks.SLATE_BLOCK) + .pattern("CSS") + .pattern("OAO") + .pattern("SSC") + .unlockedBy("enlightenment", enlightenment).save(recipes); + + ShapedRecipeBuilder.shaped(HexBlocks.AKASHIC_BOOKSHELF) + .define('L', HexTags.Items.EDIFIED_LOGS) + .define('P', HexTags.Items.EDIFIED_PLANKS) + .define('C', Items.BOOK) + /*this is the*/.pattern("LPL") // and what i have for you today is + .pattern("CCC") + .pattern("LPL") + .unlockedBy("enlightenment", enlightenment).save(recipes); + + ShapedRecipeBuilder.shaped(HexBlocks.AKASHIC_LIGATURE) + .define('L', HexTags.Items.EDIFIED_LOGS) + .define('P', HexTags.Items.EDIFIED_PLANKS) + .define('C', HexItems.CHARGED_AMETHYST) + .pattern("LPL") + .pattern("CCC") + .pattern("LPL") + .unlockedBy("enlightenment", enlightenment).save(recipes); + + new BrainsweepRecipeBuilder(StateIngredientHelper.of(Blocks.AMETHYST_BLOCK), + new VillagerIngredient(null, null, 3), + Blocks.BUDDING_AMETHYST.defaultBlockState(), MediaConstants.CRYSTAL_UNIT * 10) + .unlockedBy("enlightenment", enlightenment) + .save(recipes, modLoc("brainsweep/budding_amethyst")); + + new BrainsweepRecipeBuilder(StateIngredientHelper.of(HexBlocks.EMPTY_IMPETUS), + new VillagerIngredient(VillagerProfession.TOOLSMITH, null, 2), + HexBlocks.IMPETUS_RIGHTCLICK.defaultBlockState(), MediaConstants.CRYSTAL_UNIT * 10) + .unlockedBy("enlightenment", enlightenment) + .save(recipes, modLoc("brainsweep/impetus_rightclick")); + + new BrainsweepRecipeBuilder(StateIngredientHelper.of(HexBlocks.EMPTY_IMPETUS), + new VillagerIngredient(VillagerProfession.TOOLSMITH, null, 2), + HexBlocks.IMPETUS_LOOK.defaultBlockState(), MediaConstants.CRYSTAL_UNIT * 10) + .unlockedBy("enlightenment", enlightenment) + .save(recipes, modLoc("brainsweep/impetus_look")); + + new BrainsweepRecipeBuilder(StateIngredientHelper.of(HexBlocks.EMPTY_IMPETUS), + new VillagerIngredient(VillagerProfession.CLERIC, null, 2), + HexBlocks.IMPETUS_STOREDPLAYER.defaultBlockState(), MediaConstants.CRYSTAL_UNIT * 10) + .unlockedBy("enlightenment", enlightenment) + .save(recipes, modLoc("brainsweep/impetus_storedplayer")); + + new BrainsweepRecipeBuilder(StateIngredientHelper.of(HexBlocks.EMPTY_DIRECTRIX), + new VillagerIngredient(VillagerProfession.MASON, null, 1), + HexBlocks.DIRECTRIX_REDSTONE.defaultBlockState(), MediaConstants.CRYSTAL_UNIT * 10) + .unlockedBy("enlightenment", enlightenment) + .save(recipes, modLoc("brainsweep/directrix_redstone")); + + new BrainsweepRecipeBuilder(StateIngredientHelper.of(HexBlocks.AKASHIC_LIGATURE), + new VillagerIngredient(VillagerProfession.LIBRARIAN, null, 5), + HexBlocks.AKASHIC_RECORD.defaultBlockState(), MediaConstants.CRYSTAL_UNIT * 10) + .unlockedBy("enlightenment", enlightenment) + .save(recipes, modLoc("brainsweep/akashic_record")); + + // Temporary tests + new BrainsweepRecipeBuilder(StateIngredientHelper.of(BlockTags.SMALL_FLOWERS), + new EntityTypeIngredient(EntityType.ALLAY), + Blocks.AMETHYST_CLUSTER.defaultBlockState(), MediaConstants.SHARD_UNIT) + .unlockedBy("enlightenment", enlightenment) + .save(recipes, modLoc("brainsweep/testing/flowey_the_flower")); + new BrainsweepRecipeBuilder(StateIngredientHelper.of(Blocks.SCAFFOLDING), + new EntityTagIngredient(EntityTypeTags.SKELETONS), + Blocks.BONE_BLOCK.defaultBlockState(), MediaConstants.SHARD_UNIT) + .unlockedBy("enlightenment", enlightenment) + .save(recipes, modLoc("brainsweep/testing/bad_to_the_bone")); + + // Create compat + this.conditions.apply(new CreateCrushingRecipeBuilder() + .withInput(Blocks.AMETHYST_CLUSTER) + .duration(150) + .withOutput(Items.AMETHYST_SHARD, 7) + .withOutput(HexItems.AMETHYST_DUST, 5) + .withOutput(0.25f, HexItems.CHARGED_AMETHYST)) + .whenModLoaded("create") + .save(recipes, new ResourceLocation("create", "crushing/amethyst_cluster")); + + this.conditions.apply(new CreateCrushingRecipeBuilder() + .withInput(Blocks.AMETHYST_BLOCK) + .duration(150) + .withOutput(Items.AMETHYST_SHARD, 3) + .withOutput(0.5f, HexItems.AMETHYST_DUST, 4)) + .whenModLoaded("create") + .save(recipes, new ResourceLocation("create", "crushing/amethyst_block")); + + this.conditions.apply(new CreateCrushingRecipeBuilder() + .withInput(Items.AMETHYST_SHARD) + .duration(150) + .withOutput(HexItems.AMETHYST_DUST, 4) + .withOutput(0.5f, HexItems.AMETHYST_DUST)) + .whenModLoaded("create") + .save(recipes, modLoc("compat/create/crushing/amethyst_shard")); + + // FD compat + this.conditions.apply(new FarmersDelightCuttingRecipeBuilder() + .withInput(HexBlocks.EDIFIED_LOG) + .withTool(ingredients.axeStrip()) + .withOutput(HexBlocks.STRIPPED_EDIFIED_LOG) + .withOutput("farmersdelight:tree_bark") + .withSound(SoundEvents.AXE_STRIP)) + .whenModLoaded("farmersdelight") + .save(recipes, modLoc("compat/farmersdelight/cutting/akashic_log")); + + this.conditions.apply(new FarmersDelightCuttingRecipeBuilder() + .withInput(HexBlocks.EDIFIED_WOOD) + .withTool(ingredients.axeStrip()) + .withOutput(HexBlocks.STRIPPED_EDIFIED_WOOD) + .withOutput("farmersdelight:tree_bark") + .withSound(SoundEvents.AXE_STRIP)) + .whenModLoaded("farmersdelight") + .save(recipes, modLoc("compat/farmersdelight/cutting/akashic_wood")); + + this.conditions.apply(new FarmersDelightCuttingRecipeBuilder() + .withInput(HexBlocks.EDIFIED_TRAPDOOR) + .withTool(ingredients.axeDig()) + .withOutput(HexBlocks.EDIFIED_PLANKS)) + .whenModLoaded("farmersdelight") + .save(recipes, modLoc("compat/farmersdelight/cutting/akashic_trapdoor")); + + this.conditions.apply(new FarmersDelightCuttingRecipeBuilder() + .withInput(HexBlocks.EDIFIED_DOOR) + .withTool(ingredients.axeDig()) + .withOutput(HexBlocks.EDIFIED_PLANKS)) + .whenModLoaded("farmersdelight") + .save(recipes, modLoc("compat/farmersdelight/cutting/akashic_door")); + } + + private void staffRecipe(Consumer recipes, ItemStaff staff, Item plank) { + ShapedRecipeBuilder.shaped(staff) + .define('W', plank) + .define('S', Items.STICK) + .define('A', HexItems.CHARGED_AMETHYST) + .pattern(" SA") + .pattern(" WS") + .pattern("S ") + .unlockedBy("has_item", hasItem(HexItems.CHARGED_AMETHYST)) + .save(recipes); + } + + private void gayRecipe(Consumer recipes, ItemPrideColorizer.Type type, Ingredient material) { + var colorizer = HexItems.PRIDE_COLORIZERS.get(type); + ShapedRecipeBuilder.shaped(colorizer) + .define('D', HexItems.AMETHYST_DUST) + .define('C', material) + .pattern(" D ") + .pattern("DCD") + .pattern(" D ") + .unlockedBy("has_item", hasItem(HexItems.AMETHYST_DUST)) + .save(recipes); + } + + private void specialRecipe(Consumer consumer, SimpleRecipeSerializer serializer) { + var name = Registry.RECIPE_SERIALIZER.getKey(serializer); + SpecialRecipeBuilder.special(serializer).save(consumer, HexAPI.MOD_ID + ":dynamic" + name.getPath()); + } +} diff --git a/Common/src/main/java/at/petrak/hexcasting/datagen/recipe/HexplatRecipes.kt b/Common/src/main/java/at/petrak/hexcasting/datagen/recipe/HexplatRecipes.kt deleted file mode 100644 index 17c69dc5..00000000 --- a/Common/src/main/java/at/petrak/hexcasting/datagen/recipe/HexplatRecipes.kt +++ /dev/null @@ -1,486 +0,0 @@ -package at.petrak.hexcasting.datagen.recipe - -import at.petrak.hexcasting.api.HexAPI -import at.petrak.hexcasting.api.advancements.OvercastTrigger -import at.petrak.hexcasting.api.misc.MediaConstants -import at.petrak.hexcasting.common.items.ItemStaff -import at.petrak.hexcasting.common.items.colorizer.ItemPrideColorizer -import at.petrak.hexcasting.common.lib.HexBlocks -import at.petrak.hexcasting.common.lib.HexItems -import at.petrak.hexcasting.common.recipe.SealFocusRecipe -import at.petrak.hexcasting.common.recipe.SealSpellbookRecipe -import at.petrak.hexcasting.common.recipe.ingredient.StateIngredientHelper -import at.petrak.hexcasting.common.recipe.ingredient.brainsweep.VillagerIngredient -import at.petrak.hexcasting.datagen.IXplatConditionsBuilder -import at.petrak.hexcasting.datagen.IXplatIngredients -import at.petrak.hexcasting.datagen.recipe.builders.BrainsweepRecipeBuilder -import at.petrak.hexcasting.datagen.recipe.builders.CompatIngredientValue -import at.petrak.hexcasting.datagen.recipe.builders.CreateCrushingRecipeBuilder -import at.petrak.hexcasting.datagen.recipe.builders.FarmersDelightCuttingRecipeBuilder -import at.petrak.paucal.api.datagen.PaucalRecipeProvider -import net.minecraft.advancements.critereon.EntityPredicate -import net.minecraft.advancements.critereon.MinMaxBounds -import net.minecraft.core.Registry -import net.minecraft.data.DataGenerator -import net.minecraft.data.recipes.* -import net.minecraft.resources.ResourceLocation -import net.minecraft.sounds.SoundEvents -import net.minecraft.tags.ItemTags -import net.minecraft.world.item.DyeColor -import net.minecraft.world.item.DyeItem -import net.minecraft.world.item.Item -import net.minecraft.world.item.Items -import net.minecraft.world.item.crafting.Ingredient -import net.minecraft.world.item.crafting.SimpleRecipeSerializer -import net.minecraft.world.level.block.Blocks -import java.util.function.Consumer - -class HexplatRecipes( - val generator: DataGenerator, - val ingredients: IXplatIngredients, - val conditions: (RecipeBuilder) -> IXplatConditionsBuilder -) : PaucalRecipeProvider(generator, HexAPI.MOD_ID) { - - override fun makeRecipes(recipes: Consumer) { - specialRecipe(recipes, SealFocusRecipe.SERIALIZER) - specialRecipe(recipes, SealSpellbookRecipe.SERIALIZER) - - wandRecipe(recipes, HexItems.STAFF_OAK, Items.OAK_PLANKS) - wandRecipe(recipes, HexItems.STAFF_BIRCH, Items.BIRCH_PLANKS) - wandRecipe(recipes, HexItems.STAFF_SPRUCE, Items.SPRUCE_PLANKS) - wandRecipe(recipes, HexItems.STAFF_JUNGLE, Items.JUNGLE_PLANKS) - wandRecipe(recipes, HexItems.STAFF_DARK_OAK, Items.DARK_OAK_PLANKS) - wandRecipe(recipes, HexItems.STAFF_ACACIA, Items.ACACIA_PLANKS) - wandRecipe(recipes, HexItems.STAFF_CRIMSON, Items.CRIMSON_PLANKS) - wandRecipe(recipes, HexItems.STAFF_WARPED, Items.WARPED_PLANKS) - wandRecipe(recipes, HexItems.STAFF_EDIFIED, HexBlocks.EDIFIED_PLANKS.asItem()) - - ringCornered(HexItems.FOCUS, 1, - ingredients.glowstoneDust(), - ingredients.leather(), - Ingredient.of(HexItems.CHARGED_AMETHYST)) - .unlockedBy("has_item", hasItem(HexTags.Items.STAVES)) - .save(recipes) - - ShapedRecipeBuilder.shaped(HexItems.SPELLBOOK) - .define('N', ingredients.goldNugget()) - .define('B', Items.WRITABLE_BOOK) - .define('A', HexItems.CHARGED_AMETHYST) - .define('F', Items.CHORUS_FRUIT) // i wanna gate this behind the end SOMEHOW - // hey look its my gender ^^ - .pattern("NBA") - .pattern("NFA") - .pattern("NBA") - .unlockedBy("has_focus", hasItem(HexItems.FOCUS)) - .unlockedBy("has_chorus", hasItem(Items.CHORUS_FRUIT)).save(recipes) - - ringCornerless( - HexItems.CYPHER, 1, - ingredients.copperIngot(), - Ingredient.of(HexItems.AMETHYST_DUST)) - .unlockedBy("has_item", hasItem(HexTags.Items.STAVES)).save(recipes) - - ringCornerless( - HexItems.TRINKET, 1, - ingredients.ironIngot(), - Ingredient.of(Items.AMETHYST_SHARD)) - .unlockedBy("has_item", hasItem(HexTags.Items.STAVES)).save(recipes) - - ShapedRecipeBuilder.shaped(HexItems.ARTIFACT) - .define('F', ingredients.goldIngot()) - .define('A', HexItems.CHARGED_AMETHYST) - // why in god's name does minecraft have two different places for item tags - .define('D', ItemTags.MUSIC_DISCS) - .pattern(" F ") - .pattern("FAF") - .pattern(" D ") - .unlockedBy("has_item", hasItem(HexTags.Items.STAVES)).save(recipes) - - ringCornerless(HexItems.SCRYING_LENS, 1, Items.GLASS, HexItems.AMETHYST_DUST) - .unlockedBy("has_item", hasItem(HexTags.Items.STAVES)).save(recipes) - - ShapedRecipeBuilder.shaped(HexItems.ABACUS) - .define('S', Items.STICK) - .define('A', Items.AMETHYST_SHARD) - .define('W', ItemTags.PLANKS) - .pattern("WAW") - .pattern("SAS") - .pattern("WAW") - .unlockedBy("has_item", hasItem(HexTags.Items.STAVES)).save(recipes) - - // Why am I like this - ShapedRecipeBuilder.shaped(HexItems.SUBMARINE_SANDWICH) - .define('S', Items.STICK) - .define('A', Items.AMETHYST_SHARD) - .define('C', Items.COOKED_BEEF) - .define('B', Items.BREAD) - .pattern(" SA") - .pattern(" C ") - .pattern(" B ") - .unlockedBy("has_item", hasItem(Items.AMETHYST_SHARD)).save(recipes) - - for (dye in DyeColor.values()) { - val item = HexItems.DYE_COLORIZERS[dye]!! - ShapedRecipeBuilder.shaped(item) - .define('D', HexItems.AMETHYST_DUST) - .define('C', DyeItem.byColor(dye)) - .pattern(" D ") - .pattern("DCD") - .pattern(" D ") - .unlockedBy("has_item", hasItem(HexItems.AMETHYST_DUST)).save(recipes) - } - - gayRecipe(recipes, ItemPrideColorizer.Type.AGENDER, Ingredient.of(Items.GLASS)) - gayRecipe(recipes, ItemPrideColorizer.Type.AROACE, Ingredient.of(Items.WHEAT_SEEDS)) - gayRecipe(recipes, ItemPrideColorizer.Type.AROMANTIC, Ingredient.of(Items.ARROW)) - gayRecipe(recipes, ItemPrideColorizer.Type.ASEXUAL, Ingredient.of(Items.BREAD)) - gayRecipe(recipes, ItemPrideColorizer.Type.BISEXUAL, Ingredient.of(Items.WHEAT)) - gayRecipe(recipes, ItemPrideColorizer.Type.DEMIBOY, Ingredient.of(Items.RAW_IRON)) - gayRecipe(recipes, ItemPrideColorizer.Type.DEMIGIRL, Ingredient.of(Items.RAW_COPPER)) - gayRecipe(recipes, ItemPrideColorizer.Type.GAY, Ingredient.of(Items.STONE_BRICK_WALL)) - gayRecipe(recipes, ItemPrideColorizer.Type.GENDERFLUID, Ingredient.of(Items.WATER_BUCKET)) - gayRecipe(recipes, ItemPrideColorizer.Type.GENDERQUEER, Ingredient.of(Items.GLASS_BOTTLE)) - gayRecipe(recipes, ItemPrideColorizer.Type.INTERSEX, Ingredient.of(Items.AZALEA)) - gayRecipe(recipes, ItemPrideColorizer.Type.LESBIAN, Ingredient.of(Items.HONEYCOMB)) - gayRecipe(recipes, ItemPrideColorizer.Type.NONBINARY, Ingredient.of(Items.MOSS_BLOCK)) - gayRecipe(recipes, ItemPrideColorizer.Type.PANSEXUAL, ingredients.whenModIngredient( - Ingredient.of(Items.CARROT), - "farmersdelight", - CompatIngredientValue.of("farmersdelight:skillet") - )) - gayRecipe(recipes, ItemPrideColorizer.Type.PLURAL, Ingredient.of(Items.REPEATER)) - gayRecipe(recipes, ItemPrideColorizer.Type.TRANSGENDER, Ingredient.of(Items.EGG)) - - ShapedRecipeBuilder.shaped(HexItems.UUID_COLORIZER) - .define('B', Items.BOWL) - .define('D', HexItems.AMETHYST_DUST) - .define('C', Items.AMETHYST_SHARD) - .pattern(" C ") - .pattern(" D ") - .pattern(" B ") - .unlockedBy("has_item", hasItem(HexItems.AMETHYST_DUST)).save(recipes) - - ShapedRecipeBuilder.shaped(HexItems.SCROLL_SMOL) - .define('P', Items.PAPER) - .define('A', Items.AMETHYST_SHARD) - .pattern(" A") - .pattern("P ") - .unlockedBy("has_item", hasItem(Items.AMETHYST_SHARD)).save(recipes) - - ShapedRecipeBuilder.shaped(HexItems.SCROLL_MEDIUM) - .define('P', Items.PAPER) - .define('A', Items.AMETHYST_SHARD) - .pattern(" A") - .pattern("PP ") - .pattern("PP ") - .unlockedBy("has_item", hasItem(Items.AMETHYST_SHARD)).save(recipes) - - ShapedRecipeBuilder.shaped(HexItems.SCROLL_LARGE) - .define('P', Items.PAPER) - .define('A', Items.AMETHYST_SHARD) - .pattern("PPA") - .pattern("PPP") - .pattern("PPP") - .unlockedBy("has_item", hasItem(Items.AMETHYST_SHARD)).save(recipes) - - ShapedRecipeBuilder.shaped(HexItems.SLATE, 6) - .define('S', Items.DEEPSLATE) - .define('A', HexItems.AMETHYST_DUST) - .pattern(" A ") - .pattern("SSS") - .unlockedBy("has_item", hasItem(HexItems.AMETHYST_DUST)).save(recipes) - - ShapedRecipeBuilder.shaped(HexItems.JEWELER_HAMMER) - .define('I', ingredients.ironIngot()) - .define('N', ingredients.ironNugget()) - .define('A', Items.AMETHYST_SHARD) - .define('S', ingredients.stick()) - .pattern("IAN") - .pattern(" S ") - .pattern(" S ") - .unlockedBy("has_item", hasItem(Items.AMETHYST_SHARD)).save(recipes) - - ShapedRecipeBuilder.shaped(HexBlocks.SLATE_BLOCK) - .define('S', HexItems.SLATE) - .pattern("S") - .pattern("S") - .unlockedBy("has_item", hasItem(HexItems.SLATE)) - .save(recipes, modLoc("slate_block_from_slates")) - - ringAll(HexBlocks.SLATE_BLOCK, 8, Blocks.DEEPSLATE, HexItems.AMETHYST_DUST) - .unlockedBy("has_item", hasItem(HexItems.SLATE)).save(recipes) - - packing(HexItems.AMETHYST_DUST, HexBlocks.AMETHYST_DUST_BLOCK.asItem(), "amethyst_dust", - false, recipes) - - ringAll(HexBlocks.AMETHYST_TILES, 8, Blocks.AMETHYST_BLOCK, HexItems.AMETHYST_DUST) - .unlockedBy("has_item", hasItem(HexItems.AMETHYST_DUST)).save(recipes) - - SingleItemRecipeBuilder.stonecutting(Ingredient.of(Blocks.AMETHYST_BLOCK), HexBlocks.AMETHYST_TILES) - .unlockedBy("has_item", hasItem(Blocks.AMETHYST_BLOCK)) - .save(recipes, modLoc("stonecutting/amethyst_tiles")) - - ringAll(HexBlocks.SCROLL_PAPER, 8, Items.PAPER, Items.AMETHYST_SHARD) - .unlockedBy("has_item", hasItem(Items.AMETHYST_SHARD)).save(recipes) - - ShapelessRecipeBuilder.shapeless(HexBlocks.ANCIENT_SCROLL_PAPER, 8) - .requires(ingredients.dyes()[DyeColor.BROWN]!!) - .requires(HexBlocks.SCROLL_PAPER, 8) - .unlockedBy("has_item", hasItem(HexBlocks.SCROLL_PAPER)).save(recipes) - - stack(HexBlocks.SCROLL_PAPER_LANTERN, 1, HexBlocks.SCROLL_PAPER, Items.TORCH) - .unlockedBy("has_item", hasItem(HexBlocks.SCROLL_PAPER)).save(recipes) - - stack(HexBlocks.ANCIENT_SCROLL_PAPER_LANTERN, 1, HexBlocks.ANCIENT_SCROLL_PAPER, Items.TORCH) - .unlockedBy("has_item", hasItem(HexBlocks.ANCIENT_SCROLL_PAPER)).save(recipes) - - ShapelessRecipeBuilder.shapeless(HexBlocks.ANCIENT_SCROLL_PAPER_LANTERN, 8) - .requires(ingredients.dyes()[DyeColor.BROWN]!!) - .requires(HexBlocks.SCROLL_PAPER_LANTERN, 8) - .unlockedBy("has_item", hasItem(HexBlocks.SCROLL_PAPER_LANTERN)) - .save(recipes, modLoc("ageing_scroll_paper_lantern")) - - stack(HexBlocks.SCONCE, 4, - Ingredient.of(HexItems.CHARGED_AMETHYST), - ingredients.copperIngot()) - .unlockedBy("has_item", hasItem(HexItems.CHARGED_AMETHYST)).save(recipes) - - ShapelessRecipeBuilder.shapeless(HexBlocks.EDIFIED_PLANKS, 4) - .requires(HexTags.Items.EDIFIED_LOGS) - .unlockedBy("has_item", hasItem(HexTags.Items.EDIFIED_LOGS)).save(recipes) - - ShapedRecipeBuilder.shaped(HexBlocks.EDIFIED_WOOD, 3) - .define('W', HexBlocks.EDIFIED_LOG) - .pattern("WW") - .pattern("WW") - .unlockedBy("has_item", hasItem(HexBlocks.EDIFIED_LOG)).save(recipes) - - ShapedRecipeBuilder.shaped(HexBlocks.STRIPPED_EDIFIED_WOOD, 3) - .define('W', HexBlocks.STRIPPED_EDIFIED_LOG) - .pattern("WW") - .pattern("WW") - .unlockedBy("has_item", hasItem(HexBlocks.STRIPPED_EDIFIED_LOG)).save(recipes) - - ring(HexBlocks.EDIFIED_PANEL, 8, - HexTags.Items.EDIFIED_PLANKS, null) - .unlockedBy("has_item", hasItem(HexTags.Items.EDIFIED_PLANKS)).save(recipes) - - ShapedRecipeBuilder.shaped(HexBlocks.EDIFIED_TILE, 6) - .define('W', HexTags.Items.EDIFIED_PLANKS) - .pattern("WW ") - .pattern("W W") - .pattern(" WW") - .unlockedBy("has_item", hasItem(HexTags.Items.EDIFIED_PLANKS)).save(recipes) - - ShapedRecipeBuilder.shaped(HexBlocks.EDIFIED_DOOR, 3) - .define('W', HexTags.Items.EDIFIED_PLANKS) - .pattern("WW") - .pattern("WW") - .pattern("WW") - .unlockedBy("has_item", hasItem(HexTags.Items.EDIFIED_PLANKS)).save(recipes) - - ShapedRecipeBuilder.shaped(HexBlocks.EDIFIED_TRAPDOOR, 2) - .define('W', HexTags.Items.EDIFIED_PLANKS) - .pattern("WWW") - .pattern("WWW") - .unlockedBy("has_item", hasItem(HexTags.Items.EDIFIED_PLANKS)).save(recipes) - - ShapedRecipeBuilder.shaped(HexBlocks.EDIFIED_STAIRS, 4) - .define('W', HexTags.Items.EDIFIED_PLANKS) - .pattern("W ") - .pattern("WW ") - .pattern("WWW") - .unlockedBy("has_item", hasItem(HexTags.Items.EDIFIED_PLANKS)).save(recipes) - - ShapedRecipeBuilder.shaped(HexBlocks.EDIFIED_SLAB, 6) - .define('W', HexTags.Items.EDIFIED_PLANKS) - .pattern("WWW") - .unlockedBy("has_item", hasItem(HexTags.Items.EDIFIED_PLANKS)).save(recipes) - - ShapedRecipeBuilder.shaped(HexBlocks.EDIFIED_PRESSURE_PLATE, 1) - .define('W', HexTags.Items.EDIFIED_PLANKS) - .pattern("WW") - .unlockedBy("has_item", hasItem(HexTags.Items.EDIFIED_PLANKS)).save(recipes) - - ShapelessRecipeBuilder.shapeless(HexBlocks.EDIFIED_BUTTON) - .requires(HexTags.Items.EDIFIED_PLANKS) - .unlockedBy("has_item", hasItem(HexTags.Items.EDIFIED_PLANKS)).save(recipes) - - val enlightenment = OvercastTrigger.Instance( - EntityPredicate.Composite.ANY, - MinMaxBounds.Ints.ANY, // add a little bit of slop here - MinMaxBounds.Doubles.atLeast(0.8), - MinMaxBounds.Doubles.between(0.1, 2.05) - ) - ShapedRecipeBuilder.shaped(HexBlocks.EMPTY_IMPETUS) - .define('B', Items.IRON_BARS) - .define('A', HexItems.CHARGED_AMETHYST) - .define('S', HexBlocks.SLATE_BLOCK) - .define('P', Items.PURPUR_BLOCK) - .pattern("PSS") - .pattern("BAB") - .pattern("SSP") - .unlockedBy("enlightenment", enlightenment).save(recipes) - - ShapedRecipeBuilder.shaped(HexBlocks.EMPTY_DIRECTRIX) - .define('C', Items.COMPARATOR) - .define('O', Items.OBSERVER) - .define('A', HexItems.CHARGED_AMETHYST) - .define('S', HexBlocks.SLATE_BLOCK) - .pattern("CSS") - .pattern("OAO") - .pattern("SSC") - .unlockedBy("enlightenment", enlightenment).save(recipes) - - ShapedRecipeBuilder.shaped(HexBlocks.AKASHIC_BOOKSHELF) - .define('L', HexTags.Items.EDIFIED_LOGS) - .define('P', HexTags.Items.EDIFIED_PLANKS) - .define('C', Items.BOOK) - /*this is the*/.pattern("LPL") // and what i have for you today is - .pattern("CCC") - .pattern("LPL") - .unlockedBy("enlightenment", enlightenment).save(recipes) - - ShapedRecipeBuilder.shaped(HexBlocks.AKASHIC_LIGATURE) - .define('L', HexTags.Items.EDIFIED_LOGS) - .define('P', HexTags.Items.EDIFIED_PLANKS) - .define('C', HexItems.CHARGED_AMETHYST) - .pattern("LPL") - .pattern("CCC") - .pattern("LPL") - .unlockedBy("enlightenment", enlightenment).save(recipes) - - BrainsweepRecipeBuilder(StateIngredientHelper.of(Blocks.AMETHYST_BLOCK), - VillagerIngredient(null, null, 3), - Blocks.BUDDING_AMETHYST.defaultBlockState(), MediaConstants.CRYSTAL_UNIT * 10) - .unlockedBy("enlightenment", enlightenment) - .save(recipes, modLoc("brainsweep/budding_amethyst")) - - BrainsweepRecipeBuilder(StateIngredientHelper.of(HexBlocks.EMPTY_IMPETUS), - VillagerIngredient(ResourceLocation("toolsmith"), null, 2), - HexBlocks.IMPETUS_RIGHTCLICK.defaultBlockState(), MediaConstants.CRYSTAL_UNIT * 10) - .unlockedBy("enlightenment", enlightenment) - .save(recipes, modLoc("brainsweep/impetus_rightclick")) - - BrainsweepRecipeBuilder(StateIngredientHelper.of(HexBlocks.EMPTY_IMPETUS), - VillagerIngredient(ResourceLocation("fletcher"), null, 2), - HexBlocks.IMPETUS_LOOK.defaultBlockState(), MediaConstants.CRYSTAL_UNIT * 10) - .unlockedBy("enlightenment", enlightenment) - .save(recipes, modLoc("brainsweep/impetus_look")) - - BrainsweepRecipeBuilder(StateIngredientHelper.of(HexBlocks.EMPTY_IMPETUS), - VillagerIngredient(ResourceLocation("cleric"), null, 2), - HexBlocks.IMPETUS_STOREDPLAYER.defaultBlockState(), MediaConstants.CRYSTAL_UNIT * 10) - .unlockedBy("enlightenment", enlightenment) - .save(recipes, modLoc("brainsweep/impetus_storedplayer")) - - BrainsweepRecipeBuilder(StateIngredientHelper.of(HexBlocks.EMPTY_DIRECTRIX), - VillagerIngredient(ResourceLocation("mason"), null, 1), - HexBlocks.DIRECTRIX_REDSTONE.defaultBlockState(), MediaConstants.CRYSTAL_UNIT * 10) - .unlockedBy("enlightenment", enlightenment) - .save(recipes, modLoc("brainsweep/directrix_redstone")) - - BrainsweepRecipeBuilder(StateIngredientHelper.of(HexBlocks.AKASHIC_LIGATURE), - VillagerIngredient(ResourceLocation("librarian"), null, 5), - HexBlocks.AKASHIC_RECORD.defaultBlockState(), MediaConstants.CRYSTAL_UNIT * 10) - .unlockedBy("enlightenment", enlightenment) - .save(recipes, modLoc("brainsweep/akashic_record")) - - // Create compat - CreateCrushingRecipeBuilder() - .withInput(Blocks.AMETHYST_CLUSTER) - .duration(150) - .withOutput(Items.AMETHYST_SHARD, 7) - .withOutput(HexItems.AMETHYST_DUST, 5) - .withOutput(0.25f, HexItems.CHARGED_AMETHYST) - .withConditions() - .whenModLoaded("create") - .save(recipes, ResourceLocation("create", "crushing/amethyst_cluster")) - - CreateCrushingRecipeBuilder() - .withInput(Blocks.AMETHYST_BLOCK) - .duration(150) - .withOutput(Items.AMETHYST_SHARD, 3) - .withOutput(0.5f, HexItems.AMETHYST_DUST, 4) - .withConditions() - .whenModLoaded("create") - .save(recipes, ResourceLocation("create", "crushing/amethyst_block")) - - CreateCrushingRecipeBuilder() - .withInput(Items.AMETHYST_SHARD) - .duration(150) - .withOutput(HexItems.AMETHYST_DUST, 4) - .withOutput(0.5f, HexItems.AMETHYST_DUST) - .withConditions() - .whenModLoaded("create") - .save(recipes, modLoc("compat/create/crushing/amethyst_shard")) - - // FD compat - FarmersDelightCuttingRecipeBuilder() - .withInput(HexBlocks.EDIFIED_LOG) - .withTool(ingredients.axeStrip()) - .withOutput(HexBlocks.STRIPPED_EDIFIED_LOG) - .withOutput("farmersdelight:tree_bark") - .withSound(SoundEvents.AXE_STRIP) - .withConditions() - .whenModLoaded("farmersdelight") - .save(recipes, modLoc("compat/farmersdelight/cutting/akashic_log")) - - FarmersDelightCuttingRecipeBuilder() - .withInput(HexBlocks.EDIFIED_WOOD) - .withTool(ingredients.axeStrip()) - .withOutput(HexBlocks.STRIPPED_EDIFIED_WOOD) - .withOutput("farmersdelight:tree_bark") - .withSound(SoundEvents.AXE_STRIP) - .withConditions() - .whenModLoaded("farmersdelight") - .save(recipes, modLoc("compat/farmersdelight/cutting/akashic_wood")) - - FarmersDelightCuttingRecipeBuilder() - .withInput(HexBlocks.EDIFIED_TRAPDOOR) - .withTool(ingredients.axeDig()) - .withOutput(HexBlocks.EDIFIED_PLANKS) - .withConditions() - .whenModLoaded("farmersdelight") - .save(recipes, modLoc("compat/farmersdelight/cutting/akashic_trapdoor")) - - FarmersDelightCuttingRecipeBuilder() - .withInput(HexBlocks.EDIFIED_DOOR) - .withTool(ingredients.axeDig()) - .withOutput(HexBlocks.EDIFIED_PLANKS) - .withConditions() - .whenModLoaded("farmersdelight") - .save(recipes, modLoc("compat/farmersdelight/cutting/akashic_door")) - } - - private fun wandRecipe(recipes: Consumer, wand: ItemStaff, plank: Item) { - ShapedRecipeBuilder.shaped(wand) - .define('W', plank) - .define('S', Items.STICK) - .define('A', HexItems.CHARGED_AMETHYST) - .pattern(" SA") - .pattern(" WS") - .pattern("S ") - .unlockedBy("has_item", hasItem(HexItems.CHARGED_AMETHYST)) - .save(recipes) - } - - private fun gayRecipe(recipes: Consumer, type: ItemPrideColorizer.Type, material: Ingredient) { - val colorizer = HexItems.PRIDE_COLORIZERS[type]!! - ShapedRecipeBuilder.shaped(colorizer) - .define('D', HexItems.AMETHYST_DUST) - .define('C', material) - .pattern(" D ") - .pattern("DCD") - .pattern(" D ") - .unlockedBy("has_item", hasItem(HexItems.AMETHYST_DUST)) - .save(recipes) - } - - private fun specialRecipe(consumer: Consumer, serializer: SimpleRecipeSerializer<*>) { - val name = Registry.RECIPE_SERIALIZER.getKey(serializer) - SpecialRecipeBuilder.special(serializer).save(consumer, HexAPI.MOD_ID + ":dynamic/" + name!!.path) - } - - private fun RecipeBuilder.withConditions(): IXplatConditionsBuilder = conditions(this) -} diff --git a/Common/src/main/java/at/petrak/hexcasting/datagen/recipe/builders/BrainsweepRecipeBuilder.java b/Common/src/main/java/at/petrak/hexcasting/datagen/recipe/builders/BrainsweepRecipeBuilder.java index c3f5c76f..5a0bbeef 100644 --- a/Common/src/main/java/at/petrak/hexcasting/datagen/recipe/builders/BrainsweepRecipeBuilder.java +++ b/Common/src/main/java/at/petrak/hexcasting/datagen/recipe/builders/BrainsweepRecipeBuilder.java @@ -22,16 +22,16 @@ import java.util.function.Consumer; public class BrainsweepRecipeBuilder implements RecipeBuilder { private final StateIngredient blockIn; - private final BrainsweepeeIngredient villagerIn; + private final BrainsweepeeIngredient entityIn; private final int mediaCost; private final BlockState result; private final Advancement.Builder advancement; - public BrainsweepRecipeBuilder(StateIngredient blockIn, BrainsweepeeIngredient villagerIn, BlockState result, + public BrainsweepRecipeBuilder(StateIngredient blockIn, BrainsweepeeIngredient entityIn, BlockState result, int mediaCost) { this.blockIn = blockIn; - this.villagerIn = villagerIn; + this.entityIn = entityIn; this.result = result; this.mediaCost = mediaCost; this.advancement = Advancement.Builder.advancement(); @@ -65,7 +65,7 @@ public class BrainsweepRecipeBuilder implements RecipeBuilder { .requirements(RequirementsStrategy.OR); pFinishedRecipeConsumer.accept(new Result( pRecipeId, - this.blockIn, this.villagerIn, this.mediaCost, this.result, + this.blockIn, this.entityIn, this.mediaCost, this.result, this.advancement, new ResourceLocation(pRecipeId.getNamespace(), "recipes/brainsweep/" + pRecipeId.getPath()))); } diff --git a/Common/src/main/java/at/petrak/hexcasting/interop/patchouli/BrainsweepProcessor.java b/Common/src/main/java/at/petrak/hexcasting/interop/patchouli/BrainsweepProcessor.java index 33cfad4e..6694a8ab 100644 --- a/Common/src/main/java/at/petrak/hexcasting/interop/patchouli/BrainsweepProcessor.java +++ b/Common/src/main/java/at/petrak/hexcasting/interop/patchouli/BrainsweepProcessor.java @@ -2,19 +2,20 @@ package at.petrak.hexcasting.interop.patchouli; import at.petrak.hexcasting.common.recipe.BrainsweepRecipe; import at.petrak.hexcasting.common.recipe.HexRecipeStuffRegistry; -import at.petrak.hexcasting.common.recipe.ingredient.brainsweep.EntityTypeIngredient; -import at.petrak.hexcasting.common.recipe.ingredient.brainsweep.VillagerIngredient; import net.minecraft.client.Minecraft; +import net.minecraft.core.Registry; +import net.minecraft.nbt.CompoundTag; import net.minecraft.resources.ResourceLocation; import net.minecraft.world.item.ItemStack; +import org.jetbrains.annotations.Nullable; import vazkii.patchouli.api.IComponentProcessor; import vazkii.patchouli.api.IVariable; import vazkii.patchouli.api.IVariableProvider; -import java.util.Objects; - public class BrainsweepProcessor implements IComponentProcessor { private BrainsweepRecipe recipe; + @Nullable + private String exampleEntityString; @Override public void setup(IVariableProvider vars) { @@ -49,22 +50,22 @@ public class BrainsweepProcessor implements IComponentProcessor { } case "entity" -> { - if (this.recipe.entityIn() instanceof VillagerIngredient villager) { - var profession = Objects.requireNonNullElse(villager.profession, - new ResourceLocation("toolsmith")); - var biome = Objects.requireNonNullElse(villager.biome, - new ResourceLocation("plains")); - var level = villager.minLevel; - var iHatePatchouli = String.format( - "minecraft:villager{VillagerData:{profession:'%s',type:'%s',level:%d}}", - profession, biome, level); - return IVariable.wrap(iHatePatchouli); - } else if (this.recipe.entityIn() instanceof EntityTypeIngredient entity) { - // TODO - return IVariable.wrap("minecraft:chicken"); - } else { - throw new IllegalStateException(); + if (this.exampleEntityString == null) { + var entity = this.recipe.entityIn().exampleEntity(Minecraft.getInstance().level); + if (entity == null) { + // oh dear + return null; + } + var bob = new StringBuilder(); + bob.append(Registry.ENTITY_TYPE.getKey(entity.getType())); + + var tag = new CompoundTag(); + entity.save(tag); + bob.append(tag.toString()); + this.exampleEntityString = bob.toString(); } + + return IVariable.wrap(this.exampleEntityString); } case "entityTooltip" -> { Minecraft mc = Minecraft.getInstance(); diff --git a/Fabric/src/generated/resources/.cache/03e4de26f1265135874f8cdcaebc09d9c08eb42b b/Fabric/src/generated/resources/.cache/03e4de26f1265135874f8cdcaebc09d9c08eb42b index 209aa213..40812693 100644 --- a/Fabric/src/generated/resources/.cache/03e4de26f1265135874f8cdcaebc09d9c08eb42b +++ b/Fabric/src/generated/resources/.cache/03e4de26f1265135874f8cdcaebc09d9c08eb42b @@ -1,4 +1,4 @@ -// 1.19.2 2022-11-21T19:55:21.969467688 Tags for minecraft:item +// 1.19.2 2022-12-29T13:31:04.089602837 Tags for minecraft:item 5928bad07d3872bb60f29ef4f3c885c8e1967c20 data/hexcasting/tags/items/phial_base.json fdb48f194d7937ab6b423fa4b90a4d438bf6dd90 data/minecraft/tags/items/wooden_doors.json e5df19a1dc6eadf14cd9b0f0fe45a74330b745e9 data/hexcasting/tags/items/edified_planks.json diff --git a/Fabric/src/generated/resources/.cache/67cce32b1c3cbbcb1f646605f4914e3f196986c2 b/Fabric/src/generated/resources/.cache/67cce32b1c3cbbcb1f646605f4914e3f196986c2 index e7aa2ff7..b8815f06 100644 --- a/Fabric/src/generated/resources/.cache/67cce32b1c3cbbcb1f646605f4914e3f196986c2 +++ b/Fabric/src/generated/resources/.cache/67cce32b1c3cbbcb1f646605f4914e3f196986c2 @@ -1,4 +1,4 @@ -// 1.19.2 2022-11-21T19:55:21.965828817 LootTables +// 1.19.2 2022-12-29T13:31:04.07610805 LootTables 01a50f557196c705c275722015cf893e0abe6425 data/hexcasting/loot_tables/inject/scroll_loot_many.json dec1d3592e82f99d9e059d9c771530f103b2bda5 data/hexcasting/loot_tables/blocks/empty_directrix.json 2c42fc5d8c74c98ad15b8bd50f56541fccbef750 data/hexcasting/loot_tables/blocks/edified_tile.json diff --git a/Fabric/src/generated/resources/.cache/75bcd4dba6ca7d365462b0ec45e291d1056349c4 b/Fabric/src/generated/resources/.cache/75bcd4dba6ca7d365462b0ec45e291d1056349c4 index 6dbd1357..ecf16b72 100644 --- a/Fabric/src/generated/resources/.cache/75bcd4dba6ca7d365462b0ec45e291d1056349c4 +++ b/Fabric/src/generated/resources/.cache/75bcd4dba6ca7d365462b0ec45e291d1056349c4 @@ -1,4 +1,4 @@ -// 1.19.2 2022-11-21T19:55:21.971658683 Tags for minecraft:block +// 1.19.2 2022-12-29T13:31:04.07186608 Tags for minecraft:block 20183cd61968ff6548df2dde1100b6378d68d64b data/minecraft/tags/blocks/wooden_buttons.json 357eddf3cee6f16725bed0701d57b2ca3097d74d data/minecraft/tags/blocks/mineable/shovel.json 5216ba5c57db29b8dee9aebc63a2e3b17c97dc17 data/minecraft/tags/blocks/wooden_trapdoors.json diff --git a/Fabric/src/generated/resources/.cache/9fb1092f32d4fcbf9e061ffd718d4ec689c6c95e b/Fabric/src/generated/resources/.cache/9fb1092f32d4fcbf9e061ffd718d4ec689c6c95e index a823071a..9e9a9a14 100644 --- a/Fabric/src/generated/resources/.cache/9fb1092f32d4fcbf9e061ffd718d4ec689c6c95e +++ b/Fabric/src/generated/resources/.cache/9fb1092f32d4fcbf9e061ffd718d4ec689c6c95e @@ -1,4 +1,4 @@ -// 1.19.2 2022-11-21T19:55:21.951767357 Recipes +// 1.19.2 2022-12-29T13:31:04.05733867 Recipes 858dada9c41974f5aa80c66423bf371c9e176a53 data/hexcasting/recipes/pride_colorizer_demigirl.json bb0f91c534c888d1cff8793b49986dce236c7b2d data/hexcasting/advancements/recipes/hexcasting.creative_tab/dye_colorizer_white.json 9f75d3e93ecbbbf3ed9a92b2943397e09dcae1a9 data/hexcasting/recipes/dye_colorizer_light_blue.json @@ -12,7 +12,6 @@ c3f9cca50935f7abf141825d78b441033fc0dab8 data/hexcasting/advancements/recipes/he ef5a19ab2710fd0ce836d767588fe6a54a528a48 data/hexcasting/recipes/dye_colorizer_white.json 768d70365c56ef1fbad089d3e3fd68548f964227 data/hexcasting/recipes/dye_colorizer_black.json dfb42a8b723b37df5c8888bdef86a1be35f2de72 data/hexcasting/recipes/pride_colorizer_bisexual.json -d323e21de69d0606d1fac03fa8820e5857e4e1f1 data/hexcasting/recipes/dynamic/seal_spellbook.json 605f921a98b5dabbd80bc762070916e7d6756df6 data/hexcasting/advancements/recipes/hexcasting.creative_tab/dye_colorizer_orange.json 17aa26ce6bc9941d1477dee99e514fd66be7f664 data/hexcasting/recipes/pride_colorizer_aroace.json 6978ff90efdd067940caccdd29437d2aefd0fe1f data/hexcasting/recipes/scroll_paper.json @@ -36,7 +35,7 @@ be7ceaf2b55525f06178fb09070dfeeef8da1c65 data/hexcasting/advancements/recipes/he 62bfad9dc29406a9807ea33f866cbdfca32e7d0a data/hexcasting/advancements/recipes/hexcasting.creative_tab/amethyst_dust_unpacking.json 4cc110d5ce9831c0072cc2c4fd8f1a6196f42331 data/hexcasting/advancements/recipes/hexcasting.creative_tab/ancient_scroll_paper_lantern.json 1315f615ebc6593829bd86318d8eb45c2de68876 data/hexcasting/advancements/recipes/hexcasting.creative_tab/edified_button.json -3514bb0e92046ca12dfd10afb3c47084434f84c2 data/hexcasting/recipes/brainsweep/akashic_record.json +e0609202271e402d8ae58e4f8eaf11dcdda10a9e data/hexcasting/recipes/brainsweep/akashic_record.json b21f6cbf11e23eac313d68805428cc0da55edb83 data/hexcasting/recipes/compat/farmersdelight/cutting/akashic_log.json 1b210391768fede639b29ae6fc5adf2b8b4e64c6 data/hexcasting/advancements/recipes/hexcasting.creative_tab/dye_colorizer_brown.json ae2c6392cc0ec104c4e3019e1824a1e7f811f1de data/hexcasting/advancements/recipes/hexcasting.creative_tab/abacus.json @@ -55,17 +54,18 @@ ebfa29e0a62a629afbe18681e09cc7be95a3529e data/hexcasting/advancements/recipes/he f8e027860b2505a7217d1264c5d0b6f7feea0679 data/hexcasting/advancements/recipes/hexcasting.creative_tab/edified_door.json 2aa2e5c268ae440238eaf4cea20011b0c8f81a49 data/hexcasting/advancements/recipes/hexcasting.creative_tab/pride_colorizer_demiboy.json 63da3af421dfb38283d750eb3b9761f42e95fb91 data/hexcasting/advancements/recipes/hexcasting.creative_tab/stripped_edified_wood.json -c86adafd19871ba67f0b7b693247c0a5bdec1020 data/hexcasting/recipes/brainsweep/impetus_storedplayer.json +24984d728a5c05967c58be9c0dc1c59e986602e6 data/hexcasting/recipes/brainsweep/impetus_storedplayer.json 326925a948aeb17aabafbc25ed2562a257796d29 data/hexcasting/recipes/dye_colorizer_yellow.json 2a1021614882392be78d22cb557e43cbbd9092ca data/hexcasting/advancements/recipes/brainsweep/brainsweep/impetus_rightclick.json 4440b41499c9c32e297dc184c39da010ff82ac5e data/hexcasting/advancements/recipes/hexcasting.creative_tab/uuid_colorizer.json -63d9172717dd1cbb587fc9d92fd69f47b1bb3307 data/hexcasting/recipes/brainsweep/budding_amethyst.json +5a90084c03d6e8424872870c8b65f4771b447f03 data/hexcasting/recipes/brainsweep/budding_amethyst.json 6e6c73a93e0e06ff399d95e40baf4e06f3a25a0a data/hexcasting/advancements/recipes/hexcasting.creative_tab/slate_block_from_slates.json 3662834d6e0bac03aba28f0f9d9f07f511492118 data/hexcasting/recipes/lens.json 4ba0fcb9b3142029c36cc48b250b89b0cac3f6de data/hexcasting/recipes/akashic_connector.json +eaba34eebb8cb0d8d752ab1d574752e651626c24 data/hexcasting/advancements/recipes/brainsweep/brainsweep/testing/flowey_the_flower.json 1c5681b6bf354ce068c51852b51a5aba9ac2d8f9 data/hexcasting/recipes/compat/create/crushing/amethyst_shard.json 336465276c06fc59be003ccad3d6fc121fa438f5 data/hexcasting/recipes/edified_staff.json -773860888fb2d695b775f3afb93b16f43795bcc6 data/hexcasting/recipes/brainsweep/impetus_rightclick.json +1086a6e3f284fc3b575ee3a21d2b13d0bc62d2bb data/hexcasting/recipes/brainsweep/impetus_rightclick.json ce0cd4d73792c30dcec2eea306bff44b28cb237f data/hexcasting/recipes/pride_colorizer_agender.json f91ab1d68c575970ef48ad499ec92057a8ee7b2e data/hexcasting/recipes/cypher.json a331f4ce9b8d3565cbb154af4d63279f1e2c7a41 data/hexcasting/recipes/compat/farmersdelight/cutting/akashic_trapdoor.json @@ -75,6 +75,7 @@ f75c21d35b926a2303d60115a297c387790bbbd9 data/hexcasting/advancements/recipes/he 3b83dd1c1aa1bcc58e6512bca75c3a6a3b7482b3 data/hexcasting/recipes/edified_tile.json 7ae2bd282afbf2f460a6bb705fe301a2a11d7835 data/hexcasting/advancements/recipes/hexcasting.creative_tab/akashic_connector.json d603560d9bbe0bd3e9c0ca5cd502fe874337599e data/hexcasting/advancements/recipes/hexcasting.creative_tab/dye_colorizer_light_gray.json +0ee8d29cb06065a55017a8fc50576193107f958d data/hexcasting/recipes/dynamicseal_focus.json da3c95902e93fe82e489ceccc84a56159329e091 data/hexcasting/advancements/recipes/brainsweep/brainsweep/impetus_look.json 8c49c1c022cee20fb2a44046425b48cd0e6659af data/hexcasting/advancements/recipes/hexcasting.creative_tab/birch_staff.json 12e1ba1ec29bf0eadf1210d2307fab35e9685085 data/hexcasting/recipes/empty_directrix.json @@ -92,6 +93,7 @@ b494dc17959c76857f25368eb845e58e4f8bca92 data/hexcasting/recipes/compat/farmersd 36c97b8de7a0b67256e8966eca289a865cb85df5 data/hexcasting/advancements/recipes/hexcasting.creative_tab/pride_colorizer_bisexual.json 4bff4a59e32c6d1d99bc3a8abd16cd88c51a8e73 data/hexcasting/recipes/dye_colorizer_orange.json 1f04d75a1c713d3c5ac44e62889ce834f12d6234 data/hexcasting/recipes/jeweler_hammer.json +0de6f2437a3c33a92de2f3e6b7ac6102996c8779 data/hexcasting/advancements/recipes/brainsweep/brainsweep/testing/bad_to_the_bone.json 8a9e7aa8d07556649768729348dff5305b84e1b9 data/hexcasting/recipes/edified_door.json e52dbfc2d86bb3e87ff554fc8d5f0d43b7ff334a data/hexcasting/advancements/recipes/hexcasting.creative_tab/dye_colorizer_gray.json b6d6716724729f0530a524f92d7e4646455de344 data/hexcasting/advancements/recipes/hexcasting.creative_tab/dye_colorizer_red.json @@ -108,9 +110,11 @@ bd3e10b3d468e48e72ad060b9eb0b9f8f4057bf1 data/hexcasting/recipes/ageing_scroll_p 6641b22c79fa29fab15d414afecabd3aa7402b38 data/hexcasting/advancements/recipes/hexcasting.creative_tab/scroll_paper_lantern.json 3ae790bef91b6ae57ed7e3e792740ea059875293 data/hexcasting/advancements/recipes/hexcasting.creative_tab/dye_colorizer_cyan.json c7d28ccf9df6fc46aa142c2e7b176cc0cb5ea62b data/hexcasting/recipes/empty_impetus.json +16c91a664dbe7914a7db566f45158c8191e52afb data/hexcasting/recipes/brainsweep/testing/bad_to_the_bone.json f0a77ba758e649d0c16a8e2d9964d18f95a544f4 data/hexcasting/advancements/recipes/hexcasting.creative_tab/slate.json f9e4d9171ffc6a125d9899f1867398acf8037b27 data/hexcasting/advancements/recipes/hexcasting.creative_tab/pride_colorizer_agender.json c93cecd3f883e57f3cce7ad3d6aad44000ed541c data/hexcasting/recipes/ancient_scroll_paper.json +ba08fd11d19f54c504ceed6f162a5d814e03d1e8 data/hexcasting/recipes/brainsweep/testing/flowey_the_flower.json 12d9ec588869179a8e8a1f4bce718175d57e4a71 data/create/recipes/crushing/amethyst_block.json ab26481b45a7f463e2225b9a04d24a1b4d84daef data/hexcasting/recipes/abacus.json fccc3e05b011e1fd1a41a0bfca11876d0fb16df2 data/hexcasting/advancements/recipes/hexcasting.creative_tab/scroll_small.json @@ -124,6 +128,7 @@ e687ceab424098d586f0b67a34fe65bee1f4dfca data/hexcasting/advancements/recipes/he 202e70722198141d5dd961bb087a25873e4928af data/hexcasting/recipes/edified_stairs.json 6e692bdb7e797c1d0fffb5fcc90c5a3b28e4aaff data/hexcasting/advancements/recipes/hexcasting.creative_tab/pride_colorizer_aromantic.json b640608755649a8bde55a434016b14522fa6d2e0 data/hexcasting/advancements/recipes/hexcasting.creative_tab/edified_wood.json +d323e21de69d0606d1fac03fa8820e5857e4e1f1 data/hexcasting/recipes/dynamicseal_spellbook.json e0e49c8a9977fe2b0619179b11a4379b5b19ace9 data/hexcasting/advancements/recipes/hexcasting.creative_tab/sub_sandwich.json b2dc08cc62b9a36d6b034aead99e0b328b5efecb data/hexcasting/recipes/scroll_small.json e3416c3e103fe206cbaa352eb5011f81ccfc6aca data/hexcasting/recipes/slate.json @@ -140,7 +145,7 @@ b7d75dcd88e5091ff44eec236531a56e82c7bd91 data/hexcasting/advancements/recipes/he 13ca24f9f87a6b34f7717e5c326291079e6db96f data/hexcasting/recipes/sub_sandwich.json 90088535c8e4d0beb0725878314c49ac8deb373b data/hexcasting/recipes/amethyst_dust_packing.json 220f4dc7c8f857092bcb85b5ccf8936237ededa4 data/hexcasting/advancements/recipes/hexcasting.creative_tab/amethyst_sconce.json -ae676c825f58eefb2bfbbd866db13dbb59deff0e data/hexcasting/recipes/brainsweep/impetus_look.json +7a51e934846a0d7fe00a808cfa22fd85da67fe9d data/hexcasting/recipes/brainsweep/impetus_look.json f0849d723141b9f02798d474da6594f78755dd51 data/hexcasting/recipes/amethyst_tiles.json a184ee70962538e4f8641c707d6dca8796ca36e7 data/hexcasting/recipes/edified_slab.json b7250840982952fc23c8b32b77517744329d8d2d data/hexcasting/recipes/spellbook.json @@ -155,7 +160,6 @@ b7250840982952fc23c8b32b77517744329d8d2d data/hexcasting/recipes/spellbook.json d7f93550b7c25b963eaf34d4d2ab9d9871830983 data/hexcasting/recipes/dye_colorizer_cyan.json 9c8503715195c4cb2e2d9a1abe4f94df7bb9f4b5 data/hexcasting/advancements/recipes/hexcasting.creative_tab/stonecutting/amethyst_tiles.json e91b58b8a52d0d69e13102fbf743aab8be177924 data/hexcasting/recipes/pride_colorizer_genderfluid.json -0ee8d29cb06065a55017a8fc50576193107f958d data/hexcasting/recipes/dynamic/seal_focus.json b7fc41f8cfd83a0d138290251d63bb6cc04e0f9a data/hexcasting/recipes/edified_pressure_plate.json 122ca20f3a77c1267e4b8c755e9cd66e56734547 data/hexcasting/advancements/recipes/hexcasting.creative_tab/pride_colorizer_genderqueer.json 3c552071e6b3cfd4932b8f1e8d8b91aae8ead99d data/hexcasting/advancements/recipes/hexcasting.creative_tab/dark_oak_staff.json @@ -166,7 +170,7 @@ a22233090497e1c44082b6eb16ad079d9acc8f7c data/hexcasting/advancements/recipes/br aa4a00864f1b22835612fe60a4715250f3ab2126 data/hexcasting/advancements/recipes/hexcasting.creative_tab/edified_panel.json 6f5ee50706640e9be82810e22388fc7b2bce13b1 data/hexcasting/recipes/birch_staff.json e35c89ccc099c511c9ab321a7490d35f2e8c9353 data/hexcasting/advancements/recipes/hexcasting.creative_tab/amethyst_dust_packing.json -9bd09d681a608e465feb6d6a63d0b021920c7a1d data/hexcasting/recipes/brainsweep/directrix_redstone.json +3127e275f4dc31d80a21f9119fcebc527e821caa data/hexcasting/recipes/brainsweep/directrix_redstone.json 735a7d770f23a02dc4ae93644e7f4c44a32e313a data/hexcasting/recipes/oak_staff.json d75bc1009064769735d46e7f4f32c65d10a470e3 data/hexcasting/recipes/pride_colorizer_asexual.json 36c3ea4547b49c7553e7024192d5ddf6f2163422 data/hexcasting/recipes/scroll_paper_lantern.json diff --git a/Fabric/src/generated/resources/data/hexcasting/advancements/recipes/brainsweep/brainsweep/testing/bad_to_the_bone.json b/Fabric/src/generated/resources/data/hexcasting/advancements/recipes/brainsweep/brainsweep/testing/bad_to_the_bone.json new file mode 100644 index 00000000..edd1db8e --- /dev/null +++ b/Fabric/src/generated/resources/data/hexcasting/advancements/recipes/brainsweep/brainsweep/testing/bad_to_the_bone.json @@ -0,0 +1,34 @@ +{ + "parent": "minecraft:recipes/root", + "criteria": { + "enlightenment": { + "conditions": { + "health_used": { + "min": 0.8 + }, + "mojang_i_am_begging_and_crying_please_add_an_entity_health_criterion": { + "max": 2.05, + "min": 0.1 + } + }, + "trigger": "hexcasting:overcast" + }, + "has_the_recipe": { + "conditions": { + "recipe": "hexcasting:brainsweep/testing/bad_to_the_bone" + }, + "trigger": "minecraft:recipe_unlocked" + } + }, + "requirements": [ + [ + "enlightenment", + "has_the_recipe" + ] + ], + "rewards": { + "recipes": [ + "hexcasting:brainsweep/testing/bad_to_the_bone" + ] + } +} \ No newline at end of file diff --git a/Fabric/src/generated/resources/data/hexcasting/advancements/recipes/brainsweep/brainsweep/testing/flowey_the_flower.json b/Fabric/src/generated/resources/data/hexcasting/advancements/recipes/brainsweep/brainsweep/testing/flowey_the_flower.json new file mode 100644 index 00000000..7b01dd50 --- /dev/null +++ b/Fabric/src/generated/resources/data/hexcasting/advancements/recipes/brainsweep/brainsweep/testing/flowey_the_flower.json @@ -0,0 +1,34 @@ +{ + "parent": "minecraft:recipes/root", + "criteria": { + "enlightenment": { + "conditions": { + "health_used": { + "min": 0.8 + }, + "mojang_i_am_begging_and_crying_please_add_an_entity_health_criterion": { + "max": 2.05, + "min": 0.1 + } + }, + "trigger": "hexcasting:overcast" + }, + "has_the_recipe": { + "conditions": { + "recipe": "hexcasting:brainsweep/testing/flowey_the_flower" + }, + "trigger": "minecraft:recipe_unlocked" + } + }, + "requirements": [ + [ + "enlightenment", + "has_the_recipe" + ] + ], + "rewards": { + "recipes": [ + "hexcasting:brainsweep/testing/flowey_the_flower" + ] + } +} \ No newline at end of file diff --git a/Fabric/src/generated/resources/data/hexcasting/recipes/brainsweep/akashic_record.json b/Fabric/src/generated/resources/data/hexcasting/recipes/brainsweep/akashic_record.json index 65f772c8..6ff75581 100644 --- a/Fabric/src/generated/resources/data/hexcasting/recipes/brainsweep/akashic_record.json +++ b/Fabric/src/generated/resources/data/hexcasting/recipes/brainsweep/akashic_record.json @@ -4,11 +4,13 @@ "type": "block", "block": "hexcasting:akashic_connector" }, + "cost": 1000000, + "entityIn": { + "type": "villager", + "minLevel": 5, + "profession": "librarian" + }, "result": { "name": "hexcasting:akashic_record" - }, - "villagerIn": { - "minLevel": 5, - "profession": "minecraft:librarian" } } \ No newline at end of file diff --git a/Fabric/src/generated/resources/data/hexcasting/recipes/brainsweep/budding_amethyst.json b/Fabric/src/generated/resources/data/hexcasting/recipes/brainsweep/budding_amethyst.json index 0d7b8aeb..b58a6ec9 100644 --- a/Fabric/src/generated/resources/data/hexcasting/recipes/brainsweep/budding_amethyst.json +++ b/Fabric/src/generated/resources/data/hexcasting/recipes/brainsweep/budding_amethyst.json @@ -4,10 +4,12 @@ "type": "block", "block": "minecraft:amethyst_block" }, + "cost": 1000000, + "entityIn": { + "type": "villager", + "minLevel": 3 + }, "result": { "name": "minecraft:budding_amethyst" - }, - "villagerIn": { - "minLevel": 3 } } \ No newline at end of file diff --git a/Fabric/src/generated/resources/data/hexcasting/recipes/brainsweep/directrix_redstone.json b/Fabric/src/generated/resources/data/hexcasting/recipes/brainsweep/directrix_redstone.json index cd6f95c3..614ea5a6 100644 --- a/Fabric/src/generated/resources/data/hexcasting/recipes/brainsweep/directrix_redstone.json +++ b/Fabric/src/generated/resources/data/hexcasting/recipes/brainsweep/directrix_redstone.json @@ -4,6 +4,12 @@ "type": "block", "block": "hexcasting:empty_directrix" }, + "cost": 1000000, + "entityIn": { + "type": "villager", + "minLevel": 1, + "profession": "mason" + }, "result": { "name": "hexcasting:directrix_redstone", "properties": { @@ -11,9 +17,5 @@ "facing": "north", "powered": "false" } - }, - "villagerIn": { - "minLevel": 1, - "profession": "minecraft:mason" } } \ No newline at end of file diff --git a/Fabric/src/generated/resources/data/hexcasting/recipes/brainsweep/impetus_look.json b/Fabric/src/generated/resources/data/hexcasting/recipes/brainsweep/impetus_look.json index 1eaa96b3..882d44e4 100644 --- a/Fabric/src/generated/resources/data/hexcasting/recipes/brainsweep/impetus_look.json +++ b/Fabric/src/generated/resources/data/hexcasting/recipes/brainsweep/impetus_look.json @@ -4,15 +4,17 @@ "type": "block", "block": "hexcasting:empty_impetus" }, + "cost": 1000000, + "entityIn": { + "type": "villager", + "minLevel": 2, + "profession": "toolsmith" + }, "result": { "name": "hexcasting:impetus_look", "properties": { "energized": "false", "facing": "north" } - }, - "villagerIn": { - "minLevel": 2, - "profession": "minecraft:fletcher" } } \ No newline at end of file diff --git a/Fabric/src/generated/resources/data/hexcasting/recipes/brainsweep/impetus_rightclick.json b/Fabric/src/generated/resources/data/hexcasting/recipes/brainsweep/impetus_rightclick.json index a92539c0..36366977 100644 --- a/Fabric/src/generated/resources/data/hexcasting/recipes/brainsweep/impetus_rightclick.json +++ b/Fabric/src/generated/resources/data/hexcasting/recipes/brainsweep/impetus_rightclick.json @@ -4,15 +4,17 @@ "type": "block", "block": "hexcasting:empty_impetus" }, + "cost": 1000000, + "entityIn": { + "type": "villager", + "minLevel": 2, + "profession": "toolsmith" + }, "result": { "name": "hexcasting:impetus_rightclick", "properties": { "energized": "false", "facing": "north" } - }, - "villagerIn": { - "minLevel": 2, - "profession": "minecraft:toolsmith" } } \ No newline at end of file diff --git a/Fabric/src/generated/resources/data/hexcasting/recipes/brainsweep/impetus_storedplayer.json b/Fabric/src/generated/resources/data/hexcasting/recipes/brainsweep/impetus_storedplayer.json index ea63f87c..8529689e 100644 --- a/Fabric/src/generated/resources/data/hexcasting/recipes/brainsweep/impetus_storedplayer.json +++ b/Fabric/src/generated/resources/data/hexcasting/recipes/brainsweep/impetus_storedplayer.json @@ -4,6 +4,12 @@ "type": "block", "block": "hexcasting:empty_impetus" }, + "cost": 1000000, + "entityIn": { + "type": "villager", + "minLevel": 2, + "profession": "cleric" + }, "result": { "name": "hexcasting:impetus_storedplayer", "properties": { @@ -11,9 +17,5 @@ "facing": "north", "powered": "true" } - }, - "villagerIn": { - "minLevel": 2, - "profession": "minecraft:cleric" } } \ No newline at end of file diff --git a/Fabric/src/generated/resources/data/hexcasting/recipes/brainsweep/testing/bad_to_the_bone.json b/Fabric/src/generated/resources/data/hexcasting/recipes/brainsweep/testing/bad_to_the_bone.json new file mode 100644 index 00000000..19eb1018 --- /dev/null +++ b/Fabric/src/generated/resources/data/hexcasting/recipes/brainsweep/testing/bad_to_the_bone.json @@ -0,0 +1,18 @@ +{ + "type": "hexcasting:brainsweep", + "blockIn": { + "type": "block", + "block": "minecraft:scaffolding" + }, + "cost": 50000, + "entityIn": { + "type": "entity_tag", + "tag": "minecraft:skeletons" + }, + "result": { + "name": "minecraft:bone_block", + "properties": { + "axis": "y" + } + } +} \ No newline at end of file diff --git a/Fabric/src/generated/resources/data/hexcasting/recipes/brainsweep/testing/flowey_the_flower.json b/Fabric/src/generated/resources/data/hexcasting/recipes/brainsweep/testing/flowey_the_flower.json new file mode 100644 index 00000000..23d5177f --- /dev/null +++ b/Fabric/src/generated/resources/data/hexcasting/recipes/brainsweep/testing/flowey_the_flower.json @@ -0,0 +1,19 @@ +{ + "type": "hexcasting:brainsweep", + "blockIn": { + "type": "tag", + "tag": "minecraft:small_flowers" + }, + "cost": 50000, + "entityIn": { + "type": "entity_type", + "entityType": "minecraft:allay" + }, + "result": { + "name": "minecraft:amethyst_cluster", + "properties": { + "facing": "up", + "waterlogged": "false" + } + } +} \ No newline at end of file diff --git a/Fabric/src/generated/resources/data/hexcasting/recipes/dynamic/seal_focus.json b/Fabric/src/generated/resources/data/hexcasting/recipes/dynamicseal_focus.json similarity index 100% rename from Fabric/src/generated/resources/data/hexcasting/recipes/dynamic/seal_focus.json rename to Fabric/src/generated/resources/data/hexcasting/recipes/dynamicseal_focus.json diff --git a/Fabric/src/generated/resources/data/hexcasting/recipes/dynamic/seal_spellbook.json b/Fabric/src/generated/resources/data/hexcasting/recipes/dynamicseal_spellbook.json similarity index 100% rename from Fabric/src/generated/resources/data/hexcasting/recipes/dynamic/seal_spellbook.json rename to Fabric/src/generated/resources/data/hexcasting/recipes/dynamicseal_spellbook.json diff --git a/Fabric/src/main/java/at/petrak/hexcasting/fabric/interop/emi/BrainsweepeeEmiStack.java b/Fabric/src/main/java/at/petrak/hexcasting/fabric/interop/emi/BrainsweepeeEmiStack.java index 1580204a..bd72ece1 100644 --- a/Fabric/src/main/java/at/petrak/hexcasting/fabric/interop/emi/BrainsweepeeEmiStack.java +++ b/Fabric/src/main/java/at/petrak/hexcasting/fabric/interop/emi/BrainsweepeeEmiStack.java @@ -2,103 +2,45 @@ package at.petrak.hexcasting.fabric.interop.emi; import at.petrak.hexcasting.client.ClientTickCounter; import at.petrak.hexcasting.client.RenderLib; -import at.petrak.hexcasting.client.shader.FakeBufferSource; -import at.petrak.hexcasting.client.shader.HexRenderTypes; import at.petrak.hexcasting.common.recipe.ingredient.brainsweep.BrainsweepeeIngredient; import com.mojang.blaze3d.systems.RenderSystem; import com.mojang.blaze3d.vertex.PoseStack; -import dev.emi.emi.api.render.EmiRender; -import dev.emi.emi.api.render.EmiTooltipComponents; -import dev.emi.emi.api.stack.EmiIngredient; import dev.emi.emi.api.stack.EmiStack; -import net.minecraft.ChatFormatting; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.screens.inventory.tooltip.ClientTooltipComponent; import net.minecraft.client.multiplayer.ClientLevel; -import net.minecraft.core.Registry; import net.minecraft.nbt.CompoundTag; import net.minecraft.network.chat.Component; import net.minecraft.resources.ResourceLocation; -import net.minecraft.world.entity.EntityType; import net.minecraft.world.entity.npc.Villager; -import net.minecraft.world.entity.npc.VillagerProfession; -import net.minecraft.world.level.block.state.BlockState; -import java.util.ArrayList; import java.util.List; -import java.util.Objects; -import java.util.Set; import java.util.stream.Collectors; import static at.petrak.hexcasting.api.HexAPI.modLoc; import static at.petrak.hexcasting.client.RenderLib.renderEntity; public class BrainsweepeeEmiStack extends EmiStack { - private final VillagerEntry entry; public final BrainsweepeeIngredient ingredient; - public final boolean mindless; - private final ResourceLocation id; + private final BrainsweepeeEntry entry; - public BrainsweepeeEmiStack(BrainsweepeeIngredient villager) { - this(villager, false); - } + public BrainsweepeeEmiStack(BrainsweepeeIngredient ingr) { + this.ingredient = ingr; - public BrainsweepeeEmiStack(BrainsweepeeIngredient villager, boolean mindless) { - this(villager, mindless, 1); - } - - public BrainsweepeeEmiStack(BrainsweepeeIngredient villager, boolean mindless, long amount) { - entry = new VillagerEntry(new VillagerVariant(villager, mindless)); - this.ingredient = villager; - this.mindless = mindless; - this.amount = amount; - // This is so scuffed - this.id = modLoc((Objects.toString(villager.profession()) + villager.minLevel() + mindless) - .replace(':', '-')); - } - - public static Set matchingStatesForProfession(VillagerProfession profession) { - return Registry.POINT_OF_INTEREST_TYPE.holders() - .filter(profession.heldJobSite()) - .flatMap(it -> it.value().matchingStates().stream()) - .collect(Collectors.toSet()); - } - - public static EmiIngredient atLevelOrHigher(BrainsweepeeIngredient ingredient, boolean remainder) { - if (ingredient.profession() == null) { - return EmiIngredient.of(Registry.VILLAGER_PROFESSION.stream() - .filter(it -> matchingStatesForProfession(it).isEmpty()) - .map(it -> atLevelOrHigher(new BrainsweepeeIngredient(Registry.VILLAGER_PROFESSION.getKey(it), - ingredient.biome(), ingredient.minLevel()), true)) - .toList()); - } - - BrainsweepeeEmiStack stack = new BrainsweepeeEmiStack(ingredient).orHigher(true); - if (remainder) { - stack.setRemainder(new BrainsweepeeEmiStack(ingredient, true)); - } - return stack; - } - - private boolean orHigher = false; - - public BrainsweepeeEmiStack orHigher(boolean orHigher) { - this.orHigher = orHigher; - return this; + var bareId = this.ingredient.getSomeKindOfReasonableIDForEmi(); + this.id = modLoc(bareId); + this.entry = new BrainsweepeeEntry(this.ingredient); } @Override public EmiStack copy() { - BrainsweepeeEmiStack e = new BrainsweepeeEmiStack(ingredient, mindless, amount); - e.orHigher(orHigher).setRemainder(getRemainder().copy()); - e.comparison = comparison; - return e; + return new BrainsweepeeEmiStack(this.ingredient); } @Override public boolean isEmpty() { - return amount == 0; + return false; } @Override @@ -126,42 +68,20 @@ public class BrainsweepeeEmiStack extends EmiStack { Minecraft mc = Minecraft.getInstance(); boolean advanced = mc.options.advancedItemTooltips; - if (mindless) { - List tooltip = new ArrayList<>(); - tooltip.add(Component.translatable("hexcasting.tooltip.brainsweep.product")); - - if (advanced) { - if (ingredient.biome() != null) { - tooltip.add(Component.literal(ingredient.biome().toString()).withStyle(ChatFormatting.DARK_GRAY)); - } - - ResourceLocation displayId = Objects.requireNonNullElseGet(ingredient.profession(), - () -> Registry.ENTITY_TYPE.getKey(EntityType.VILLAGER)); - tooltip.add(Component.literal(displayId.toString()).withStyle(ChatFormatting.DARK_GRAY)); - } - - tooltip.add(ingredient.getModNameComponent()); - return tooltip; - } - - return ingredient.getTooltip(advanced, orHigher); + return ingredient.getTooltip(advanced); } @Override public List getTooltip() { - List list = getTooltipText().stream() + return getTooltipText().stream() .map(Component::getVisualOrderText) .map(ClientTooltipComponent::create) .collect(Collectors.toList()); - if (!getRemainder().isEmpty()) { - list.add(EmiTooltipComponents.getRemainderTooltipComponent(this)); - } - return list; } @Override public Component getName() { - return ingredient.name(); + return ingredient.getName(); } @Override @@ -174,51 +94,29 @@ public class BrainsweepeeEmiStack extends EmiStack { RenderSystem.enableBlend(); RenderSystem.setShaderColor(1.0F, 1.0F, 1.0F, 1.0F); - renderEntity(poseStack, villager, level, x + 8, y + 16, ClientTickCounter.getTotal(), 8, 0, - mindless ? (it) -> new FakeBufferSource(it, HexRenderTypes::getGrayscaleLayer) : it -> it); + renderEntity(poseStack, villager, level, x + 8, y + 16, ClientTickCounter.getTotal(), 8, 0, it -> it); } } - - if ((flags & RENDER_REMAINDER) != 0) { - EmiRender.renderRemainderIcon(this, poseStack, x, y); - } +// if ((flags & RENDER_REMAINDER) != 0) { +// EmiRender.renderRemainderIcon(this, poseStack, x, y); +// } } - public static class VillagerEntry extends EmiStack.Entry { + public static class BrainsweepeeEntry extends EmiStack.Entry { - public VillagerEntry(VillagerVariant variant) { + public BrainsweepeeEntry(BrainsweepeeIngredient variant) { super(variant); } @Override - public Class getType() { - return VillagerVariant.class; + public Class getType() { + return BrainsweepeeIngredient.class; } @Override public boolean equals(Object obj) { - if (!(obj instanceof VillagerEntry e)) { - return false; - } - - VillagerVariant self = getValue(); - VillagerVariant other = e.getValue(); - - ResourceLocation selfBiome = self.ingredient().biome(); - ResourceLocation otherBiome = other.ingredient().biome(); - if (selfBiome != null && otherBiome != null && !selfBiome.equals(otherBiome)) { - return false; - } - - ResourceLocation selfProfession = self.ingredient().profession(); - ResourceLocation otherProfession = other.ingredient().profession(); - if (selfProfession != null && otherProfession != null && !selfProfession.equals(otherProfession)) { - return false; - } - - return self.ingredient().minLevel() == other.ingredient().minLevel() && self.mindless() == other.mindless(); + return obj instanceof BrainsweepeeIngredient bi && bi.equals(this.getValue()); } } - } diff --git a/Fabric/src/main/java/at/petrak/hexcasting/fabric/interop/emi/EmiLevelupRecipe.java b/Fabric/src/main/java/at/petrak/hexcasting/fabric/interop/emi/EmiLevelupRecipe.java deleted file mode 100644 index 0f9a6ba3..00000000 --- a/Fabric/src/main/java/at/petrak/hexcasting/fabric/interop/emi/EmiLevelupRecipe.java +++ /dev/null @@ -1,25 +0,0 @@ -package at.petrak.hexcasting.fabric.interop.emi; - -import dev.emi.emi.api.recipe.EmiRecipeCategory; -import dev.emi.emi.api.stack.EmiIngredient; -import dev.emi.emi.api.stack.EmiStack; -import net.minecraft.resources.ResourceLocation; -import net.minecraft.world.item.Items; - -import java.util.List; - -public class EmiLevelupRecipe extends EmiVillagerRecipe { - public EmiLevelupRecipe(EmiIngredient input, BrainsweepeeEmiStack result, ResourceLocation id) { - super(input, EmiStack.of(Items.EMERALD), result, id, false); - } - - @Override - public List getInputs() { - return List.of(input); - } - - @Override - public EmiRecipeCategory getCategory() { - return HexEMIPlugin.VILLAGER_LEVELING; - } -} diff --git a/Fabric/src/main/java/at/petrak/hexcasting/fabric/interop/emi/EmiProfessionRecipe.java b/Fabric/src/main/java/at/petrak/hexcasting/fabric/interop/emi/EmiProfessionRecipe.java deleted file mode 100644 index eefd23fc..00000000 --- a/Fabric/src/main/java/at/petrak/hexcasting/fabric/interop/emi/EmiProfessionRecipe.java +++ /dev/null @@ -1,17 +0,0 @@ -package at.petrak.hexcasting.fabric.interop.emi; - -import dev.emi.emi.api.recipe.EmiRecipeCategory; -import dev.emi.emi.api.stack.EmiIngredient; -import net.minecraft.resources.ResourceLocation; - -public class EmiProfessionRecipe extends EmiVillagerRecipe { - public EmiProfessionRecipe(EmiIngredient input, EmiIngredient catalyst, BrainsweepeeEmiStack result, - ResourceLocation id) { - super(input, catalyst, result, id); - } - - @Override - public EmiRecipeCategory getCategory() { - return HexEMIPlugin.VILLAGER_PROFESSION; - } -} diff --git a/Fabric/src/main/java/at/petrak/hexcasting/fabric/interop/emi/EmiVillagerRecipe.java b/Fabric/src/main/java/at/petrak/hexcasting/fabric/interop/emi/EmiVillagerRecipe.java deleted file mode 100644 index 1b25673c..00000000 --- a/Fabric/src/main/java/at/petrak/hexcasting/fabric/interop/emi/EmiVillagerRecipe.java +++ /dev/null @@ -1,73 +0,0 @@ -package at.petrak.hexcasting.fabric.interop.emi; - -import dev.emi.emi.api.recipe.EmiRecipe; -import dev.emi.emi.api.render.EmiTexture; -import dev.emi.emi.api.stack.EmiIngredient; -import dev.emi.emi.api.stack.EmiStack; -import dev.emi.emi.api.widget.WidgetHolder; -import net.minecraft.resources.ResourceLocation; -import org.jetbrains.annotations.Nullable; - -import java.util.List; - -// Mostly copypasta from EmiWorldRecipe, to avoid depending on impl -public abstract class EmiVillagerRecipe implements EmiRecipe { - protected final boolean isCatalyst; - protected final ResourceLocation id; - protected final EmiIngredient input; - protected final EmiIngredient catalyst; - protected final EmiStack result; - - public EmiVillagerRecipe(EmiIngredient input, EmiIngredient catalyst, BrainsweepeeEmiStack result, - ResourceLocation id) { - this(input, catalyst, result, id, true); - } - - public EmiVillagerRecipe(EmiIngredient input, EmiIngredient catalyst, BrainsweepeeEmiStack result, - ResourceLocation id, boolean isCatalyst) { - this.isCatalyst = isCatalyst; - this.input = input; - this.catalyst = catalyst; - this.result = result; - this.id = id; - if (isCatalyst) { - for (EmiStack stack : catalyst.getEmiStacks()) { - stack.setRemainder(stack); - } - } - - } - - @Nullable - public ResourceLocation getId() { - return this.id; - } - - public List getInputs() { - return this.isCatalyst ? List.of(this.input) : List.of(this.input, this.catalyst); - } - - public List getCatalysts() { - return this.isCatalyst ? List.of(this.catalyst) : List.of(); - } - - public List getOutputs() { - return List.of(this.result); - } - - public int getDisplayWidth() { - return 125; - } - - public int getDisplayHeight() { - return 18; - } - - public void addWidgets(WidgetHolder widgets) { - widgets.addTexture(EmiTexture.PLUS, 27, 3); - widgets.addTexture(EmiTexture.EMPTY_ARROW, 75, 1); - widgets.addSlot(this.input, 0, 0); - widgets.addSlot(this.catalyst, 49, 0).catalyst(this.isCatalyst); - widgets.addSlot(this.result, 107, 0).recipeContext(this); - } -} diff --git a/Fabric/src/main/java/at/petrak/hexcasting/fabric/interop/emi/HexEMIPlugin.java b/Fabric/src/main/java/at/petrak/hexcasting/fabric/interop/emi/HexEMIPlugin.java index 8942c247..3c10fb9d 100644 --- a/Fabric/src/main/java/at/petrak/hexcasting/fabric/interop/emi/HexEMIPlugin.java +++ b/Fabric/src/main/java/at/petrak/hexcasting/fabric/interop/emi/HexEMIPlugin.java @@ -15,97 +15,48 @@ import net.minecraft.resources.ResourceLocation; import static at.petrak.hexcasting.api.HexAPI.modLoc; public class HexEMIPlugin implements EmiPlugin { - private static final ResourceLocation BRAINSWEEP_ID = modLoc("brainsweep"); - public static final ResourceLocation PHIAL_ID = modLoc("craft/battery"); - public static final ResourceLocation EDIFY_ID = modLoc("edify"); - private static final ResourceLocation VILLAGER_LEVELING_ID = modLoc("villager_leveling"); - private static final ResourceLocation VILLAGER_PROFESSION_ID = modLoc("villager_profession"); + private static final ResourceLocation BRAINSWEEP_ID = modLoc("brainsweep"); + public static final ResourceLocation PHIAL_ID = modLoc("craft/battery"); + public static final ResourceLocation EDIFY_ID = modLoc("edify"); - private static final ResourceLocation SIMPLIFIED_ICON_BRAINSWEEP = modLoc("textures/gui/brainsweep_emi.png"); - private static final ResourceLocation SIMPLIFIED_ICON_PHIAL = modLoc("textures/gui/phial_emi.png"); - private static final ResourceLocation SIMPLIFIED_ICON_EDIFY = modLoc("textures/gui/edify_emi.png"); - private static final ResourceLocation SIMPLIFIED_ICON_LEVELING = modLoc("textures/gui/villager_leveling.png"); - private static final ResourceLocation SIMPLIFIED_ICON_PROFESSION = modLoc("textures/gui/villager_profession.png"); + private static final ResourceLocation SIMPLIFIED_ICON_BRAINSWEEP = modLoc("textures/gui/brainsweep_emi.png"); + private static final ResourceLocation SIMPLIFIED_ICON_PHIAL = modLoc("textures/gui/phial_emi.png"); + private static final ResourceLocation SIMPLIFIED_ICON_EDIFY = modLoc("textures/gui/edify_emi.png"); - public static final EmiRecipeCategory BRAINSWEEP = new EmiRecipeCategory(BRAINSWEEP_ID, - new PatternRendererEMI(BRAINSWEEP_ID, 16, 16), - new EmiTexture(SIMPLIFIED_ICON_BRAINSWEEP, 0, 0, 16, 16, 16, 16, 16, 16)); + public static final EmiRecipeCategory BRAINSWEEP = new EmiRecipeCategory(BRAINSWEEP_ID, + new PatternRendererEMI(BRAINSWEEP_ID, 16, 16), + new EmiTexture(SIMPLIFIED_ICON_BRAINSWEEP, 0, 0, 16, 16, 16, 16, 16, 16)); - public static final EmiRecipeCategory PHIAL = new EmiRecipeCategory(PHIAL_ID, - new PatternRendererEMI(PHIAL_ID, 12, 12).shift(2, 2), - new EmiTexture(SIMPLIFIED_ICON_PHIAL, 0, 0, 16, 16, 16, 16, 16, 16)); + public static final EmiRecipeCategory PHIAL = new EmiRecipeCategory(PHIAL_ID, + new PatternRendererEMI(PHIAL_ID, 12, 12).shift(2, 2), + new EmiTexture(SIMPLIFIED_ICON_PHIAL, 0, 0, 16, 16, 16, 16, 16, 16)); - public static final EmiRecipeCategory EDIFY = new EmiRecipeCategory(EDIFY_ID, - new PatternRendererEMI(EDIFY_ID, 16, 16).strokeOrder(false), - new EmiTexture(SIMPLIFIED_ICON_EDIFY, 0, 0, 16, 16, 16, 16, 16, 16)); + public static final EmiRecipeCategory EDIFY = new EmiRecipeCategory(EDIFY_ID, + new PatternRendererEMI(EDIFY_ID, 16, 16).strokeOrder(false), + new EmiTexture(SIMPLIFIED_ICON_EDIFY, 0, 0, 16, 16, 16, 16, 16, 16)); -// public static final EmiRecipeCategory VILLAGER_LEVELING = new EmiRecipeCategory(VILLAGER_LEVELING_ID, -// EmiStack.of(Items.EMERALD), -// new EmiTexture(SIMPLIFIED_ICON_LEVELING, 0, 0, 16, 16, 16, 16, 16, 16)); -// -// public static final EmiRecipeCategory VILLAGER_PROFESSION = new EmiRecipeCategory(VILLAGER_PROFESSION_ID, -// EmiStack.of(Blocks.LECTERN), -// new EmiTexture(SIMPLIFIED_ICON_PROFESSION, 0, 0, 16, 16, 16, 16, 16, 16)); + @Override + public void register(EmiRegistry registry) { + registry.addCategory(BRAINSWEEP); + registry.addCategory(PHIAL); + registry.addCategory(EDIFY); + registry.addWorkstation(BRAINSWEEP, EmiIngredient.of(HexTags.Items.STAVES)); + registry.addWorkstation(PHIAL, EmiIngredient.of(HexTags.Items.STAVES)); + registry.addWorkstation(EDIFY, EmiIngredient.of(HexTags.Items.STAVES)); - @Override - public void register(EmiRegistry registry) { - registry.addCategory(BRAINSWEEP); - registry.addCategory(PHIAL); - registry.addCategory(EDIFY); -// registry.addCategory(VILLAGER_LEVELING); -// registry.addCategory(VILLAGER_PROFESSION); - registry.addWorkstation(BRAINSWEEP, EmiIngredient.of(HexItemTags.STAVES)); - registry.addWorkstation(PHIAL, EmiIngredient.of(HexItemTags.STAVES)); - registry.addWorkstation(EDIFY, EmiIngredient.of(HexItemTags.STAVES)); + for (BrainsweepRecipe recipe : registry.getRecipeManager() + .getAllRecipesFor(HexRecipeStuffRegistry.BRAINSWEEP_TYPE)) { + var inputBlocks = EmiIngredient.of(recipe.blockIn().getDisplayedStacks().stream() + .map(EmiStack::of).toList()); + var inputEntity = new BrainsweepeeEmiStack(recipe.entityIn()); + var output = EmiStack.of(recipe.result().getBlock()); + registry.addRecipe(new EmiBrainsweepRecipe(inputBlocks, inputEntity, output, recipe.getId())); + } - for (BrainsweepRecipe recipe : registry.getRecipeManager() - .getAllRecipesFor(HexRecipeStuffRegistry.BRAINSWEEP_TYPE)) { - var inputs = EmiIngredient.of(recipe.blockIn().getDisplayedStacks().stream() - .map(EmiStack::of).toList()); - var output = EmiStack.of(recipe.result().getBlock()); - registry.addRecipe(new EmiBrainsweepRecipe(inputs, villagerInput, output, recipe.getId())); - } + if (PhialRecipeStackBuilder.shouldAddRecipe()) { + registry.addRecipe(new EmiPhialRecipe()); + } - if (PhialRecipeStackBuilder.shouldAddRecipe()) { - registry.addRecipe(new EmiPhialRecipe()); - } - - registry.addRecipe(new EmiEdifyRecipe()); - -// var basicVillager = new BrainsweepIngredient(null, null, 1); -// for (VillagerProfession profession : Registry.VILLAGER_PROFESSION) { -// ResourceLocation id = Registry.VILLAGER_PROFESSION.getKey(profession); -// ResourceLocation poiRecipeId = modLoc("villager/poi/" + id.getNamespace() + "/" + id.getPath()); -// var manWithJob = new BrainsweepIngredient(id, null, 1); -// -// Set states = BrainsweepeeEmiStack.matchingStatesForProfession(profession); -// if (!states.isEmpty()) { -// List workstations = states.stream() -// .map(BlockState::getBlock) -// .map(Block::asItem) -// .distinct() -// .filter((it) -> it != Items.AIR) -// .toList(); -// -// if (!workstations.isEmpty()) { -// registry.addWorkstation(VILLAGER_LEVELING, -// EmiIngredient.of(workstations.stream().map(EmiStack::of).toList())); -// registry.addWorkstation(VILLAGER_PROFESSION, -// EmiIngredient.of(workstations.stream().map(EmiStack::of).toList())); -// registry.addRecipe(new EmiProfessionRecipe(new BrainsweepeeEmiStack(basicVillager), -// EmiIngredient.of(workstations.stream().map(EmiStack::of).toList()), -// new BrainsweepeeEmiStack(manWithJob), poiRecipeId)); -// -// for (int lvl = 1; lvl < 5; lvl++) { -// ResourceLocation levelRecipeId = modLoc( -// "villager/levelup/" + lvl + "/" + id.getNamespace() + "/" + id.getPath()); -// var manWithBadJob = new BrainsweepIngredient(id, null, lvl); -// var manWithBetterJob = new BrainsweepIngredient(id, null, lvl + 1); -// registry.addRecipe(new EmiLevelupRecipe(new BrainsweepeeEmiStack(manWithBadJob), -// new BrainsweepeeEmiStack(manWithBetterJob), levelRecipeId)); -// } -// } -// } -// } - } + registry.addRecipe(new EmiEdifyRecipe()); + } } diff --git a/Fabric/src/main/java/at/petrak/hexcasting/fabric/interop/emi/VillagerVariant.java b/Fabric/src/main/java/at/petrak/hexcasting/fabric/interop/emi/VillagerVariant.java deleted file mode 100644 index 5b06a5cd..00000000 --- a/Fabric/src/main/java/at/petrak/hexcasting/fabric/interop/emi/VillagerVariant.java +++ /dev/null @@ -1,7 +0,0 @@ -package at.petrak.hexcasting.fabric.interop.emi; - -import at.petrak.hexcasting.common.recipe.ingredient.brainsweep.BrainsweepeeIngredient; - -public record VillagerVariant(BrainsweepeeIngredient ingredient, boolean mindless) { - // NO-OP -} diff --git a/Forge/src/generated/resources/.cache/9fb1092f32d4fcbf9e061ffd718d4ec689c6c95e b/Forge/src/generated/resources/.cache/9fb1092f32d4fcbf9e061ffd718d4ec689c6c95e index 5da627b8..8ce849b4 100644 --- a/Forge/src/generated/resources/.cache/9fb1092f32d4fcbf9e061ffd718d4ec689c6c95e +++ b/Forge/src/generated/resources/.cache/9fb1092f32d4fcbf9e061ffd718d4ec689c6c95e @@ -1,4 +1,4 @@ -// 1.19.2 2022-11-23T20:06:32.313241156 Recipes +// 1.19.2 2022-12-29T13:32:49.589849082 Recipes 29056d8bbc023668564ee81f4eb8b2a11411cf4a data/create/recipes/crushing/amethyst_block.json 5bb0b70967a422bfd88c01fa1af64e9b98781fd1 data/create/recipes/crushing/amethyst_cluster.json 8d6f58c45be52e22559fdbc2806ee48ab40d133c data/hexcasting/advancements/recipes/brainsweep/brainsweep/akashic_record.json @@ -7,6 +7,8 @@ f58700261f72cf87acacf1df0f163890c8b7ae00 data/hexcasting/advancements/recipes/br da3c95902e93fe82e489ceccc84a56159329e091 data/hexcasting/advancements/recipes/brainsweep/brainsweep/impetus_look.json 2a1021614882392be78d22cb557e43cbbd9092ca data/hexcasting/advancements/recipes/brainsweep/brainsweep/impetus_rightclick.json a22233090497e1c44082b6eb16ad079d9acc8f7c data/hexcasting/advancements/recipes/brainsweep/brainsweep/impetus_storedplayer.json +0de6f2437a3c33a92de2f3e6b7ac6102996c8779 data/hexcasting/advancements/recipes/brainsweep/brainsweep/testing/bad_to_the_bone.json +eaba34eebb8cb0d8d752ab1d574752e651626c24 data/hexcasting/advancements/recipes/brainsweep/brainsweep/testing/flowey_the_flower.json ae2c6392cc0ec104c4e3019e1824a1e7f811f1de data/hexcasting/advancements/recipes/hexcasting/abacus.json 0cb3e2e6e0be9f53811f24ad43bf711d07560210 data/hexcasting/advancements/recipes/hexcasting/acacia_staff.json d73e5d8fec4d3f7d15888bd292f4ad9c1b37cac5 data/hexcasting/advancements/recipes/hexcasting/ageing_scroll_paper_lantern.json @@ -102,12 +104,14 @@ f0849d723141b9f02798d474da6594f78755dd51 data/hexcasting/recipes/amethyst_tiles. 260f89eb21b360ea8b7fdbd23f9977d03ab57149 data/hexcasting/recipes/ancient_scroll_paper_lantern.json 1880b1519b100f2185ed27a9bfd8f98e83fa728f data/hexcasting/recipes/artifact.json 6f5ee50706640e9be82810e22388fc7b2bce13b1 data/hexcasting/recipes/birch_staff.json -9d4405e831b27dfa6dad7f42f7c2a298de6049a7 data/hexcasting/recipes/brainsweep/akashic_record.json -12b4e03df1c9115dd94790ff27b818c2b7c335d3 data/hexcasting/recipes/brainsweep/budding_amethyst.json -adc3ad0e6cbf522ebe73cc1301089b6b9a4873c0 data/hexcasting/recipes/brainsweep/directrix_redstone.json -67ceb2990df8405119a6ef76af1bb3f9aab5dace data/hexcasting/recipes/brainsweep/impetus_look.json -b864b6c88f1026a371fd72cd7f43bd3b57376c00 data/hexcasting/recipes/brainsweep/impetus_rightclick.json -8f6956c2d1293948d2f1e2ae9eefe890c9168900 data/hexcasting/recipes/brainsweep/impetus_storedplayer.json +e0609202271e402d8ae58e4f8eaf11dcdda10a9e data/hexcasting/recipes/brainsweep/akashic_record.json +5a90084c03d6e8424872870c8b65f4771b447f03 data/hexcasting/recipes/brainsweep/budding_amethyst.json +3127e275f4dc31d80a21f9119fcebc527e821caa data/hexcasting/recipes/brainsweep/directrix_redstone.json +7a51e934846a0d7fe00a808cfa22fd85da67fe9d data/hexcasting/recipes/brainsweep/impetus_look.json +1086a6e3f284fc3b575ee3a21d2b13d0bc62d2bb data/hexcasting/recipes/brainsweep/impetus_rightclick.json +24984d728a5c05967c58be9c0dc1c59e986602e6 data/hexcasting/recipes/brainsweep/impetus_storedplayer.json +16c91a664dbe7914a7db566f45158c8191e52afb data/hexcasting/recipes/brainsweep/testing/bad_to_the_bone.json +ba08fd11d19f54c504ceed6f162a5d814e03d1e8 data/hexcasting/recipes/brainsweep/testing/flowey_the_flower.json c4e770cfd4d855d5b4fdc66e424d58621302f51a data/hexcasting/recipes/compat/create/crushing/amethyst_shard.json 64ee84a9bce988bacde0911d05d0f3834e0b1ae7 data/hexcasting/recipes/compat/farmersdelight/cutting/akashic_door.json f398f4a10736f967482dd1d254d37c7ba9e67bb0 data/hexcasting/recipes/compat/farmersdelight/cutting/akashic_log.json @@ -132,8 +136,8 @@ bc100b94798f0b456877b42a5fc9aee7c4f25218 data/hexcasting/recipes/dye_colorizer_m bc91b7e096d8a0033916101f21fa43c06b343e86 data/hexcasting/recipes/dye_colorizer_red.json ef5a19ab2710fd0ce836d767588fe6a54a528a48 data/hexcasting/recipes/dye_colorizer_white.json 326925a948aeb17aabafbc25ed2562a257796d29 data/hexcasting/recipes/dye_colorizer_yellow.json -0ee8d29cb06065a55017a8fc50576193107f958d data/hexcasting/recipes/dynamic/seal_focus.json -d323e21de69d0606d1fac03fa8820e5857e4e1f1 data/hexcasting/recipes/dynamic/seal_spellbook.json +0ee8d29cb06065a55017a8fc50576193107f958d data/hexcasting/recipes/dynamicseal_focus.json +d323e21de69d0606d1fac03fa8820e5857e4e1f1 data/hexcasting/recipes/dynamicseal_spellbook.json fc0476880c79cf4458dd5b24f77fc980b02534d2 data/hexcasting/recipes/edified_button.json 8a9e7aa8d07556649768729348dff5305b84e1b9 data/hexcasting/recipes/edified_door.json 0efcdb6cd338f382c823e8599e298322a0080dae data/hexcasting/recipes/edified_panel.json diff --git a/Forge/src/generated/resources/data/hexcasting/advancements/recipes/brainsweep/brainsweep/testing/bad_to_the_bone.json b/Forge/src/generated/resources/data/hexcasting/advancements/recipes/brainsweep/brainsweep/testing/bad_to_the_bone.json new file mode 100644 index 00000000..edd1db8e --- /dev/null +++ b/Forge/src/generated/resources/data/hexcasting/advancements/recipes/brainsweep/brainsweep/testing/bad_to_the_bone.json @@ -0,0 +1,34 @@ +{ + "parent": "minecraft:recipes/root", + "criteria": { + "enlightenment": { + "conditions": { + "health_used": { + "min": 0.8 + }, + "mojang_i_am_begging_and_crying_please_add_an_entity_health_criterion": { + "max": 2.05, + "min": 0.1 + } + }, + "trigger": "hexcasting:overcast" + }, + "has_the_recipe": { + "conditions": { + "recipe": "hexcasting:brainsweep/testing/bad_to_the_bone" + }, + "trigger": "minecraft:recipe_unlocked" + } + }, + "requirements": [ + [ + "enlightenment", + "has_the_recipe" + ] + ], + "rewards": { + "recipes": [ + "hexcasting:brainsweep/testing/bad_to_the_bone" + ] + } +} \ No newline at end of file diff --git a/Forge/src/generated/resources/data/hexcasting/advancements/recipes/brainsweep/brainsweep/testing/flowey_the_flower.json b/Forge/src/generated/resources/data/hexcasting/advancements/recipes/brainsweep/brainsweep/testing/flowey_the_flower.json new file mode 100644 index 00000000..7b01dd50 --- /dev/null +++ b/Forge/src/generated/resources/data/hexcasting/advancements/recipes/brainsweep/brainsweep/testing/flowey_the_flower.json @@ -0,0 +1,34 @@ +{ + "parent": "minecraft:recipes/root", + "criteria": { + "enlightenment": { + "conditions": { + "health_used": { + "min": 0.8 + }, + "mojang_i_am_begging_and_crying_please_add_an_entity_health_criterion": { + "max": 2.05, + "min": 0.1 + } + }, + "trigger": "hexcasting:overcast" + }, + "has_the_recipe": { + "conditions": { + "recipe": "hexcasting:brainsweep/testing/flowey_the_flower" + }, + "trigger": "minecraft:recipe_unlocked" + } + }, + "requirements": [ + [ + "enlightenment", + "has_the_recipe" + ] + ], + "rewards": { + "recipes": [ + "hexcasting:brainsweep/testing/flowey_the_flower" + ] + } +} \ No newline at end of file diff --git a/Forge/src/generated/resources/data/hexcasting/recipes/brainsweep/akashic_record.json b/Forge/src/generated/resources/data/hexcasting/recipes/brainsweep/akashic_record.json index 9f087e42..6ff75581 100644 --- a/Forge/src/generated/resources/data/hexcasting/recipes/brainsweep/akashic_record.json +++ b/Forge/src/generated/resources/data/hexcasting/recipes/brainsweep/akashic_record.json @@ -6,8 +6,9 @@ }, "cost": 1000000, "entityIn": { + "type": "villager", "minLevel": 5, - "profession": "minecraft:librarian" + "profession": "librarian" }, "result": { "name": "hexcasting:akashic_record" diff --git a/Forge/src/generated/resources/data/hexcasting/recipes/brainsweep/budding_amethyst.json b/Forge/src/generated/resources/data/hexcasting/recipes/brainsweep/budding_amethyst.json index 821ada6e..b58a6ec9 100644 --- a/Forge/src/generated/resources/data/hexcasting/recipes/brainsweep/budding_amethyst.json +++ b/Forge/src/generated/resources/data/hexcasting/recipes/brainsweep/budding_amethyst.json @@ -6,6 +6,7 @@ }, "cost": 1000000, "entityIn": { + "type": "villager", "minLevel": 3 }, "result": { diff --git a/Forge/src/generated/resources/data/hexcasting/recipes/brainsweep/directrix_redstone.json b/Forge/src/generated/resources/data/hexcasting/recipes/brainsweep/directrix_redstone.json index a20511db..614ea5a6 100644 --- a/Forge/src/generated/resources/data/hexcasting/recipes/brainsweep/directrix_redstone.json +++ b/Forge/src/generated/resources/data/hexcasting/recipes/brainsweep/directrix_redstone.json @@ -6,8 +6,9 @@ }, "cost": 1000000, "entityIn": { + "type": "villager", "minLevel": 1, - "profession": "minecraft:mason" + "profession": "mason" }, "result": { "name": "hexcasting:directrix_redstone", diff --git a/Forge/src/generated/resources/data/hexcasting/recipes/brainsweep/impetus_look.json b/Forge/src/generated/resources/data/hexcasting/recipes/brainsweep/impetus_look.json index 0a45783f..882d44e4 100644 --- a/Forge/src/generated/resources/data/hexcasting/recipes/brainsweep/impetus_look.json +++ b/Forge/src/generated/resources/data/hexcasting/recipes/brainsweep/impetus_look.json @@ -6,8 +6,9 @@ }, "cost": 1000000, "entityIn": { + "type": "villager", "minLevel": 2, - "profession": "minecraft:fletcher" + "profession": "toolsmith" }, "result": { "name": "hexcasting:impetus_look", diff --git a/Forge/src/generated/resources/data/hexcasting/recipes/brainsweep/impetus_rightclick.json b/Forge/src/generated/resources/data/hexcasting/recipes/brainsweep/impetus_rightclick.json index de05a0c4..36366977 100644 --- a/Forge/src/generated/resources/data/hexcasting/recipes/brainsweep/impetus_rightclick.json +++ b/Forge/src/generated/resources/data/hexcasting/recipes/brainsweep/impetus_rightclick.json @@ -6,8 +6,9 @@ }, "cost": 1000000, "entityIn": { + "type": "villager", "minLevel": 2, - "profession": "minecraft:toolsmith" + "profession": "toolsmith" }, "result": { "name": "hexcasting:impetus_rightclick", diff --git a/Forge/src/generated/resources/data/hexcasting/recipes/brainsweep/impetus_storedplayer.json b/Forge/src/generated/resources/data/hexcasting/recipes/brainsweep/impetus_storedplayer.json index f662bbba..8529689e 100644 --- a/Forge/src/generated/resources/data/hexcasting/recipes/brainsweep/impetus_storedplayer.json +++ b/Forge/src/generated/resources/data/hexcasting/recipes/brainsweep/impetus_storedplayer.json @@ -6,8 +6,9 @@ }, "cost": 1000000, "entityIn": { + "type": "villager", "minLevel": 2, - "profession": "minecraft:cleric" + "profession": "cleric" }, "result": { "name": "hexcasting:impetus_storedplayer", diff --git a/Forge/src/generated/resources/data/hexcasting/recipes/brainsweep/testing/bad_to_the_bone.json b/Forge/src/generated/resources/data/hexcasting/recipes/brainsweep/testing/bad_to_the_bone.json new file mode 100644 index 00000000..19eb1018 --- /dev/null +++ b/Forge/src/generated/resources/data/hexcasting/recipes/brainsweep/testing/bad_to_the_bone.json @@ -0,0 +1,18 @@ +{ + "type": "hexcasting:brainsweep", + "blockIn": { + "type": "block", + "block": "minecraft:scaffolding" + }, + "cost": 50000, + "entityIn": { + "type": "entity_tag", + "tag": "minecraft:skeletons" + }, + "result": { + "name": "minecraft:bone_block", + "properties": { + "axis": "y" + } + } +} \ No newline at end of file diff --git a/Forge/src/generated/resources/data/hexcasting/recipes/brainsweep/testing/flowey_the_flower.json b/Forge/src/generated/resources/data/hexcasting/recipes/brainsweep/testing/flowey_the_flower.json new file mode 100644 index 00000000..23d5177f --- /dev/null +++ b/Forge/src/generated/resources/data/hexcasting/recipes/brainsweep/testing/flowey_the_flower.json @@ -0,0 +1,19 @@ +{ + "type": "hexcasting:brainsweep", + "blockIn": { + "type": "tag", + "tag": "minecraft:small_flowers" + }, + "cost": 50000, + "entityIn": { + "type": "entity_type", + "entityType": "minecraft:allay" + }, + "result": { + "name": "minecraft:amethyst_cluster", + "properties": { + "facing": "up", + "waterlogged": "false" + } + } +} \ No newline at end of file diff --git a/Forge/src/generated/resources/data/hexcasting/recipes/dynamic/seal_focus.json b/Forge/src/generated/resources/data/hexcasting/recipes/dynamicseal_focus.json similarity index 100% rename from Forge/src/generated/resources/data/hexcasting/recipes/dynamic/seal_focus.json rename to Forge/src/generated/resources/data/hexcasting/recipes/dynamicseal_focus.json diff --git a/Forge/src/generated/resources/data/hexcasting/recipes/dynamic/seal_spellbook.json b/Forge/src/generated/resources/data/hexcasting/recipes/dynamicseal_spellbook.json similarity index 100% rename from Forge/src/generated/resources/data/hexcasting/recipes/dynamic/seal_spellbook.json rename to Forge/src/generated/resources/data/hexcasting/recipes/dynamicseal_spellbook.json