From f88aac11e99a437e4016b4080f74e9ce787f1c41 Mon Sep 17 00:00:00 2001 From: Electroblob <35599699+Electroblob77@users.noreply.github.com> Date: Tue, 5 Jun 2018 15:43:14 +0100 Subject: [PATCH] Convert all non-dynamic recipes to JSON, add ore dictionary support where appropriate and change incorrect "amount" tag to "count", fixes #18 --- .../wizardry/registry/WizardryRegistry.java | 49 ++----------------- .../ebwizardry/recipes/arcane_workbench.json | 6 ++- .../ebwizardry/recipes/blank_scroll.json | 14 ++++++ ...al.json => crystal_block_to_crystals.json} | 3 +- .../recipes/crystal_flower_to_crystals.json | 13 +++++ .../assets/ebwizardry/recipes/firebomb.json | 21 ++++++++ .../recipes/magic_missile_spell_book.json | 20 ++++++++ .../assets/ebwizardry/recipes/magic_wand.json | 24 +++++++++ .../ebwizardry/recipes/poison_bomb.json | 21 ++++++++ .../assets/ebwizardry/recipes/smoke_bomb.json | 21 ++++++++ 10 files changed, 144 insertions(+), 48 deletions(-) create mode 100644 src/main/resources/assets/ebwizardry/recipes/blank_scroll.json rename src/main/resources/assets/ebwizardry/recipes/{magic_crystal.json => crystal_block_to_crystals.json} (81%) create mode 100644 src/main/resources/assets/ebwizardry/recipes/crystal_flower_to_crystals.json create mode 100644 src/main/resources/assets/ebwizardry/recipes/firebomb.json create mode 100644 src/main/resources/assets/ebwizardry/recipes/magic_missile_spell_book.json create mode 100644 src/main/resources/assets/ebwizardry/recipes/magic_wand.json create mode 100644 src/main/resources/assets/ebwizardry/recipes/poison_bomb.json create mode 100644 src/main/resources/assets/ebwizardry/recipes/smoke_bomb.json diff --git a/src/main/java/electroblob/wizardry/registry/WizardryRegistry.java b/src/main/java/electroblob/wizardry/registry/WizardryRegistry.java index e7a3aee7..62f863f4 100644 --- a/src/main/java/electroblob/wizardry/registry/WizardryRegistry.java +++ b/src/main/java/electroblob/wizardry/registry/WizardryRegistry.java @@ -73,12 +73,10 @@ import electroblob.wizardry.util.WizardryUtilities; import net.minecraft.entity.Entity; import net.minecraft.entity.EnumCreatureType; import net.minecraft.init.Biomes; -import net.minecraft.init.Items; import net.minecraft.inventory.EntityEquipmentSlot; import net.minecraft.item.ItemStack; import net.minecraft.item.crafting.FurnaceRecipes; import net.minecraft.item.crafting.IRecipe; -import net.minecraft.item.crafting.Ingredient; import net.minecraft.util.ResourceLocation; import net.minecraft.world.biome.Biome; import net.minecraft.world.storage.loot.LootTableList; @@ -90,7 +88,6 @@ import net.minecraftforge.fml.common.registry.EntityRegistry; import net.minecraftforge.fml.common.registry.ForgeRegistries; import net.minecraftforge.fml.common.registry.GameRegistry; import net.minecraftforge.oredict.OreDictionary; -import net.minecraftforge.oredict.ShapedOreRecipe; import net.minecraftforge.oredict.ShapelessOreRecipe; import net.minecraftforge.registries.IForgeRegistry; @@ -246,55 +243,18 @@ public final class WizardryRegistry { EntityRegistry.registerEgg(registryName, eggColour, spotColour); } - /** Called from the init method in the main mod class to register all the recipes. */ + /** Now only deals with the dynamic crafting recipes and the smelting recipes. */ @SubscribeEvent public static void registerRecipes(RegistryEvent.Register event){ IForgeRegistry registry = event.getRegistry(); - - ItemStack magicCrystalStack = new ItemStack(WizardryItems.magic_crystal); - ItemStack magicWandStack = new ItemStack(WizardryItems.magic_wand, 1, Tier.BASIC.maxCharge); - ItemStack goldNuggetStack = new ItemStack(Items.GOLD_NUGGET); - ItemStack stickStack = new ItemStack(Items.STICK); - ItemStack bookStack = new ItemStack(Items.BOOK); - ItemStack spellBookStack = new ItemStack(WizardryItems.spell_book, 1, Spells.magic_missile.id()); - Ingredient crystalFlowerStack = Ingredient.fromStacks(new ItemStack(WizardryBlocks.crystal_flower)); - ItemStack magicCrystalStack1 = new ItemStack(WizardryItems.magic_crystal, 2); - ItemStack magicCrystalStack2 = new ItemStack(WizardryItems.magic_crystal, 9); - Ingredient crystalBlockStack = Ingredient.fromStacks(new ItemStack(WizardryBlocks.crystal_block)); - ItemStack manaFlaskStack = new ItemStack(WizardryItems.mana_flask); - Ingredient bottleStack = Ingredient.fromStacks(new ItemStack(Items.GLASS_BOTTLE)); - Ingredient gunpowderStack = Ingredient.fromStacks(new ItemStack(Items.GUNPOWDER)); - Ingredient blazePowderStack = Ingredient.fromStacks(new ItemStack(Items.BLAZE_POWDER)); - Ingredient spiderEyeStack = Ingredient.fromStacks(new ItemStack(Items.SPIDER_EYE)); - // Coal or charcoal is equally fine, hence the wildcard value - Ingredient coalStack = Ingredient.fromStacks(new ItemStack(Items.COAL, 1, OreDictionary.WILDCARD_VALUE)); - ItemStack firebombStack = new ItemStack(WizardryItems.firebomb, 3); - ItemStack poisonBombStack = new ItemStack(WizardryItems.poison_bomb, 3); - ItemStack smokeBombStack = new ItemStack(WizardryItems.smoke_bomb, 3); - ItemStack scrollStack = new ItemStack(WizardryItems.blank_scroll); - Ingredient paperStack = Ingredient.fromStacks(new ItemStack(Items.PAPER)); - Ingredient stringStack = Ingredient.fromStacks(new ItemStack(Items.STRING)); - - registry.register(new ShapedOreRecipe(null, magicWandStack, " x", " y ", "z ", 'x', magicCrystalStack, 'y', stickStack, 'z', goldNuggetStack).setRegistryName(new ResourceLocation(Wizardry.MODID, "recipes/magic_wand"))); - registry.register(new ShapedOreRecipe(null, spellBookStack, " x ", "xyx", " x ", 'x', magicCrystalStack, 'y', bookStack).setRegistryName(new ResourceLocation(Wizardry.MODID, "recipes/spellbook"))); - - registry.register(new ShapelessOreRecipe(null, magicCrystalStack1, crystalFlowerStack).setRegistryName(new ResourceLocation(Wizardry.MODID, "recipes/magic_crystal_1"))); - registry.register(new ShapelessOreRecipe(null, magicCrystalStack2, crystalBlockStack).setRegistryName(new ResourceLocation(Wizardry.MODID, "recipes/magic_crystal_2"))); - - if(Wizardry.settings.firebombIsCraftable) registry.register(new ShapelessOreRecipe(null, firebombStack, bottleStack, gunpowderStack, blazePowderStack, blazePowderStack).setRegistryName(new ResourceLocation(Wizardry.MODID, "recipes/fire_bomb"))); - if(Wizardry.settings.poisonBombIsCraftable) registry.register(new ShapelessOreRecipe(null, poisonBombStack, bottleStack, gunpowderStack, spiderEyeStack, spiderEyeStack).setRegistryName(new ResourceLocation(Wizardry.MODID, "recipes/poison_bomb"))); - if(Wizardry.settings.smokeBombIsCraftable) registry.register(new ShapelessOreRecipe(null, smokeBombStack, bottleStack, gunpowderStack, coalStack, coalStack).setRegistryName(new ResourceLocation(Wizardry.MODID, "recipes/smoke_bomb"))); - - if(Wizardry.settings.useAlternateScrollRecipe){ - registry.register(new ShapelessOreRecipe(null, scrollStack, paperStack, stringStack, magicCrystalStack).setRegistryName(new ResourceLocation(Wizardry.MODID, "recipes/blank_scroll"))); - }else{ - registry.register(new ShapelessOreRecipe(null, scrollStack, paperStack, stringStack).setRegistryName(new ResourceLocation(Wizardry.MODID, "recipes/blank_scroll"))); - } FurnaceRecipes.instance().addSmeltingRecipeForBlock(WizardryBlocks.crystal_ore, new ItemStack(WizardryItems.magic_crystal), 0.5f); // Mana flask recipes + + ItemStack manaFlaskStack = new ItemStack(WizardryItems.mana_flask); + ItemStack miscWandStack; for(Element element : Element.values()){ @@ -306,7 +266,6 @@ public final class WizardryRegistry { } } - ItemStack miscArmourStack; for(Element element : Element.values()){ diff --git a/src/main/resources/assets/ebwizardry/recipes/arcane_workbench.json b/src/main/resources/assets/ebwizardry/recipes/arcane_workbench.json index ebae46d1..6727cb0c 100644 --- a/src/main/resources/assets/ebwizardry/recipes/arcane_workbench.json +++ b/src/main/resources/assets/ebwizardry/recipes/arcane_workbench.json @@ -7,7 +7,8 @@ ], "key": { "v": { - "item": "minecraft:gold_nugget" + "type": "forge:ore_dict", + "ore": "nuggetGold" }, "w": { "item": "minecraft:carpet", @@ -17,7 +18,8 @@ "item": "ebwizardry:magic_crystal" }, "y": { - "item": "minecraft:lapis_block" + "type": "forge:ore_dict", + "ore": "blockLapis" }, "z": { "type": "forge:ore_dict", diff --git a/src/main/resources/assets/ebwizardry/recipes/blank_scroll.json b/src/main/resources/assets/ebwizardry/recipes/blank_scroll.json new file mode 100644 index 00000000..ebf381a7 --- /dev/null +++ b/src/main/resources/assets/ebwizardry/recipes/blank_scroll.json @@ -0,0 +1,14 @@ +{ + "type": "minecraft:crafting_shapeless", + "ingredients": [ + { + "item": "minecraft:paper" + }, + { + "item": "minecraft:string" + } + ], + "result": { + "item": "ebwizardry:blank_scroll" + } +} \ No newline at end of file diff --git a/src/main/resources/assets/ebwizardry/recipes/magic_crystal.json b/src/main/resources/assets/ebwizardry/recipes/crystal_block_to_crystals.json similarity index 81% rename from src/main/resources/assets/ebwizardry/recipes/magic_crystal.json rename to src/main/resources/assets/ebwizardry/recipes/crystal_block_to_crystals.json index 28effaf4..488efbac 100644 --- a/src/main/resources/assets/ebwizardry/recipes/magic_crystal.json +++ b/src/main/resources/assets/ebwizardry/recipes/crystal_block_to_crystals.json @@ -1,5 +1,6 @@ { "type": "minecraft:crafting_shapeless", + "group": "magic_crystal", "ingredients": [ { "item": "ebwizardry:crystal_block" @@ -7,6 +8,6 @@ ], "result": { "item": "ebwizardry:magic_crystal", - "amount": 9 + "count": 9 } } \ No newline at end of file diff --git a/src/main/resources/assets/ebwizardry/recipes/crystal_flower_to_crystals.json b/src/main/resources/assets/ebwizardry/recipes/crystal_flower_to_crystals.json new file mode 100644 index 00000000..2ba98699 --- /dev/null +++ b/src/main/resources/assets/ebwizardry/recipes/crystal_flower_to_crystals.json @@ -0,0 +1,13 @@ +{ + "type": "minecraft:crafting_shapeless", + "group": "magic_crystal", + "ingredients": [ + { + "item": "ebwizardry:crystal_flower" + } + ], + "result": { + "item": "ebwizardry:magic_crystal", + "count": 2 + } +} \ No newline at end of file diff --git a/src/main/resources/assets/ebwizardry/recipes/firebomb.json b/src/main/resources/assets/ebwizardry/recipes/firebomb.json new file mode 100644 index 00000000..5b7ece0b --- /dev/null +++ b/src/main/resources/assets/ebwizardry/recipes/firebomb.json @@ -0,0 +1,21 @@ +{ + "type": "minecraft:crafting_shapeless", + "ingredients": [ + { + "item": "minecraft:blaze_powder" + }, + { + "item": "minecraft:blaze_powder" + }, + { + "item": "minecraft:glass_bottle" + }, + { + "item": "minecraft:gunpowder" + } + ], + "result": { + "item": "ebwizardry:firebomb", + "count": 3 + } +} \ No newline at end of file diff --git a/src/main/resources/assets/ebwizardry/recipes/magic_missile_spell_book.json b/src/main/resources/assets/ebwizardry/recipes/magic_missile_spell_book.json new file mode 100644 index 00000000..b366af36 --- /dev/null +++ b/src/main/resources/assets/ebwizardry/recipes/magic_missile_spell_book.json @@ -0,0 +1,20 @@ +{ + "type": "minecraft:crafting_shaped", + "pattern": [ + " x ", + "xyx", + " x " + ], + "key": { + "x": { + "item": "ebwizardry:magic_crystal" + }, + "y": { + "item": "minecraft:book" + } + }, + "result": { + "item": "ebwizardry:spell_book", + "data": 1 + } +} \ No newline at end of file diff --git a/src/main/resources/assets/ebwizardry/recipes/magic_wand.json b/src/main/resources/assets/ebwizardry/recipes/magic_wand.json new file mode 100644 index 00000000..ab8988a1 --- /dev/null +++ b/src/main/resources/assets/ebwizardry/recipes/magic_wand.json @@ -0,0 +1,24 @@ +{ + "type": "forge:ore_shaped", + "pattern": [ + " z", + " y ", + "x " + ], + "key": { + "x": { + "type": "forge:ore_dict", + "ore": "nuggetGold" + }, + "y": { + "type": "forge:ore_dict", + "ore": "stickWood" + }, + "z": { + "item": "ebwizardry:magic_crystal" + } + }, + "result": { + "item": "ebwizardry:magic_wand" + } +} \ No newline at end of file diff --git a/src/main/resources/assets/ebwizardry/recipes/poison_bomb.json b/src/main/resources/assets/ebwizardry/recipes/poison_bomb.json new file mode 100644 index 00000000..17bfa14d --- /dev/null +++ b/src/main/resources/assets/ebwizardry/recipes/poison_bomb.json @@ -0,0 +1,21 @@ +{ + "type": "minecraft:crafting_shapeless", + "ingredients": [ + { + "item": "minecraft:spider_eye" + }, + { + "item": "minecraft:spider_eye" + }, + { + "item": "minecraft:glass_bottle" + }, + { + "item": "minecraft:gunpowder" + } + ], + "result": { + "item": "ebwizardry:poison_bomb", + "count": 3 + } +} \ No newline at end of file diff --git a/src/main/resources/assets/ebwizardry/recipes/smoke_bomb.json b/src/main/resources/assets/ebwizardry/recipes/smoke_bomb.json new file mode 100644 index 00000000..c8a88683 --- /dev/null +++ b/src/main/resources/assets/ebwizardry/recipes/smoke_bomb.json @@ -0,0 +1,21 @@ +{ + "type": "minecraft:crafting_shapeless", + "ingredients": [ + { + "item": "minecraft:coal" + }, + { + "item": "minecraft:coal" + }, + { + "item": "minecraft:glass_bottle" + }, + { + "item": "minecraft:gunpowder" + } + ], + "result": { + "item": "ebwizardry:smoke_bomb", + "count": 3 + } +} \ No newline at end of file