fix some datagen
This commit is contained in:
parent
a97545246f
commit
32559dc94d
5 changed files with 28 additions and 30 deletions
|
@ -14,8 +14,7 @@ public class FailToCastGreatSpellTrigger extends SimpleCriterionTrigger<FailToCa
|
|||
}
|
||||
|
||||
@Override
|
||||
public Instance createInstance(JsonObject json, EntityPredicate.Composite predicate,
|
||||
DeserializationContext pContext) {
|
||||
protected Instance createInstance(JsonObject json, ContextAwarePredicate predicate, DeserializationContext context) {
|
||||
return new Instance(predicate);
|
||||
}
|
||||
|
||||
|
@ -24,8 +23,8 @@ public class FailToCastGreatSpellTrigger extends SimpleCriterionTrigger<FailToCa
|
|||
}
|
||||
|
||||
public static class Instance extends AbstractCriterionTriggerInstance {
|
||||
public Instance(EntityPredicate.Composite pPlayer) {
|
||||
super(ID, pPlayer);
|
||||
public Instance(ContextAwarePredicate predicate) {
|
||||
super(ID, predicate);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -24,7 +24,7 @@ public class OvercastTrigger extends SimpleCriterionTrigger<OvercastTrigger.Inst
|
|||
}
|
||||
|
||||
@Override
|
||||
protected Instance createInstance(JsonObject json, EntityPredicate.Composite predicate,
|
||||
protected Instance createInstance(JsonObject json, ContextAwarePredicate predicate,
|
||||
DeserializationContext pContext) {
|
||||
return new Instance(predicate,
|
||||
MinMaxBounds.Ints.fromJson(json.get(TAG_MEDIA_GENERATED)),
|
||||
|
@ -47,7 +47,7 @@ public class OvercastTrigger extends SimpleCriterionTrigger<OvercastTrigger.Inst
|
|||
// DID YOU KNOW THERES ONE TO CHECK THE WORLD TIME, BUT NOT THE HEALTH!?
|
||||
protected final MinMaxBounds.Doubles healthLeft;
|
||||
|
||||
public Instance(EntityPredicate.Composite predicate, MinMaxBounds.Ints mediaGenerated,
|
||||
public Instance(ContextAwarePredicate predicate, MinMaxBounds.Ints mediaGenerated,
|
||||
MinMaxBounds.Doubles healthUsed, MinMaxBounds.Doubles healthLeft) {
|
||||
super(OvercastTrigger.ID, predicate);
|
||||
this.mediaGenerated = mediaGenerated;
|
||||
|
|
|
@ -17,8 +17,8 @@ public class SpendMediaTrigger extends SimpleCriterionTrigger<SpendMediaTrigger.
|
|||
}
|
||||
|
||||
@Override
|
||||
protected Instance createInstance(JsonObject json, EntityPredicate.Composite predicate,
|
||||
DeserializationContext pContext) {
|
||||
protected Instance createInstance(JsonObject json, ContextAwarePredicate predicate,
|
||||
DeserializationContext context) {
|
||||
return new Instance(predicate,
|
||||
MinMaxBounds.Ints.fromJson(json.get(TAG_MEDIA_SPENT)),
|
||||
MinMaxBounds.Ints.fromJson(json.get(TAG_MEDIA_WASTED)));
|
||||
|
@ -32,7 +32,7 @@ public class SpendMediaTrigger extends SimpleCriterionTrigger<SpendMediaTrigger.
|
|||
protected final MinMaxBounds.Ints mediaSpent;
|
||||
protected final MinMaxBounds.Ints mediaWasted;
|
||||
|
||||
public Instance(EntityPredicate.Composite predicate, MinMaxBounds.Ints mediaSpent,
|
||||
public Instance(ContextAwarePredicate predicate, MinMaxBounds.Ints mediaSpent,
|
||||
MinMaxBounds.Ints mediaWasted) {
|
||||
super(SpendMediaTrigger.ID, predicate);
|
||||
this.mediaSpent = mediaSpent;
|
||||
|
|
|
@ -10,10 +10,12 @@ import at.petrak.hexcasting.common.items.ItemLoreFragment;
|
|||
import at.petrak.hexcasting.common.lib.HexBlocks;
|
||||
import at.petrak.hexcasting.common.lib.HexItems;
|
||||
import at.petrak.paucal.api.datagen.PaucalAdvancementProvider;
|
||||
import at.petrak.paucal.api.datagen.PaucalAdvancementSubProvider;
|
||||
import net.minecraft.advancements.Advancement;
|
||||
import net.minecraft.advancements.DisplayInfo;
|
||||
import net.minecraft.advancements.FrameType;
|
||||
import net.minecraft.advancements.critereon.*;
|
||||
import net.minecraft.core.HolderLookup;
|
||||
import net.minecraft.data.DataGenerator;
|
||||
import net.minecraft.network.chat.Component;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
|
@ -22,9 +24,9 @@ import net.minecraft.world.item.Items;
|
|||
|
||||
import java.util.function.Consumer;
|
||||
|
||||
public class HexAdvancements extends PaucalAdvancementProvider {
|
||||
public class HexAdvancements extends PaucalAdvancementSubProvider {
|
||||
public static final OvercastTrigger.Instance ENLIGHTEN =
|
||||
new OvercastTrigger.Instance(EntityPredicate.Composite.ANY,
|
||||
new OvercastTrigger.Instance(ContextAwarePredicate.ANY,
|
||||
MinMaxBounds.Ints.ANY,
|
||||
// add a little bit of slop here. use 80% or more health ...
|
||||
MinMaxBounds.Doubles.atLeast(0.8),
|
||||
|
@ -33,12 +35,12 @@ public class HexAdvancements extends PaucalAdvancementProvider {
|
|||
// less, you can't become enlightened.
|
||||
MinMaxBounds.Doubles.between(Double.MIN_NORMAL, 1.0));
|
||||
|
||||
public HexAdvancements(DataGenerator generatorIn) {
|
||||
super(generatorIn, HexAPI.MOD_ID);
|
||||
public HexAdvancements() {
|
||||
super(HexAPI.MOD_ID);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void makeAdvancements(Consumer<Advancement> consumer) {
|
||||
public void generate(HolderLookup.Provider provider, Consumer<Advancement> consumer) {
|
||||
var root = Advancement.Builder.advancement()
|
||||
// what an ergonomic design decision
|
||||
// i am so happy that data generators are the future
|
||||
|
@ -56,14 +58,14 @@ public class HexAdvancements extends PaucalAdvancementProvider {
|
|||
Advancement.Builder.advancement()
|
||||
.display(simpleDisplay(Items.GLISTERING_MELON_SLICE, "wasteful_cast", FrameType.TASK))
|
||||
.parent(root)
|
||||
.addCriterion("waste_amt", new SpendMediaTrigger.Instance(EntityPredicate.Composite.ANY,
|
||||
.addCriterion("waste_amt", new SpendMediaTrigger.Instance(ContextAwarePredicate.ANY,
|
||||
MinMaxBounds.Ints.ANY,
|
||||
MinMaxBounds.Ints.atLeast(89 * MediaConstants.DUST_UNIT / 10)))
|
||||
.save(consumer, prefix("aaa_wasteful_cast"));
|
||||
Advancement.Builder.advancement()
|
||||
.display(simpleDisplay(HexItems.CHARGED_AMETHYST, "big_cast", FrameType.TASK))
|
||||
.parent(root)
|
||||
.addCriterion("cast_amt", new SpendMediaTrigger.Instance(EntityPredicate.Composite.ANY,
|
||||
.addCriterion("cast_amt", new SpendMediaTrigger.Instance(ContextAwarePredicate.ANY,
|
||||
MinMaxBounds.Ints.atLeast(64 * MediaConstants.CRYSTAL_UNIT),
|
||||
MinMaxBounds.Ints.ANY))
|
||||
.save(consumer, prefix("aab_big_cast"));
|
||||
|
@ -72,14 +74,14 @@ public class HexAdvancements extends PaucalAdvancementProvider {
|
|||
.display(simpleDisplay(Items.BLAZE_POWDER, "y_u_no_cast_angy", FrameType.TASK))
|
||||
.parent(root)
|
||||
.addCriterion("did_the_thing",
|
||||
new FailToCastGreatSpellTrigger.Instance(EntityPredicate.Composite.ANY))
|
||||
new FailToCastGreatSpellTrigger.Instance(ContextAwarePredicate.ANY))
|
||||
.save(consumer, prefix("y_u_no_cast_angy"));
|
||||
|
||||
var opened_eyes = Advancement.Builder.advancement()
|
||||
.display(simpleDisplay(Items.ENDER_EYE, "opened_eyes", FrameType.TASK))
|
||||
.parent(impotence)
|
||||
.addCriterion("health_used",
|
||||
new OvercastTrigger.Instance(EntityPredicate.Composite.ANY,
|
||||
new OvercastTrigger.Instance(ContextAwarePredicate.ANY,
|
||||
MinMaxBounds.Ints.ANY,
|
||||
MinMaxBounds.Doubles.ANY,
|
||||
// you can't just kill yourself
|
||||
|
@ -99,7 +101,7 @@ public class HexAdvancements extends PaucalAdvancementProvider {
|
|||
var loreRoot = Advancement.Builder.advancement()
|
||||
.display(simpleDisplayWithBackground(HexBlocks.AKASHIC_LIGATURE, "lore", FrameType.GOAL,
|
||||
modLoc("textures/block/slate.png")))
|
||||
.addCriterion("used_item", new ConsumeItemTrigger.TriggerInstance(EntityPredicate.Composite.ANY,
|
||||
.addCriterion("used_item", new ConsumeItemTrigger.TriggerInstance(ContextAwarePredicate.ANY,
|
||||
ItemPredicate.Builder.item().of(HexItems.LORE_FRAGMENT).build()))
|
||||
.save(consumer, prefix("lore"));
|
||||
|
||||
|
|
|
@ -13,7 +13,6 @@ import at.petrak.hexcasting.forge.datagen.xplat.HexBlockStatesAndModels;
|
|||
import at.petrak.hexcasting.forge.datagen.xplat.HexItemModels;
|
||||
import at.petrak.hexcasting.forge.recipe.ForgeModConditionalIngredient;
|
||||
import at.petrak.hexcasting.xplat.IXplatAbstractions;
|
||||
import at.petrak.paucal.api.forge.datagen.PaucalForgeDatagenWrappers;
|
||||
import com.google.gson.JsonObject;
|
||||
import net.minecraft.data.DataGenerator;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
|
@ -49,27 +48,25 @@ public class ForgeHexDataGenerators {
|
|||
ExistingFileHelper efh = ev.getExistingFileHelper();
|
||||
gen.addProvider(ev.includeClient(), new HexItemModels(gen, efh));
|
||||
gen.addProvider(ev.includeClient(), new HexBlockStatesAndModels(gen, efh));
|
||||
gen.addProvider(ev.includeServer(),
|
||||
PaucalForgeDatagenWrappers.addEFHToAdvancements(new HexAdvancements(gen), efh));
|
||||
gen.addProvider(ev.includeServer(), new HexAdvancements());
|
||||
}
|
||||
|
||||
private static void configureForgeDatagen(GatherDataEvent ev) {
|
||||
HexAPI.LOGGER.info("Starting Forge-specific datagen");
|
||||
|
||||
DataGenerator gen = ev.getGenerator();
|
||||
var pack = gen.getPackOutput();
|
||||
var lookup = ev.getLookupProvider();
|
||||
ExistingFileHelper efh = ev.getExistingFileHelper();
|
||||
gen.addProvider(ev.includeServer(), new HexLootTables(gen));
|
||||
gen.addProvider(ev.includeServer(), new HexplatRecipes(gen, INGREDIENTS, ForgeHexConditionsBuilder::new));
|
||||
gen.addProvider(ev.includeServer(), new HexLootTables());
|
||||
gen.addProvider(ev.includeServer(), new HexplatRecipes(pack, INGREDIENTS, ForgeHexConditionsBuilder::new));
|
||||
|
||||
var xtags = IXplatAbstractions.INSTANCE.tags();
|
||||
var blockTagProvider = PaucalForgeDatagenWrappers.addEFHToTagProvider(
|
||||
new HexBlockTagProvider(gen, xtags), efh);
|
||||
var blockTagProvider = new HexBlockTagProvider(pack, lookup, xtags);
|
||||
gen.addProvider(ev.includeServer(), blockTagProvider);
|
||||
var itemTagProvider = PaucalForgeDatagenWrappers.addEFHToTagProvider(
|
||||
new HexItemTagProvider(gen, blockTagProvider, IXplatAbstractions.INSTANCE.tags()), efh);
|
||||
var itemTagProvider = new HexItemTagProvider(pack, lookup, blockTagProvider, IXplatAbstractions.INSTANCE.tags());
|
||||
gen.addProvider(ev.includeServer(), itemTagProvider);
|
||||
gen.addProvider(ev.includeServer(),
|
||||
PaucalForgeDatagenWrappers.addEFHToTagProvider(new HexActionTagProvider(gen), efh));
|
||||
gen.addProvider(ev.includeServer(), new HexActionTagProvider(pack, lookup));
|
||||
|
||||
gen.addProvider(ev.includeServer(), new ForgeHexLootModGen(gen));
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue