Advertisement
jayhillx

[Advanced Combat] ACRecipeProvider

Dec 31st, 2021
1,427
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 9.15 KB | None | 0 0
  1. package com.advancedcombat.common.data;
  2.  
  3. import com.advancedcombat.init.ACItems;
  4. import net.minecraft.data.*;
  5. import net.minecraft.item.Items;
  6. import net.minecraft.tags.ItemTags;
  7. import net.minecraft.util.IItemProvider;
  8.  
  9. import javax.annotation.Nonnull;
  10. import java.util.function.Consumer;
  11.  
  12. public class ACRecipeProvider extends RecipeProvider {
  13.  
  14.     public ACRecipeProvider(DataGenerator generator) {
  15.         super(generator);
  16.     }
  17.  
  18.     @Override
  19.     protected void buildShapelessRecipes(@Nonnull Consumer<IFinishedRecipe> consumer) {
  20.         ShapedRecipeBuilder.shaped(ACItems.advanced_stone.get()).pattern("IXI").pattern("XIX").pattern("IXI").define('X', Items.STONE).define('I', Items.COBBLESTONE).unlockedBy("has_stone", has(Items.STONE)).save(consumer);
  21.         ShapedRecipeBuilder.shaped(ACItems.reinforced_obsidian.get()).pattern("IXI").pattern("XIX").pattern("IXI").define('X', ACItems.advanced_stone.get()).define('I', Items.OBSIDIAN).unlockedBy("has_stone", has(Items.STONE)).save(consumer);
  22.  
  23.         ShapedRecipeBuilder.shaped(ACItems.advanced_bow.get()).pattern("XIX").pattern("XAX").pattern("XIX").define('X', ItemTags.LOGS).define('I', Items.IRON_BLOCK).define('A', Items.BOW).unlockedBy("has_iron_block", has(Items.IRON_BLOCK)).save(consumer);
  24.         ShapedRecipeBuilder.shaped(ACItems.advanced_shield.get()).pattern("XIX").pattern("XAX").pattern("XIX").define('X', ItemTags.LOGS).define('I', Items.IRON_BLOCK).define('A', Items.SHIELD).unlockedBy("has_iron_block", has(Items.IRON_BLOCK)).save(consumer);
  25.  
  26.         ShapedRecipeBuilder.shaped(ACItems.wooden_helmet.get()).pattern("XXX").pattern("X X").define('X', ItemTags.LOGS).unlockedBy("has_log", has(ItemTags.LOGS)).save(consumer);
  27.         ShapedRecipeBuilder.shaped(ACItems.wooden_chestplate.get()).pattern("X X").pattern("XXX").pattern("XXX").define('X', ItemTags.LOGS).unlockedBy("has_log", has(ItemTags.LOGS)).save(consumer);
  28.         ShapedRecipeBuilder.shaped(ACItems.wooden_leggings.get()).pattern("XXX").pattern("X X").pattern("X X").define('X', ItemTags.LOGS).unlockedBy("has_log", has(ItemTags.LOGS)).save(consumer);
  29.         ShapedRecipeBuilder.shaped(ACItems.wooden_boots.get()).pattern("X X").pattern("X X").define('X', ItemTags.LOGS).unlockedBy("has_log", has(ItemTags.LOGS)).save(consumer);
  30.  
  31.         ShapedRecipeBuilder.shaped(ACItems.stone_helmet.get()).pattern("AXA").pattern("X X").define('X', Items.STONE).define('A', ACItems.advanced_stone.get()).unlockedBy("has_advanced_stone", has(ACItems.advanced_stone.get())).save(consumer);
  32.         ShapedRecipeBuilder.shaped(ACItems.stone_chestplate.get()).pattern("X X").pattern("XAX").pattern("XAX").define('X', Items.STONE).define('A', ACItems.advanced_stone.get()).unlockedBy("has_advanced_stone", has(ACItems.advanced_stone.get())).save(consumer);
  33.         ShapedRecipeBuilder.shaped(ACItems.stone_leggings.get()).pattern("AXA").pattern("X X").pattern("X X").define('X', Items.STONE).define('A', ACItems.advanced_stone.get()).unlockedBy("has_advanced_stone", has(ACItems.advanced_stone.get())).save(consumer);
  34.         ShapedRecipeBuilder.shaped(ACItems.stone_boots.get()).pattern("A A").pattern("X X").define('X', Items.STONE).define('A', ACItems.advanced_stone.get()).unlockedBy("has_advanced_stone", has(ACItems.advanced_stone.get())).save(consumer);
  35.  
  36.         ShapedRecipeBuilder.shaped(ACItems.obsidian_helmet.get()).pattern("AXA").pattern("X X").define('X', Items.OBSIDIAN).define('A', ACItems.reinforced_obsidian.get()).unlockedBy("has_reinforced_obsidian", has(ACItems.reinforced_obsidian.get())).save(consumer);
  37.         ShapedRecipeBuilder.shaped(ACItems.obsidian_chestplate.get()).pattern("X X").pattern("XAX").pattern("XAX").define('X', Items.OBSIDIAN).define('A', ACItems.reinforced_obsidian.get()).unlockedBy("has_reinforced_obsidian", has(ACItems.reinforced_obsidian.get())).save(consumer);
  38.         ShapedRecipeBuilder.shaped(ACItems.obsidian_leggings.get()).pattern("AXA").pattern("X X").pattern("X X").define('X', Items.OBSIDIAN).define('A', ACItems.reinforced_obsidian.get()).unlockedBy("has_reinforced_obsidian", has(ACItems.reinforced_obsidian.get())).save(consumer);
  39.         ShapedRecipeBuilder.shaped(ACItems.obsidian_boots.get()).pattern("A A").pattern("X X").define('X', Items.OBSIDIAN).define('A', ACItems.reinforced_obsidian.get()).unlockedBy("has_reinforced_obsidian", has(ACItems.reinforced_obsidian.get())).save(consumer);
  40.  
  41.         // Normal Upgrades
  42.         addTier1Upgrade(consumer, ACItems.sharpness_upgrade.get(), Items.FLINT, Items.IRON_SWORD);
  43.         addTier1Upgrade(consumer, ACItems.smite_upgrade.get(), Items.ROTTEN_FLESH, Items.BONE);
  44.         addTier1Upgrade(consumer, ACItems.bane_of_arthropods_upgrade.get(), Items.SPIDER_EYE, Items.STRING);
  45.         addTier1Upgrade(consumer, ACItems.knockback_upgrade.get(), Items.PISTON, Items.SLIME_BLOCK);
  46.         addTier1Upgrade(consumer, ACItems.fire_aspect_upgrade.get(), Items.FIRE_CHARGE, Items.COAL_BLOCK);
  47.         addTier1Upgrade(consumer, ACItems.looting_upgrade.get(), Items.GOLD_INGOT, Items.GOLDEN_SWORD);
  48.         addTier1Upgrade(consumer, ACItems.unbreaking_upgrade.get(), Items.OBSIDIAN, Items.DIAMOND_CHESTPLATE);
  49.         addTier1Upgrade(consumer, ACItems.mending_upgrade.get(), Items.ANVIL, Items.POPPED_CHORUS_FRUIT);
  50.         addTier1Upgrade(consumer, ACItems.protection_upgrade.get(), Items.LEATHER_CHESTPLATE, Items.SHIELD);
  51.         addTier1Upgrade(consumer, ACItems.fire_protection_upgrade.get(), Items.NETHER_BRICK, Items.FLINT_AND_STEEL);
  52.         addTier1Upgrade(consumer, ACItems.blast_protection_upgrade.get(), Items.OBSIDIAN, Items.TNT);
  53.         addTier1Upgrade(consumer, ACItems.projectile_protection_upgrade.get(), Items.ARROW, Items.BOW);
  54.         addTier1Upgrade(consumer, ACItems.feather_falling_upgrade.get(), Items.FEATHER, Items.HAY_BLOCK);
  55.         addTier1Upgrade(consumer, ACItems.respiration_upgrade.get(), Items.TROPICAL_FISH, Items.GLASS_BOTTLE);
  56.         addTier1Upgrade(consumer, ACItems.aqua_affinity_upgrade.get(), Items.TROPICAL_FISH, Items.IRON_PICKAXE);
  57.         addTier1Upgrade(consumer, ACItems.thorns_upgrade.get(), Items.CACTUS, Items.FLINT);
  58.         addTier1Upgrade(consumer, ACItems.depth_strider_upgrade.get(), Items.LEATHER_BOOTS, Items.WATER_BUCKET);
  59.         addTier1Upgrade(consumer, ACItems.frost_walker_upgrade.get(), Items.GOLDEN_BOOTS, Items.ICE);
  60.         addTier1Upgrade(consumer, ACItems.efficiency_upgrade.get(), Items.REDSTONE, Items.DIAMOND_PICKAXE);
  61.         addTier1Upgrade(consumer, ACItems.silk_touch_upgrade.get(), Items.STRING, Items.GOLDEN_PICKAXE);
  62.         addTier1Upgrade(consumer, ACItems.fortune_upgrade.get(), Items.DIAMOND, Items.GOLD_BLOCK);
  63.         addTier1Upgrade(consumer, ACItems.power_upgrade.get(), Items.ARROW, Items.FLINT);
  64.         addTier1Upgrade(consumer, ACItems.punch_upgrade.get(), Items.ARROW, Items.PISTON);
  65.         addTier1Upgrade(consumer, ACItems.flame_upgrade.get(), Items.BLAZE_ROD, Items.COAL_BLOCK);
  66.         addTier1Upgrade(consumer, ACItems.infinity_upgrade.get(), Items.BOW, Items.GOLDEN_APPLE);
  67.         addTier1Upgrade(consumer, ACItems.luck_of_the_sea_upgrade.get(), Items.FISHING_ROD, Items.RABBIT_FOOT);
  68.         addTier1Upgrade(consumer, ACItems.lure_upgrade.get(), Items.FISHING_ROD, Items.TROPICAL_FISH);
  69.  
  70.         ShapedRecipeBuilder.shaped(ACItems.advanced_wooden_sword.get()).pattern("XXX").pattern("XIX").pattern("XXX").define('X', ItemTags.LOGS).define('I', Items.WOODEN_SWORD).unlockedBy("has_wooden_sword", has(Items.WOODEN_SWORD)).save(consumer);
  71.         ShapedRecipeBuilder.shaped(ACItems.advanced_stone_sword.get()).pattern("XXX").pattern("XIX").pattern("XXX").define('X', ACItems.advanced_stone.get()).define('I', Items.STONE_SWORD).unlockedBy("has_advanced_stone", has(ACItems.advanced_stone.get())).save(consumer);
  72.         ShapedRecipeBuilder.shaped(ACItems.advanced_golden_sword.get()).pattern("XXX").pattern("XIX").pattern("XXX").define('X', Items.GOLD_BLOCK).define('I', Items.GOLDEN_SWORD).unlockedBy("has_golden_sword", has(Items.GOLDEN_SWORD)).save(consumer);
  73.         ShapedRecipeBuilder.shaped(ACItems.advanced_iron_sword.get()).pattern("XXX").pattern("XIX").pattern("XXX").define('X', Items.IRON_BLOCK).define('I', Items.IRON_SWORD).unlockedBy("has_iron_sword", has(Items.IRON_SWORD)).save(consumer);
  74.         ShapedRecipeBuilder.shaped(ACItems.advanced_emerald_sword.get()).pattern("XXX").pattern("XIX").pattern("XXX").define('X', Items.EMERALD_BLOCK).define('I', Items.GOLDEN_SWORD).unlockedBy("has_golden_sword", has(Items.GOLDEN_SWORD)).save(consumer);
  75.         ShapedRecipeBuilder.shaped(ACItems.advanced_diamond_sword.get()).pattern("XXX").pattern("XIX").pattern("XXX").define('X', Items.DIAMOND_BLOCK).define('I', Items.DIAMOND_SWORD).unlockedBy("has_diamond_sword", has(Items.DIAMOND_SWORD)).save(consumer);
  76.     }
  77.  
  78.     /** Base recipe for tier 1 & 2 enchantment upgrades. */
  79.     private static void addTier1Upgrade(Consumer<IFinishedRecipe> consumer, IItemProvider craftedItem, IItemProvider ingredientItem, IItemProvider ingredientItem2) {
  80.         craftedItem.asItem().getDefaultInstance().setDamageValue(1);
  81.  
  82.         ShapedRecipeBuilder.shaped(craftedItem).define('I', Items.PAPER).define('X', ingredientItem).define('A', ingredientItem2).pattern("IXI").pattern("XAX").pattern("IXI").unlockedBy("has_item", has(Items.PAPER)).save(consumer);
  83.     }
  84.  
  85. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement