data: genned

This commit is contained in:
petrak@ 2023-01-21 13:23:24 -06:00
parent e900e4d62b
commit 4af930e7a7
19 changed files with 103 additions and 30 deletions

View file

@ -0,0 +1,3 @@
// 1.19.2 2023-01-21T13:20:42.592825003 Tags for hexcasting:action
7684713a5311ad151b5591d22757988c8462d647 data/hexcasting/tags/hexcasting/action/per_world_pattern.json
9eb0b98603394a44b9202d1ff6778a539edfdfa4 data/hexcasting/tags/hexcasting/action/requires_enlightenment.json

View file

@ -0,0 +1,12 @@
{
"values": [
"hexcasting:lightning",
"hexcasting:flight",
"hexcasting:create_lava",
"hexcasting:teleport",
"hexcasting:sentinel/create/great",
"hexcasting:dispel_rain",
"hexcasting:summon_rain",
"hexcasting:brainsweep"
]
}

View file

@ -0,0 +1,13 @@
{
"values": [
"hexcasting:lightning",
"hexcasting:flight",
"hexcasting:create_lava",
"hexcasting:teleport",
"hexcasting:sentinel/create/great",
"hexcasting:dispel_rain",
"hexcasting:summon_rain",
"hexcasting:brainsweep",
"hexcasting:akashic/write"
]
}

View file

@ -557,8 +557,7 @@ public class HexActions {
return are; return are;
} }
public static void register() { public static void register(BiConsumer<ActionRegistryEntry, ResourceLocation> r) {
BiConsumer<ActionRegistryEntry, ResourceLocation> r = (type, id) -> Registry.register(REGISTRY, id, type);
for (var e : ACTIONS.entrySet()) { for (var e : ACTIONS.entrySet()) {
r.accept(e.getValue(), e.getKey()); r.accept(e.getValue(), e.getKey());
} }

View file

@ -38,8 +38,7 @@ public class HexEvalSounds {
return sound; return sound;
} }
public static void register() { public static void register(BiConsumer<EvalSound, ResourceLocation> r) {
BiConsumer<EvalSound, ResourceLocation> r = (type, id) -> Registry.register(REGISTRY, id, type);
for (var e : SOUNDS.entrySet()) { for (var e : SOUNDS.entrySet()) {
r.accept(e.getValue(), e.getKey()); r.accept(e.getValue(), e.getKey());
} }

View file

@ -179,8 +179,7 @@ public class HexIotaTypes {
return type.color(); return type.color();
} }
public static void registerTypes() { public static void registerTypes(BiConsumer<IotaType<?>, ResourceLocation> r) {
BiConsumer<IotaType<?>, ResourceLocation> r = (type, id) -> Registry.register(REGISTRY, id, type);
for (var e : TYPES.entrySet()) { for (var e : TYPES.entrySet()) {
r.accept(e.getValue(), e.getKey()); r.accept(e.getValue(), e.getKey());
} }

View file

@ -33,8 +33,7 @@ public class HexSpecialHandlers {
return handler; return handler;
} }
public static void register() { public static void register(BiConsumer<SpecialHandler.Factory<?>, ResourceLocation> r) {
BiConsumer<SpecialHandler.Factory<?>, ResourceLocation> r = (type, id) -> Registry.register(REGISTRY, id, type);
for (var e : SPECIAL_HANDLERS.entrySet()) { for (var e : SPECIAL_HANDLERS.entrySet()) {
r.accept(e.getValue(), e.getKey()); r.accept(e.getValue(), e.getKey());
} }

View file

@ -0,0 +1,38 @@
package at.petrak.hexcasting.datagen.tag;
import at.petrak.hexcasting.api.casting.ActionRegistryEntry;
import at.petrak.hexcasting.api.mod.HexTags;
import at.petrak.hexcasting.xplat.IXplatAbstractions;
import net.minecraft.data.DataGenerator;
import net.minecraft.data.tags.TagsProvider;
import net.minecraft.resources.ResourceKey;
import static at.petrak.hexcasting.api.HexAPI.modLoc;
public class HexActionTagProvider extends TagsProvider<ActionRegistryEntry> {
public HexActionTagProvider(DataGenerator generator) {
super(generator, IXplatAbstractions.INSTANCE.getActionRegistry());
}
@Override
protected void addTags() {
// In-game almost all great spells are always per-world
for (var normalGreat : new String[]{
"lightning", "flight", "create_lava", "teleport", "sentinel/create/great",
"dispel_rain", "summon_rain", "brainsweep"
}) {
var loc = modLoc(normalGreat);
var key = ResourceKey.create(IXplatAbstractions.INSTANCE.getActionRegistry().key(), loc);
tag(HexTags.Actions.REQUIRES_ENLIGHTENMENT).add(key);
tag(HexTags.Actions.PER_WORLD_PATTERN).add(key);
}
for (var onlyEnlighten : new String[]{
"akashic/write",
}) {
var loc = modLoc(onlyEnlighten);
var key = ResourceKey.create(IXplatAbstractions.INSTANCE.getActionRegistry().key(), loc);
tag(HexTags.Actions.REQUIRES_ENLIGHTENMENT).add(key);
}
}
}

View file

@ -1,4 +1,4 @@
package at.petrak.hexcasting.datagen; package at.petrak.hexcasting.datagen.tag;
import at.petrak.hexcasting.api.mod.HexTags; import at.petrak.hexcasting.api.mod.HexTags;
import at.petrak.hexcasting.common.lib.HexBlocks; import at.petrak.hexcasting.common.lib.HexBlocks;

View file

@ -1,4 +1,4 @@
package at.petrak.hexcasting.datagen; package at.petrak.hexcasting.datagen.tag;
import at.petrak.hexcasting.api.mod.HexTags; import at.petrak.hexcasting.api.mod.HexTags;
import at.petrak.hexcasting.common.lib.HexItems; import at.petrak.hexcasting.common.lib.HexItems;

View file

@ -1,4 +1,4 @@
// 1.19.2 2022-12-29T13:31:04.089602837 Tags for minecraft:item // 1.19.2 2023-01-21T13:21:56.749293749 Tags for minecraft:item
5928bad07d3872bb60f29ef4f3c885c8e1967c20 data/hexcasting/tags/items/phial_base.json 5928bad07d3872bb60f29ef4f3c885c8e1967c20 data/hexcasting/tags/items/phial_base.json
fdb48f194d7937ab6b423fa4b90a4d438bf6dd90 data/minecraft/tags/items/wooden_doors.json fdb48f194d7937ab6b423fa4b90a4d438bf6dd90 data/minecraft/tags/items/wooden_doors.json
e5df19a1dc6eadf14cd9b0f0fe45a74330b745e9 data/hexcasting/tags/items/edified_planks.json e5df19a1dc6eadf14cd9b0f0fe45a74330b745e9 data/hexcasting/tags/items/edified_planks.json

View file

@ -1,4 +1,4 @@
// 1.19.2 2022-12-29T13:31:04.07610805 LootTables // 1.19.2 2023-01-21T13:21:56.793259038 LootTables
01a50f557196c705c275722015cf893e0abe6425 data/hexcasting/loot_tables/inject/scroll_loot_many.json 01a50f557196c705c275722015cf893e0abe6425 data/hexcasting/loot_tables/inject/scroll_loot_many.json
dec1d3592e82f99d9e059d9c771530f103b2bda5 data/hexcasting/loot_tables/blocks/empty_directrix.json dec1d3592e82f99d9e059d9c771530f103b2bda5 data/hexcasting/loot_tables/blocks/empty_directrix.json
2c42fc5d8c74c98ad15b8bd50f56541fccbef750 data/hexcasting/loot_tables/blocks/edified_tile.json 2c42fc5d8c74c98ad15b8bd50f56541fccbef750 data/hexcasting/loot_tables/blocks/edified_tile.json

View file

@ -1,4 +1,4 @@
// 1.19.2 2022-12-29T13:31:04.07186608 Tags for minecraft:block // 1.19.2 2023-01-21T13:21:56.751752593 Tags for minecraft:block
20183cd61968ff6548df2dde1100b6378d68d64b data/minecraft/tags/blocks/wooden_buttons.json 20183cd61968ff6548df2dde1100b6378d68d64b data/minecraft/tags/blocks/wooden_buttons.json
357eddf3cee6f16725bed0701d57b2ca3097d74d data/minecraft/tags/blocks/mineable/shovel.json 357eddf3cee6f16725bed0701d57b2ca3097d74d data/minecraft/tags/blocks/mineable/shovel.json
5216ba5c57db29b8dee9aebc63a2e3b17c97dc17 data/minecraft/tags/blocks/wooden_trapdoors.json 5216ba5c57db29b8dee9aebc63a2e3b17c97dc17 data/minecraft/tags/blocks/wooden_trapdoors.json

View file

@ -1,4 +1,4 @@
// 1.19.2 2022-12-29T13:31:04.05733867 Recipes // 1.19.2 2023-01-21T13:21:56.764789809 Recipes
858dada9c41974f5aa80c66423bf371c9e176a53 data/hexcasting/recipes/pride_colorizer_demigirl.json 858dada9c41974f5aa80c66423bf371c9e176a53 data/hexcasting/recipes/pride_colorizer_demigirl.json
bb0f91c534c888d1cff8793b49986dce236c7b2d data/hexcasting/advancements/recipes/hexcasting.creative_tab/dye_colorizer_white.json bb0f91c534c888d1cff8793b49986dce236c7b2d data/hexcasting/advancements/recipes/hexcasting.creative_tab/dye_colorizer_white.json
9f75d3e93ecbbbf3ed9a92b2943397e09dcae1a9 data/hexcasting/recipes/dye_colorizer_light_blue.json 9f75d3e93ecbbbf3ed9a92b2943397e09dcae1a9 data/hexcasting/recipes/dye_colorizer_light_blue.json

View file

@ -33,6 +33,7 @@ import at.petrak.hexcasting.fabric.recipe.FabricModConditionalIngredient
import at.petrak.hexcasting.fabric.recipe.FabricUnsealedIngredient import at.petrak.hexcasting.fabric.recipe.FabricUnsealedIngredient
import at.petrak.hexcasting.fabric.storage.FabricImpetusStorage import at.petrak.hexcasting.fabric.storage.FabricImpetusStorage
import at.petrak.hexcasting.interop.HexInterop import at.petrak.hexcasting.interop.HexInterop
import at.petrak.hexcasting.xplat.IXplatAbstractions
import io.github.tropheusj.serialization_hooks.ingredient.IngredientDeserializer import io.github.tropheusj.serialization_hooks.ingredient.IngredientDeserializer
import net.fabricmc.api.ModInitializer import net.fabricmc.api.ModInitializer
import net.fabricmc.fabric.api.command.v2.ArgumentTypeRegistry import net.fabricmc.fabric.api.command.v2.ArgumentTypeRegistry
@ -122,10 +123,10 @@ object FabricHexInitializer : ModInitializer {
HexLootFunctions.registerSerializers(bind(Registry.LOOT_FUNCTION_TYPE)) HexLootFunctions.registerSerializers(bind(Registry.LOOT_FUNCTION_TYPE))
HexActions.register() HexIotaTypes.registerTypes(bind(IXplatAbstractions.INSTANCE.iotaTypeRegistry))
HexSpecialHandlers.register() HexActions.register(bind(IXplatAbstractions.INSTANCE.actionRegistry))
HexIotaTypes.registerTypes() HexSpecialHandlers.register(bind(IXplatAbstractions.INSTANCE.specialHandlerRegistry))
HexEvalSounds.register() HexEvalSounds.register(bind(IXplatAbstractions.INSTANCE.evalSoundRegistry))
// Because of Java's lazy-loading of classes, can't use Kotlin static initialization for // Because of Java's lazy-loading of classes, can't use Kotlin static initialization for
// any calls that will eventually touch FeatureUtils.register(), as the growers here do, // any calls that will eventually touch FeatureUtils.register(), as the growers here do,

View file

@ -1,12 +1,12 @@
package at.petrak.hexcasting.fabric.datagen; package at.petrak.hexcasting.fabric.datagen;
import at.petrak.hexcasting.api.HexAPI; import at.petrak.hexcasting.api.HexAPI;
import at.petrak.hexcasting.datagen.HexBlockTagProvider;
import at.petrak.hexcasting.datagen.HexItemTagProvider;
import at.petrak.hexcasting.datagen.HexLootTables; import at.petrak.hexcasting.datagen.HexLootTables;
import at.petrak.hexcasting.datagen.IXplatIngredients; import at.petrak.hexcasting.datagen.IXplatIngredients;
import at.petrak.hexcasting.datagen.recipe.HexplatRecipes; import at.petrak.hexcasting.datagen.recipe.HexplatRecipes;
import at.petrak.hexcasting.datagen.recipe.builders.FarmersDelightToolIngredient; import at.petrak.hexcasting.datagen.recipe.builders.FarmersDelightToolIngredient;
import at.petrak.hexcasting.datagen.tag.HexBlockTagProvider;
import at.petrak.hexcasting.datagen.tag.HexItemTagProvider;
import at.petrak.hexcasting.fabric.recipe.FabricModConditionalIngredient; import at.petrak.hexcasting.fabric.recipe.FabricModConditionalIngredient;
import at.petrak.hexcasting.xplat.IXplatAbstractions; import at.petrak.hexcasting.xplat.IXplatAbstractions;
import com.google.gson.JsonObject; import com.google.gson.JsonObject;

View file

@ -105,18 +105,18 @@ public class ForgeHexInitializer {
bind(Registry.PARTICLE_TYPE_REGISTRY, HexParticles::registerParticles); bind(Registry.PARTICLE_TYPE_REGISTRY, HexParticles::registerParticles);
ForgeHexArgumentTypeRegistry.ARGUMENT_TYPES.register(getModEventBus()); bind(IXplatAbstractions.INSTANCE.getIotaTypeRegistry().key(), HexIotaTypes::registerTypes);
bind(IXplatAbstractions.INSTANCE.getActionRegistry().key(), HexActions::register);
bind(IXplatAbstractions.INSTANCE.getSpecialHandlerRegistry().key(), HexSpecialHandlers::register);
bind(IXplatAbstractions.INSTANCE.getEvalSoundRegistry().key(), HexEvalSounds::register);
HexActions.register(); ForgeHexArgumentTypeRegistry.ARGUMENT_TYPES.register(getModEventBus());
HexSpecialHandlers.register();
HexIotaTypes.registerTypes();
HexEvalSounds.register();
HexAdvancementTriggers.registerTriggers(); HexAdvancementTriggers.registerTriggers();
} }
// https://github.com/VazkiiMods/Botania/blob/1.18.x/Forge/src/main/java/vazkii/botania/forge/ForgeCommonInitializer.java // https://github.com/VazkiiMods/Botania/blob/1.18.x/Forge/src/main/java/vazkii/botania/forge/ForgeCommonInitializer.java
private static <T> void bind(ResourceKey<Registry<T>> registry, private static <T> void bind(ResourceKey<? extends Registry<T>> registry,
Consumer<BiConsumer<T, ResourceLocation>> source) { Consumer<BiConsumer<T, ResourceLocation>> source) {
getModEventBus().addListener((RegisterEvent event) -> { getModEventBus().addListener((RegisterEvent event) -> {
if (registry.equals(event.getRegistryKey())) { if (registry.equals(event.getRegistryKey())) {

View file

@ -1,9 +1,14 @@
package at.petrak.hexcasting.forge.datagen; package at.petrak.hexcasting.forge.datagen;
import at.petrak.hexcasting.api.HexAPI; import at.petrak.hexcasting.api.HexAPI;
import at.petrak.hexcasting.datagen.*; import at.petrak.hexcasting.datagen.HexAdvancements;
import at.petrak.hexcasting.datagen.HexLootTables;
import at.petrak.hexcasting.datagen.IXplatIngredients;
import at.petrak.hexcasting.datagen.recipe.HexplatRecipes; import at.petrak.hexcasting.datagen.recipe.HexplatRecipes;
import at.petrak.hexcasting.datagen.recipe.builders.FarmersDelightToolIngredient; import at.petrak.hexcasting.datagen.recipe.builders.FarmersDelightToolIngredient;
import at.petrak.hexcasting.datagen.tag.HexActionTagProvider;
import at.petrak.hexcasting.datagen.tag.HexBlockTagProvider;
import at.petrak.hexcasting.datagen.tag.HexItemTagProvider;
import at.petrak.hexcasting.forge.datagen.xplat.HexBlockStatesAndModels; import at.petrak.hexcasting.forge.datagen.xplat.HexBlockStatesAndModels;
import at.petrak.hexcasting.forge.datagen.xplat.HexItemModels; import at.petrak.hexcasting.forge.datagen.xplat.HexItemModels;
import at.petrak.hexcasting.forge.recipe.ForgeModConditionalIngredient; import at.petrak.hexcasting.forge.recipe.ForgeModConditionalIngredient;
@ -46,6 +51,8 @@ public class HexForgeDataGenerators {
gen.addProvider(ev.includeClient(), new HexBlockStatesAndModels(gen, efh)); gen.addProvider(ev.includeClient(), new HexBlockStatesAndModels(gen, efh));
gen.addProvider(ev.includeServer(), gen.addProvider(ev.includeServer(),
PaucalForgeDatagenWrappers.addEFHToAdvancements(new HexAdvancements(gen), efh)); PaucalForgeDatagenWrappers.addEFHToAdvancements(new HexAdvancements(gen), efh));
gen.addProvider(ev.includeServer(), PaucalForgeDatagenWrappers.addEFHToTagProvider(
new HexActionTagProvider(gen), efh));
} }
private static void configureForgeDatagen(GatherDataEvent ev) { private static void configureForgeDatagen(GatherDataEvent ev) {

View file

@ -1,9 +1,11 @@
package at.petrak.hexcasting.forge.interop.jei; package at.petrak.hexcasting.forge.interop.jei;
import at.petrak.hexcasting.common.casting.PatternRegistryManifest;
import at.petrak.hexcasting.api.casting.math.HexCoord; import at.petrak.hexcasting.api.casting.math.HexCoord;
import at.petrak.hexcasting.api.mod.HexTags;
import at.petrak.hexcasting.api.utils.HexUtils;
import at.petrak.hexcasting.interop.utils.PatternDrawingUtil; import at.petrak.hexcasting.interop.utils.PatternDrawingUtil;
import at.petrak.hexcasting.interop.utils.PatternEntry; import at.petrak.hexcasting.interop.utils.PatternEntry;
import at.petrak.hexcasting.xplat.IXplatAbstractions;
import com.mojang.blaze3d.vertex.PoseStack; import com.mojang.blaze3d.vertex.PoseStack;
import com.mojang.datafixers.util.Pair; import com.mojang.datafixers.util.Pair;
import mezz.jei.api.gui.drawable.IDrawable; import mezz.jei.api.gui.drawable.IDrawable;
@ -24,8 +26,9 @@ public class PatternDrawable implements IDrawable {
private final List<Vec2> pathfinderDots; private final List<Vec2> pathfinderDots;
public PatternDrawable(ResourceLocation pattern, int w, int h) { public PatternDrawable(ResourceLocation pattern, int w, int h) {
var entry = PatternRegistryManifest.lookupPattern(pattern); var regi = IXplatAbstractions.INSTANCE.getActionRegistry();
this.strokeOrder = !entry.isPerWorld(); var entry = regi.get(pattern);
this.strokeOrder = !HexUtils.isOfTag(regi, pattern, HexTags.Actions.PER_WORLD_PATTERN);
var data = PatternDrawingUtil.loadPatterns( var data = PatternDrawingUtil.loadPatterns(
List.of(new Pair<>(entry.prototype(), HexCoord.getOrigin())), List.of(new Pair<>(entry.prototype(), HexCoord.getOrigin())),
0f, 0f,