diff --git a/src/main/java/com/minelittlepony/unicopia/enchanting/SpellRecipe.java b/src/main/java/com/minelittlepony/unicopia/enchanting/SpellRecipe.java index 605bb7e8..7c44587e 100644 --- a/src/main/java/com/minelittlepony/unicopia/enchanting/SpellRecipe.java +++ b/src/main/java/com/minelittlepony/unicopia/enchanting/SpellRecipe.java @@ -14,13 +14,16 @@ import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.item.crafting.IRecipe; import net.minecraft.util.NonNullList; +import net.minecraft.util.ResourceLocation; import net.minecraft.world.World; import net.minecraftforge.registries.IForgeRegistryEntry.Impl; public class SpellRecipe extends Impl implements IRecipe { - private String spellId; + private final ResourceLocation spellitem; + + private final String spellId; private final NonNullList ingredients; @@ -52,11 +55,17 @@ public class SpellRecipe extends Impl implements IRecipe { String spellId = json.get("spell").getAsString(); - return new SpellRecipe(spellId, ingredients); + Item spellitem = json.has("item") ? Item.getByNameOrId(json.get("item").getAsString()) : null; + if (spellitem == null) { + spellitem = UItems.spell; + } + + return new SpellRecipe(spellitem, spellId, ingredients); } - public SpellRecipe(String spellName, NonNullList ingredients) { - spellId = spellName; + public SpellRecipe(Item spellitem, String spellName, NonNullList ingredients) { + this.spellitem = spellitem.getRegistryName(); + this.spellId = spellName; this.ingredients = ingredients; } @@ -64,7 +73,11 @@ public class SpellRecipe extends Impl implements IRecipe { public boolean matches(InventoryCrafting inv, World worldIn) { ItemStack enchantedStack = ((InventorySpellBook)inv).getCraftResultMatrix().getStackInSlot(0); - if (enchantedStack.isEmpty()) { + if (enchantedStack.isEmpty() || enchantedStack.getItem() == null) { + return false; + } + + if (!spellitem.equals(enchantedStack.getItem().getRegistryName())) { return false; } diff --git a/src/main/resources/assets/unicopia/enchanting/recipes/charge.json b/src/main/resources/assets/unicopia/enchanting/recipes/charge.json index 96adc37b..43fd5389 100644 --- a/src/main/resources/assets/unicopia/enchanting/recipes/charge.json +++ b/src/main/resources/assets/unicopia/enchanting/recipes/charge.json @@ -6,6 +6,7 @@ { "item": "minecraft:redstone" } ], "result": { + "item": "unicopia:gem", "spell": "charge" } } \ No newline at end of file diff --git a/src/main/resources/assets/unicopia/enchanting/recipes/drake.json b/src/main/resources/assets/unicopia/enchanting/recipes/drake.json new file mode 100644 index 00000000..9f1633c2 --- /dev/null +++ b/src/main/resources/assets/unicopia/enchanting/recipes/drake.json @@ -0,0 +1,12 @@ +{ + "type": "unicopia:crafting_spell", + "ingredients": [ + { "item": "unicopia:gem", "spell": "charge" }, + { "item": "unicopia:corrupted_gem" }, + { "item": "minecraft:red_flower", "data": 0 } + ], + "result": { + "item": "unicopia:gem", + "spell": "drake" + } +} \ No newline at end of file diff --git a/src/main/resources/assets/unicopia/enchanting/recipes/fire.json b/src/main/resources/assets/unicopia/enchanting/recipes/fire.json index 6862f812..45847d4f 100644 --- a/src/main/resources/assets/unicopia/enchanting/recipes/fire.json +++ b/src/main/resources/assets/unicopia/enchanting/recipes/fire.json @@ -6,6 +6,7 @@ { "item": "minecraft:lava_bucket" } ], "result": { + "item": "unicopia:gem", "spell": "fire" } } \ No newline at end of file diff --git a/src/main/resources/assets/unicopia/enchanting/recipes/ice.json b/src/main/resources/assets/unicopia/enchanting/recipes/ice.json index ef8adf92..b13642ec 100644 --- a/src/main/resources/assets/unicopia/enchanting/recipes/ice.json +++ b/src/main/resources/assets/unicopia/enchanting/recipes/ice.json @@ -6,6 +6,7 @@ { "item": "minecraft:water_bucket" } ], "result": { + "item": "unicopia:gem", "spell": "ice" } } \ No newline at end of file diff --git a/src/main/resources/assets/unicopia/enchanting/recipes/inferno.json b/src/main/resources/assets/unicopia/enchanting/recipes/inferno.json new file mode 100644 index 00000000..5543efbe --- /dev/null +++ b/src/main/resources/assets/unicopia/enchanting/recipes/inferno.json @@ -0,0 +1,12 @@ +{ + "type": "unicopia:crafting_spell", + "ingredients": [ + { "item": "unicopia:gem", "spell": "fire" }, + { "item": "minecraft:redstone" }, + { "item": "minecraft:lava_bucket" } + ], + "result": { + "item": "unicopia:corrupted_gem", + "spell": "inferno" + } +} \ No newline at end of file diff --git a/src/main/resources/assets/unicopia/enchanting/recipes/light.json b/src/main/resources/assets/unicopia/enchanting/recipes/light.json new file mode 100644 index 00000000..48ad8a26 --- /dev/null +++ b/src/main/resources/assets/unicopia/enchanting/recipes/light.json @@ -0,0 +1,12 @@ +{ + "type": "unicopia:crafting_spell", + "ingredients": [ + { "item": "minecraft:glowstone_dust" }, + { "item": "unicopia:gem", "spell": "fire" }, + { "item": "unicopia:apple_green" } + ], + "result": { + "item": "unicopia:gem", + "spell": "light" + } +} \ No newline at end of file diff --git a/src/main/resources/assets/unicopia/enchanting/recipes/necromancy.json b/src/main/resources/assets/unicopia/enchanting/recipes/necromancy.json new file mode 100644 index 00000000..81896500 --- /dev/null +++ b/src/main/resources/assets/unicopia/enchanting/recipes/necromancy.json @@ -0,0 +1,12 @@ +{ + "type": "unicopia:crafting_spell", + "ingredients": [ + { "item": "minecraft:dye", "data": 1 }, + { "item": "minecraft:redstone" }, + { "item": "minecraft:rotten_flesh" } + ], + "result": { + "item": "unicopia:corrupted_gem", + "spell": "necromancy" + } +} \ No newline at end of file diff --git a/src/main/resources/assets/unicopia/enchanting/recipes/portal.json b/src/main/resources/assets/unicopia/enchanting/recipes/portal.json index eb153b0b..fad6e838 100644 --- a/src/main/resources/assets/unicopia/enchanting/recipes/portal.json +++ b/src/main/resources/assets/unicopia/enchanting/recipes/portal.json @@ -7,6 +7,7 @@ { "item": "unicopia:gem", "spell": "fire" } ], "result": { + "item": "unicopia:gem", "spell": "portal" } } \ No newline at end of file diff --git a/src/main/resources/assets/unicopia/enchanting/recipes/repulsion.json b/src/main/resources/assets/unicopia/enchanting/recipes/repulsion.json new file mode 100644 index 00000000..981cedaf --- /dev/null +++ b/src/main/resources/assets/unicopia/enchanting/recipes/repulsion.json @@ -0,0 +1,13 @@ +{ + "type": "unicopia:crafting_spell", + "ingredients": [ + { "item": "minecraft:firework_charge" }, + { "item": "minecraft:fire_charge" }, + { "item": "unicopia:gem", "spell": "shield" }, + { "item": "minecraft:egg" } + ], + "result": { + "item": "unicopia:corrupted_gem", + "spell": "shield" + } +} \ No newline at end of file diff --git a/src/main/resources/assets/unicopia/enchanting/recipes/reveal.json b/src/main/resources/assets/unicopia/enchanting/recipes/reveal.json new file mode 100644 index 00000000..ba61485e --- /dev/null +++ b/src/main/resources/assets/unicopia/enchanting/recipes/reveal.json @@ -0,0 +1,12 @@ +{ + "type": "unicopia:crafting_spell", + "ingredients": [ + { "item": "unicopia:gem", "spell": "light" }, + { "item": "unicopia:gem", "spell": "charge" }, + { "item": "unicopia:gem", "spell": "light" } + ], + "result": { + "item": "unicopia:gem", + "spell": "reveal" + } +} \ No newline at end of file diff --git a/src/main/resources/assets/unicopia/enchanting/recipes/shield.json b/src/main/resources/assets/unicopia/enchanting/recipes/shield.json index 9663b70c..205afed1 100644 --- a/src/main/resources/assets/unicopia/enchanting/recipes/shield.json +++ b/src/main/resources/assets/unicopia/enchanting/recipes/shield.json @@ -6,6 +6,7 @@ { "item": "minecraft:blaze_powder" } ], "result": { + "item": "unicopia:gem", "spell": "shield" } } \ No newline at end of file diff --git a/src/main/resources/assets/unicopia/enchanting/recipes/suffering.json b/src/main/resources/assets/unicopia/enchanting/recipes/suffering.json new file mode 100644 index 00000000..91a9823e --- /dev/null +++ b/src/main/resources/assets/unicopia/enchanting/recipes/suffering.json @@ -0,0 +1,11 @@ +{ + "type": "unicopia:crafting_spell", + "ingredients": [ + { "item": "minecraft:fire_charge" }, + { "item": "unicopia:gem", "spell": "fire" } + ], + "result": { + "item": "unicopia:corrupted_gem", + "spell": "vortex" + } +} \ No newline at end of file diff --git a/src/main/resources/assets/unicopia/enchanting/recipes/vortex.json b/src/main/resources/assets/unicopia/enchanting/recipes/vortex.json new file mode 100644 index 00000000..50eac4ae --- /dev/null +++ b/src/main/resources/assets/unicopia/enchanting/recipes/vortex.json @@ -0,0 +1,12 @@ +{ + "type": "unicopia:crafting_spell", + "ingredients": [ + { "item": "minecraft:egg" }, + { "item": "unicopia:gem", "spell": "shield" }, + { "item": "unicopia:gem", "spell": "portal" } + ], + "result": { + "item": "unicopia:gem", + "spell": "vortex" + } +} \ No newline at end of file diff --git a/src/main/resources/assets/unicopia/recipes/alicorn_amulet.json b/src/main/resources/assets/unicopia/recipes/alicorn_amulet.json new file mode 100644 index 00000000..3c663072 --- /dev/null +++ b/src/main/resources/assets/unicopia/recipes/alicorn_amulet.json @@ -0,0 +1,53 @@ +{ + "type": "minecraft:crafting_shaped", + "pattern": [ + "*D~", + "#$#", + " # " + ], + "key": { + "#": [ + { "item": "unicopia:corrupted_gem" } + ], + "D": [ + { "item": "minecraft:diamond" } + ], + "*": [ + { "item": "unicopia:corrupted_gem", "nbt": { "spell": "inferno" } } + ], + "$": [ + { "item": "unicopia:corrupted_gem", "nbt": { "spell": "darkness" } } + ], + "~": [ + { "item": "unicopia:corrupted_gem", "nbt": { "spell": "necromancy" } } + ] + }, + "result": { "item": "unicopia:alicorn_amulet" } +} + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/main/resources/assets/unicopia/recipes/gem_2.json b/src/main/resources/assets/unicopia/recipes/gem_2.json new file mode 100644 index 00000000..38785c78 --- /dev/null +++ b/src/main/resources/assets/unicopia/recipes/gem_2.json @@ -0,0 +1,62 @@ +{ + "type": "minecraft:crafting_shaped", + "pattern": [ + "SCB", + "CSC", + "BCS" + ], + "key": { + "S": [ + { "item": "minecraft:stone", "data": 3 } + ], + "C": [ + { "item": "minecraft:stained_hardenned_clay", "data": 0 }, + { "item": "minecraft:stained_hardenned_clay", "data": 1 }, + { "item": "minecraft:stained_hardenned_clay", "data": 2 }, + { "item": "minecraft:stained_hardenned_clay", "data": 3 }, + { "item": "minecraft:stained_hardenned_clay", "data": 4 }, + { "item": "minecraft:stained_hardenned_clay", "data": 5 }, + { "item": "minecraft:stained_hardenned_clay", "data": 6 }, + { "item": "minecraft:stained_hardenned_clay", "data": 7 }, + { "item": "minecraft:stained_hardenned_clay", "data": 8 }, + { "item": "minecraft:stained_hardenned_clay", "data": 9 }, + { "item": "minecraft:stained_hardenned_clay", "data": 10 }, + { "item": "minecraft:stained_hardenned_clay", "data": 11 }, + { "item": "minecraft:stained_hardenned_clay", "data": 12 }, + { "item": "minecraft:stained_hardenned_clay", "data": 13 }, + { "item": "minecraft:stained_hardenned_clay", "data": 14 }, + { "item": "minecraft:stained_hardenned_clay", "data": 15 } + ], + "S": [ + { "item": "minecraft:dye", "data": 15 } + ] + }, + "result": { "item": "unicopia:gem", "count": 4 } +} + + + + + + + + + + + + + + + + + + + + + + + + + + +