Added recipes for al of the current gems

This commit is contained in:
Sollace 2019-01-26 19:26:52 +02:00
parent e1e719f17f
commit 3f9029098e
5 changed files with 49 additions and 8 deletions

View file

@ -31,13 +31,22 @@ public class SpellRecipe extends Impl<IRecipe> implements IRecipe {
for (JsonElement i : json.get("ingredients").getAsJsonArray()) {
JsonObject o = i.getAsJsonObject();
Item item = Item.getByNameOrId(o.get("item").getAsString());
Item item = o.has("item") ? Item.getByNameOrId(o.get("item").getAsString()) : null;
if (item != null) {
int metadata = Math.max(0, o.has("data") ? o.get("data").getAsInt() : 0);
int size = Math.max(1, o.has("count") ? o.get("count").getAsInt() : 1);
String spell = o.has("spell") ? o.get("spell").getAsString() : null;
ingredients.add(new RecipeItem(new ItemStack(item, size, metadata), !o.has("data")));
ItemStack stack = new ItemStack(item, size, metadata);
if (spell != null) {
stack = SpellRegistry.instance().enchantStack(stack, spell);
}
ingredients.add(new RecipeItem(stack, !o.has("data")));
}
}
@ -131,8 +140,8 @@ public class SpellRecipe extends Impl<IRecipe> implements IRecipe {
}
if (contained.getItem() == other.getItem()
&& (ignoreMeta || other.getMetadata() == contained.getMetadata())) {
&& (ignoreMeta || other.getMetadata() == contained.getMetadata())
&& ItemStack.areItemStackTagsEqual(contained, other)) {
return other.getCount() >= (materialMult * contained.getCount());
}

View file

@ -0,0 +1,11 @@
{
"type": "unicopia:crafting_spell",
"ingredients": [
{ "item": "unicopia:zap_apple" },
{ "item": "unicopia:gem", "spell": "fire" },
{ "item": "minecraft:redstone" }
],
"result": {
"spell": "charge"
}
}

View file

@ -0,0 +1,11 @@
{
"type": "unicopia:crafting_spell",
"ingredients": [
{ "item": "minecraft:fire_charge" },
{ "item": "minecraft:fire_charge" },
{ "item": "minecraft:lava_bucket" }
],
"result": {
"spell": "fire"
}
}

View file

@ -0,0 +1,11 @@
{
"type": "unicopia:crafting_spell",
"ingredients": [
{ "item": "minecraft:snowball" },
{ "item": "minecraft:snowball" },
{ "item": "minecraft:water_bucket" }
],
"result": {
"spell": "ice"
}
}

View file

@ -1,10 +1,9 @@
{
"type": "unicopia:crafting_spell",
"ingredients": [
{
"item": "minecraft:apple",
"data": 0
}
{ "item": "minecraft:egg" },
{ "item": "minecraft:coal" },
{ "item": "minecraft:blaze_powder" }
],
"result": {
"spell": "shield"