Skip to content

Commit

Permalink
Tools and ore/geode gen
Browse files Browse the repository at this point in the history
  • Loading branch information
SuperScary committed Oct 18, 2024
1 parent 0af52be commit f8cbf1c
Show file tree
Hide file tree
Showing 27 changed files with 796 additions and 26 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,12 @@
import net.superscary.fluxmachines.datagen.providers.recipes.SmeltingRecipes;
import net.superscary.fluxmachines.datagen.providers.tag.FMBlockTagGenerator;
import net.superscary.fluxmachines.datagen.providers.tag.FMItemTagGenerator;
import net.superscary.fluxmachines.datagen.providers.worldgen.WorldGenProvider;

import java.util.concurrent.CompletableFuture;
import java.util.function.BiFunction;

@SuppressWarnings("unused")
@EventBusSubscriber(modid = FluxMachines.MODID, bus = EventBusSubscriber.Bus.MOD)
public class DataGenerators {

Expand All @@ -34,7 +36,7 @@ public static void gather (GatherDataEvent event) {
var localization = new FMEnLangProvider(generator);

// WORLD GEN
//pack.addProvider(output -> new FMWorldGenProvider(output, registries));
pack.addProvider(output -> new WorldGenProvider(output, registries));

// LOOT TABLE
pack.addProvider(bindRegistries(FMLootTableProvider::new, registries));
Expand All @@ -51,9 +53,6 @@ public static void gather (GatherDataEvent event) {
pack.addProvider(pOutput -> new BlockModelProvider(pOutput, existingFileHelper));
pack.addProvider(pOutput -> new FMItemModelProvider(pOutput, existingFileHelper));

// MISC
//pack.addProvider(pOutput -> new AdvancementProvider(pOutput, registries, existingFileHelper, List.of(new FMAdvancementProvider())));

// RECIPES
pack.addProvider(bindRegistries(CraftingRecipes::new, registries));
pack.addProvider(bindRegistries(SmeltingRecipes::new, registries));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,10 @@
import net.minecraft.advancements.critereon.*;
import net.minecraft.core.HolderLookup;
import net.minecraft.data.PackOutput;
import net.minecraft.data.advancements.AdvancementSubProvider;
import net.minecraft.network.chat.Component;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.world.entity.EntityType;
import net.minecraft.world.entity.animal.Animal;
import net.minecraft.world.entity.animal.Chicken;
import net.minecraft.world.item.Items;
import net.neoforged.neoforge.common.data.AdvancementProvider;
import net.neoforged.neoforge.common.data.ExistingFileHelper;
import net.superscary.fluxmachines.core.FluxMachines;
Expand All @@ -24,6 +22,7 @@
import java.util.concurrent.CompletableFuture;
import java.util.function.Consumer;

import static net.superscary.fluxmachines.registries.FMItems.DURACITE_INGOT;
import static net.superscary.fluxmachines.registries.FMItems.HARD_BOILED_EGG;

public class AchievementProvider extends AdvancementProvider {
Expand All @@ -43,6 +42,7 @@ public void generate (HolderLookup.@NotNull Provider provider, @NotNull Consumer

Advancement.Builder builder = Advancement.Builder.advancement();
buildDontFeedThatToAChicken(parent, builder, consumer, existingFileHelper);
buildStrongerThanIron(parent, builder, consumer, existingFileHelper);
}

private static void buildParents (Consumer<AdvancementHolder> consumer, ExistingFileHelper existingFileHelper) {
Expand All @@ -61,7 +61,7 @@ private static void buildParents (Consumer<AdvancementHolder> consumer, Existing
.save(consumer, FluxMachines.getResource("advancements/root"), existingFileHelper);

parent = Advancement.Builder.advancement()
.display(FMItems.DURACITE_INGOT,
.display(Items.MAP,
Component.translatable("advancement.fluxmachines.newworld.title"),
Component.translatable("advancement.fluxmachines.newworld.desc"),
null,
Expand All @@ -78,6 +78,7 @@ private static void buildParents (Consumer<AdvancementHolder> consumer, Existing

/**
* I honestly only made this as a test. But I'm leaving it in because it's kind of funny?
*
* @param builder
* @param consumer
* @param existingFileHelper
Expand All @@ -91,14 +92,30 @@ private static void buildDontFeedThatToAChicken (AdvancementHolder parent, Advan
AdvancementType.GOAL,
true,
true,
false);
true);

builder.addCriterion("feed_chicken", PlayerInteractTrigger.TriggerInstance.itemUsedOnEntity(ItemPredicate.Builder.item().of(HARD_BOILED_EGG),
Optional.of(EntityPredicate.wrap(EntityPredicate.Builder.entity().of(EntityType.CHICKEN)))));
builder.requirements(AdvancementRequirements.allOf(List.of("feed_chicken")));
builder.requirements(AdvancementRequirements.Strategy.OR);
builder.addCriterion("feed_chicken_hbe", PlayerInteractTrigger.TriggerInstance.itemUsedOnEntity(ItemPredicate.Builder.item().of(HARD_BOILED_EGG), Optional.of(EntityPredicate.wrap(EntityPredicate.Builder.entity().of(EntityType.CHICKEN)))));
builder.addCriterion("feed_chicken_chicken", PlayerInteractTrigger.TriggerInstance.itemUsedOnEntity(ItemPredicate.Builder.item().of(Items.COOKED_CHICKEN), Optional.of(EntityPredicate.wrap(EntityPredicate.Builder.entity().of(EntityType.CHICKEN)))));
builder.addCriterion("feed_chicken_raw_chicken", PlayerInteractTrigger.TriggerInstance.itemUsedOnEntity(ItemPredicate.Builder.item().of(Items.CHICKEN), Optional.of(EntityPredicate.wrap(EntityPredicate.Builder.entity().of(EntityType.CHICKEN)))));
builder.save(consumer, FluxMachines.getResource("advancements/dont_feed_that_to_a_chicken"), existingFileHelper);
}

private static void buildStrongerThanIron (AdvancementHolder parent, Advancement.Builder builder, Consumer<AdvancementHolder> consumer, ExistingFileHelper existingFileHelper) {
builder.parent(parent);
builder.display(DURACITE_INGOT.stack(),
Component.translatable("advancement.fluxmachines.strongerthaniron.title"),
Component.translatable("advancement.fluxmachines.strongerthaniron.desc"),
null,
AdvancementType.TASK,
true,
true,
false);
builder.requirements(AdvancementRequirements.Strategy.OR);
builder.addCriterion("obtain_duracite_ingot", InventoryChangeTrigger.TriggerInstance.hasItems(ItemPredicate.Builder.item().of(DURACITE_INGOT)));
builder.save(consumer, FluxMachines.getResource("advancements/stronger_than_iron"), existingFileHelper);
}

}

}
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,14 @@ protected void items () {
add(DURACITE_CHESTPLATE.asItem(), "Duracite Chestplate");
add(DURACITE_LEGGINGS.asItem(), "Duracite Leggings");
add(DURACITE_BOOTS.asItem(), "Duracite Boots");
add(DURACITE_SWORD.asItem(), "Duracite Sword");
add(DURACITE_PICKAXE.asItem(), "Duracite Pickaxe");
add(DURACITE_SHOVEL.asItem(), "Duracite Shovel");
add(DURACITE_AXE.asItem(), "Duracite Axe");
add(DURACITE_HOE.asItem(), "Duracite Hoe");
add(DURACITE_PAXEL.asItem(), "Duracite Paxel");
add(DURACITE_HAMMER.asItem(), "Duracite Hammer");

add(HONEY_BUN.asItem(), "Honey Bun");
add(HARD_BOILED_EGG.asItem(), "Hard Boiled Egg");
}
Expand All @@ -51,6 +59,11 @@ protected void misc () {
add("advancement.fluxmachines.newworld.desc", "It's ok to close your eyes.");
add("advancement.fluxmachines.why.title", "Why would you do that?");
add("advancement.fluxmachines.why.desc", "You aren't Eduardo Saverin.");
add("advancement.fluxmachines.strongerthaniron.title", "Stronger Than Iron");
add("advancement.fluxmachines.strongerthaniron.desc", "Heavier too...");

add("armor.status.effect.tooltip", "§7§nFull Set Status Effect:§r");
add("armor.status.effect.kb2.tooltip", "§8- Knockback II§r");
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -47,12 +47,20 @@ private static ResourceLocation makeId (String id) {

@Override
protected void registerModels () {
flatSingleLayer(RAW_DURACITE, "item/duracite_raw");
flatSingleLayer(DURACITE_DUST, "item/duracite_dust");
flatSingleLayer(DURACITE_INGOT, "item/duracite_ingot");
flatSingleLayer(DURACITE_NUGGET, "item/duracite_nugget");
flatSingleLayer(HONEY_BUN, "item/honey_bun");
flatSingleLayer(HARD_BOILED_EGG, "item/hard_boiled_egg");
handheldItem(RAW_DURACITE.asItem());
handheldItem(DURACITE_DUST.asItem());
handheldItem(DURACITE_INGOT.asItem());
handheldItem(DURACITE_NUGGET.asItem());
handheldItem(DURACITE_SWORD.asItem());
handheldItem(DURACITE_PICKAXE.asItem());
handheldItem(DURACITE_SHOVEL.asItem());
handheldItem(DURACITE_AXE.asItem());
handheldItem(DURACITE_HOE.asItem());
handheldItem(DURACITE_PAXEL.asItem());
handheldItem(DURACITE_HAMMER.asItem());

basicItem(HONEY_BUN.asItem());
basicItem(HARD_BOILED_EGG.asItem());

trimmedArmorItem(DURACITE_HELMET);
trimmedArmorItem(DURACITE_CHESTPLATE);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@

import java.util.concurrent.CompletableFuture;

import static net.superscary.fluxmachines.registries.FMBlocks.DURACITE_BLOCK;
import static net.superscary.fluxmachines.registries.FMBlocks.DURACITE_BLOCK_RAW;
import static net.superscary.fluxmachines.registries.FMBlocks.*;
import static net.superscary.fluxmachines.registries.FMBlocks.DURACITE_DEEPSLATE_ORE;
import static net.superscary.fluxmachines.registries.FMItems.DURACITE_DUST;
import static net.superscary.fluxmachines.registries.FMItems.RAW_DURACITE;

Expand All @@ -27,7 +27,7 @@ public BlastingRecipes (PackOutput packOutput, CompletableFuture<HolderLookup.Pr
}

@Override
public String getName () {
public @NotNull String getName () {
return "FluxMachines Blasting Recipes";
}

Expand All @@ -38,6 +38,21 @@ public void buildRecipes(@NotNull RecipeOutput consumer) {
.unlockedBy("has_duracite_raw", has(RAW_DURACITE))
.save(consumer, FluxMachines.getResource("blasting/duracite_from_raw_duracite"));

SimpleCookingRecipeBuilder
.blasting(Ingredient.of(DURACITE_ORE), RecipeCategory.MISC, FMItems.DURACITE_INGOT, .35f, DEFAULT_BLASTING_TIME)
.unlockedBy("has_duracite_ore", has(DURACITE_ORE))
.save(consumer, FluxMachines.getResource("blasting/duracite_from_duracite_ore"));

SimpleCookingRecipeBuilder
.blasting(Ingredient.of(DURACITE_NETHER_ORE), RecipeCategory.MISC, FMItems.DURACITE_INGOT, .35f, DEFAULT_BLASTING_TIME)
.unlockedBy("has_duracite_ore", has(DURACITE_NETHER_ORE))
.save(consumer, FluxMachines.getResource("blasting/duracite_from_duracite_nether_ore"));

SimpleCookingRecipeBuilder
.blasting(Ingredient.of(DURACITE_DEEPSLATE_ORE), RecipeCategory.MISC, FMItems.DURACITE_INGOT, .35f, DEFAULT_BLASTING_TIME)
.unlockedBy("has_duracite_ore", has(DURACITE_DEEPSLATE_ORE))
.save(consumer, FluxMachines.getResource("blasting/duracite_from_duracite_deepslate_ore"));

SimpleCookingRecipeBuilder
.blasting(Ingredient.of(DURACITE_DUST), RecipeCategory.MISC, new ItemStack(FMItems.DURACITE_INGOT, 2), .35f, DEFAULT_BLASTING_TIME)
.unlockedBy("has_duracite_dust", has(DURACITE_DUST))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,77 @@ protected void duraciteRecipes (RecipeOutput consumer) {
.unlockedBy("has_duracite_ingot", has(DURACITE_INGOT))
.save(consumer, FluxMachines.getResource("armor/duracite_boots"));

/*
* TOOLS
*/
ShapedRecipeBuilder.shaped(RecipeCategory.COMBAT, DURACITE_SWORD, 1)
.pattern("D")
.pattern("D")
.pattern("S")
.define('D', DURACITE_INGOT)
.define('S', Items.STICK)
.unlockedBy("has_duracite_ingot", has(DURACITE_INGOT))
.save(consumer, FluxMachines.getResource("tool/duracite_sword"));

ShapedRecipeBuilder.shaped(RecipeCategory.TOOLS, DURACITE_PICKAXE, 1)
.pattern("DDD")
.pattern(" S ")
.pattern(" S ")
.define('D', DURACITE_INGOT)
.define('S', Items.STICK)
.unlockedBy("has_duracite_ingot", has(DURACITE_INGOT))
.save(consumer, FluxMachines.getResource("tool/duracite_pickaxe"));

ShapedRecipeBuilder.shaped(RecipeCategory.TOOLS, DURACITE_SHOVEL, 1)
.pattern("D")
.pattern("S")
.pattern("S")
.define('D', DURACITE_INGOT)
.define('S', Items.STICK)
.unlockedBy("has_duracite_ingot", has(DURACITE_INGOT))
.save(consumer, FluxMachines.getResource("tool/duracite_shovel"));

ShapedRecipeBuilder.shaped(RecipeCategory.TOOLS, DURACITE_AXE, 1)
.pattern("DD")
.pattern("DS")
.pattern(" S")
.define('D', DURACITE_INGOT)
.define('S', Items.STICK)
.unlockedBy("has_duracite_ingot", has(DURACITE_INGOT))
.save(consumer, FluxMachines.getResource("tool/duracite_axe"));

ShapedRecipeBuilder.shaped(RecipeCategory.TOOLS, DURACITE_HOE, 1)
.pattern("DD")
.pattern(" S")
.pattern(" S")
.define('D', DURACITE_INGOT)
.define('S', Items.STICK)
.unlockedBy("has_duracite_ingot", has(DURACITE_INGOT))
.save(consumer, FluxMachines.getResource("tool/duracite_hoe"));

ShapedRecipeBuilder.shaped(RecipeCategory.TOOLS, DURACITE_PAXEL, 1)
.pattern("PAQ")
.pattern(" S ")
.pattern(" S ")
.define('P', DURACITE_PICKAXE)
.define('A', DURACITE_AXE)
.define('Q', DURACITE_SHOVEL)
.define('S', Items.STICK)
.unlockedBy("has_duracite_pickaxe", has(DURACITE_PICKAXE))
.unlockedBy("has_duracite_axe", has(DURACITE_AXE))
.unlockedBy("has_duracite_shovel", has(DURACITE_SHOVEL))
.save(consumer, FluxMachines.getResource("tool/duracite_paxel"));

ShapedRecipeBuilder.shaped(RecipeCategory.TOOLS, DURACITE_HAMMER, 1)
.pattern("DdD")
.pattern(" S ")
.pattern(" S ")
.define('D', DURACITE_BLOCK)
.define('d', DURACITE_INGOT)
.define('S', Items.STICK)
.unlockedBy("has_duracite_block", has(DURACITE_BLOCK))
.unlockedBy("has_duracite_ingot", has(DURACITE_INGOT))
.save(consumer, FluxMachines.getResource("tool/duracite_hammer"));
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,7 @@

import java.util.concurrent.CompletableFuture;

import static net.superscary.fluxmachines.registries.FMBlocks.DURACITE_BLOCK;
import static net.superscary.fluxmachines.registries.FMBlocks.DURACITE_BLOCK_RAW;
import static net.superscary.fluxmachines.registries.FMBlocks.*;
import static net.superscary.fluxmachines.registries.FMItems.*;

public class SmeltingRecipes extends FMRecipeProvider {
Expand All @@ -29,7 +28,7 @@ public SmeltingRecipes (PackOutput packOutput, CompletableFuture<HolderLookup.Pr
}

@Override
public String getName () {
public @NotNull String getName () {
return "FluxMachines Smelting Recipes";
}

Expand All @@ -40,6 +39,21 @@ public void buildRecipes(@NotNull RecipeOutput consumer) {
.unlockedBy("has_duracite_raw", has(RAW_DURACITE))
.save(consumer, FluxMachines.getResource("smelting/duracite_from_raw_duracite"));

SimpleCookingRecipeBuilder
.smelting(Ingredient.of(DURACITE_ORE), RecipeCategory.MISC, FMItems.DURACITE_INGOT, .35f, DEFAULT_SMELTING_TIME)
.unlockedBy("has_duracite_ore", has(DURACITE_ORE))
.save(consumer, FluxMachines.getResource("smelting/duracite_from_duracite_ore"));

SimpleCookingRecipeBuilder
.smelting(Ingredient.of(DURACITE_NETHER_ORE), RecipeCategory.MISC, FMItems.DURACITE_INGOT, .35f, DEFAULT_SMELTING_TIME)
.unlockedBy("has_duracite_ore", has(DURACITE_NETHER_ORE))
.save(consumer, FluxMachines.getResource("smelting/duracite_from_duracite_nether_ore"));

SimpleCookingRecipeBuilder
.smelting(Ingredient.of(DURACITE_DEEPSLATE_ORE), RecipeCategory.MISC, FMItems.DURACITE_INGOT, .35f, DEFAULT_SMELTING_TIME)
.unlockedBy("has_duracite_ore", has(DURACITE_DEEPSLATE_ORE))
.save(consumer, FluxMachines.getResource("smelting/duracite_from_duracite_deepslate_ore"));

SimpleCookingRecipeBuilder
.smelting(Ingredient.of(DURACITE_DUST), RecipeCategory.MISC, new ItemStack(FMItems.DURACITE_INGOT, 2), .35f, DEFAULT_SMELTING_TIME)
.unlockedBy("has_duracite_dust", has(DURACITE_DUST))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,12 @@
import net.minecraft.core.HolderLookup;
import net.minecraft.data.PackOutput;
import net.minecraft.tags.BlockTags;
import net.neoforged.neoforge.common.Tags;
import net.neoforged.neoforge.common.data.BlockTagsProvider;
import net.neoforged.neoforge.common.data.ExistingFileHelper;
import net.superscary.fluxmachines.api.data.IDataProvider;
import net.superscary.fluxmachines.core.FluxMachines;
import net.superscary.fluxmachines.util.tags.FMTag;
import org.jetbrains.annotations.NotNull;

import javax.annotation.Nullable;
Expand All @@ -30,13 +32,30 @@ protected void addTags (HolderLookup.@NotNull Provider provider) {
.add(DURACITE_BLOCK_RAW.block())
.add(DURACITE_BLOCK.block());

this.tag(Tags.Blocks.ORES)
.add(DURACITE_ORE.block())
.add(DURACITE_DEEPSLATE_ORE.block())
.add(DURACITE_NETHER_ORE.block());

this.tag(BlockTags.NEEDS_STONE_TOOL)
.add(MACHINE_CASING.block())
.add(DURACITE_ORE.block())
.add(DURACITE_NETHER_ORE.block())
.add(DURACITE_DEEPSLATE_ORE.block())
.add(DURACITE_BLOCK_RAW.block())
.add(DURACITE_BLOCK.block());

this.tag(FMTag.Blocks.NEEDS_DURACITE_TOOL)
.addTag(BlockTags.NEEDS_IRON_TOOL);

this.tag(FMTag.Blocks.INCORRECT_FOR_DURACITE_TOOL)
.addTag(BlockTags.INCORRECT_FOR_STONE_TOOL).remove(FMTag.Blocks.NEEDS_DURACITE_TOOL);

this.tag(FMTag.Blocks.PAXEL_MINEABLE)
.addTag(BlockTags.MINEABLE_WITH_PICKAXE)
.addTag(BlockTags.MINEABLE_WITH_AXE)
.addTag(BlockTags.MINEABLE_WITH_SHOVEL);

}

}
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,15 @@
import net.minecraft.core.HolderLookup;
import net.minecraft.data.PackOutput;
import net.minecraft.data.tags.ItemTagsProvider;
import net.minecraft.tags.BlockTags;
import net.minecraft.tags.ItemTags;
import net.minecraft.world.level.block.Block;
import net.neoforged.neoforge.common.Tags;
import net.neoforged.neoforge.common.data.ExistingFileHelper;
import net.superscary.fluxmachines.api.data.IDataProvider;
import net.superscary.fluxmachines.core.FluxMachines;
import net.superscary.fluxmachines.registries.FMItems;
import net.superscary.fluxmachines.util.tags.FMTag;
import org.jetbrains.annotations.NotNull;

import javax.annotation.Nullable;
Expand Down
Loading

0 comments on commit f8cbf1c

Please sign in to comment.