diff --git a/src/main/java/de/ellpeck/naturesaura/Helper.java b/src/main/java/de/ellpeck/naturesaura/Helper.java index dce7f6d6..01bd0d30 100644 --- a/src/main/java/de/ellpeck/naturesaura/Helper.java +++ b/src/main/java/de/ellpeck/naturesaura/Helper.java @@ -80,15 +80,21 @@ public final class Helper { return ((a & 255) << 24) | ((r & 255) << 16) | ((g & 255) << 8) | (b & 255); } - public static int getItemIndex(List list, ItemStack item) { + public static int getItemIndex(List list, ItemStack item, boolean nbt) { for (int i = 0; i < list.size(); i++) { - if (list.get(i).isItemEqual(item)) { + if (areItemsEqual(list.get(i), item, nbt)) { return i; } } return -1; } + public static boolean areItemsEqual(ItemStack first, ItemStack second, boolean nbt) { + if (!ItemStack.areItemsEqual(first, second)) + return false; + return !nbt || ItemStack.areItemStackShareTagsEqual(first, second); + } + @SideOnly(Side.CLIENT) public static void renderItemInWorld(ItemStack stack) { if (!stack.isEmpty()) { diff --git a/src/main/java/de/ellpeck/naturesaura/blocks/tiles/TileEntityFurnaceHeater.java b/src/main/java/de/ellpeck/naturesaura/blocks/tiles/TileEntityFurnaceHeater.java index f00ac9b5..991545e7 100644 --- a/src/main/java/de/ellpeck/naturesaura/blocks/tiles/TileEntityFurnaceHeater.java +++ b/src/main/java/de/ellpeck/naturesaura/blocks/tiles/TileEntityFurnaceHeater.java @@ -1,5 +1,6 @@ package de.ellpeck.naturesaura.blocks.tiles; +import de.ellpeck.naturesaura.Helper; import de.ellpeck.naturesaura.aura.chunk.AuraChunk; import de.ellpeck.naturesaura.packet.PacketHandler; import de.ellpeck.naturesaura.packet.PacketParticleStream; @@ -69,7 +70,8 @@ public class TileEntityFurnaceHeater extends TileEntityImpl implements ITickable return false; ItemStack currOutput = furnace.getStackInSlot(2); - return currOutput.isEmpty() || output.isItemEqual(currOutput) && currOutput.getCount() + output.getCount() <= output.getMaxStackSize(); + return currOutput.isEmpty() || + Helper.areItemsEqual(currOutput, output, true) && currOutput.getCount() + output.getCount() <= output.getMaxStackSize(); } else return false; } diff --git a/src/main/java/de/ellpeck/naturesaura/blocks/tiles/TileEntityNatureAltar.java b/src/main/java/de/ellpeck/naturesaura/blocks/tiles/TileEntityNatureAltar.java index 3a2dc738..54b6f517 100644 --- a/src/main/java/de/ellpeck/naturesaura/blocks/tiles/TileEntityNatureAltar.java +++ b/src/main/java/de/ellpeck/naturesaura/blocks/tiles/TileEntityNatureAltar.java @@ -1,5 +1,6 @@ package de.ellpeck.naturesaura.blocks.tiles; +import de.ellpeck.naturesaura.Helper; import de.ellpeck.naturesaura.NaturesAura; import de.ellpeck.naturesaura.aura.AuraType; import de.ellpeck.naturesaura.aura.Capabilities; @@ -111,7 +112,7 @@ public class TileEntityNatureAltar extends TileEntityImpl implements ITickable { this.currentRecipe = AltarRecipe.forInput(stack); } } else { - if (stack.isEmpty() || !stack.isItemEqual(this.currentRecipe.input)) { + if (stack.isEmpty() || !Helper.areItemsEqual(stack, this.currentRecipe.input, true)) { this.currentRecipe = null; this.timer = 0; } else if (this.hasCatalyst(this.currentRecipe.catalyst)) { diff --git a/src/main/java/de/ellpeck/naturesaura/blocks/tiles/TileEntityPlacer.java b/src/main/java/de/ellpeck/naturesaura/blocks/tiles/TileEntityPlacer.java index 05f54c44..679e41e0 100644 --- a/src/main/java/de/ellpeck/naturesaura/blocks/tiles/TileEntityPlacer.java +++ b/src/main/java/de/ellpeck/naturesaura/blocks/tiles/TileEntityPlacer.java @@ -90,7 +90,7 @@ public class TileEntityPlacer extends TileEntityImpl implements ITickable { for (EntityItemFrame frame : frames) { ItemStack frameStack = frame.getDisplayedItem(); - if (!frameStack.isEmpty() && stack.isItemEqual(frameStack)) + if (!frameStack.isEmpty() && Helper.areItemsEqual(stack, frameStack, false)) return true; } return false; diff --git a/src/main/java/de/ellpeck/naturesaura/blocks/tiles/TileEntityWoodStand.java b/src/main/java/de/ellpeck/naturesaura/blocks/tiles/TileEntityWoodStand.java index d30e91a7..c07d3d35 100644 --- a/src/main/java/de/ellpeck/naturesaura/blocks/tiles/TileEntityWoodStand.java +++ b/src/main/java/de/ellpeck/naturesaura/blocks/tiles/TileEntityWoodStand.java @@ -151,7 +151,7 @@ public class TileEntityWoodStand extends TileEntityImpl implements ITickable { if (tile instanceof TileEntityWoodStand) { ItemStack stack = ((TileEntityWoodStand) tile).items.getStackInSlot(0); if (!stack.isEmpty()) { - int index = Helper.getItemIndex(required, stack); + int index = Helper.getItemIndex(required, stack, true); if (index >= 0) { required.remove(index); } else { diff --git a/src/main/java/de/ellpeck/naturesaura/events/TerrainGenEvents.java b/src/main/java/de/ellpeck/naturesaura/events/TerrainGenEvents.java index 7e314355..c8b9f436 100644 --- a/src/main/java/de/ellpeck/naturesaura/events/TerrainGenEvents.java +++ b/src/main/java/de/ellpeck/naturesaura/events/TerrainGenEvents.java @@ -29,7 +29,7 @@ public class TerrainGenEvents { ItemStack saplingStack = sapling.getBlock().getItem(world, pos, sapling); if (!saplingStack.isEmpty()) { for (TreeRitualRecipe recipe : TreeRitualRecipe.RECIPES.values()) { - if (recipe.saplingType.isItemEqual(saplingStack)) { + if (Helper.areItemsEqual(saplingStack, recipe.saplingType, true)) { List required = new ArrayList<>(Arrays.asList(recipe.items)); MutableObject toPick = new MutableObject<>(); @@ -39,7 +39,7 @@ public class TerrainGenEvents { TileEntityWoodStand stand = (TileEntityWoodStand) tile; ItemStack stack = stand.items.getStackInSlot(0); if (!stack.isEmpty()) { - int index = Helper.getItemIndex(required, stack); + int index = Helper.getItemIndex(required, stack, true); if (index >= 0) { required.remove(index); diff --git a/src/main/java/de/ellpeck/naturesaura/items/ItemAuraBottle.java b/src/main/java/de/ellpeck/naturesaura/items/ItemAuraBottle.java index 0200d9eb..be77c544 100644 --- a/src/main/java/de/ellpeck/naturesaura/items/ItemAuraBottle.java +++ b/src/main/java/de/ellpeck/naturesaura/items/ItemAuraBottle.java @@ -48,7 +48,7 @@ public class ItemAuraBottle extends ItemImpl { setType(new ItemStack(this), AuraType.forWorld(player.world))); BlockPos spot = AuraChunk.getHighestSpot(player.world, pos, 30, pos); - AuraChunk.getAuraChunk(player.world, spot).drainAura(spot, 500); + AuraChunk.getAuraChunk(player.world, spot).drainAura(spot, 200); player.world.playSound(null, player.posX, player.posY, player.posZ, SoundEvents.ITEM_BOTTLE_FILL_DRAGONBREATH, SoundCategory.PLAYERS, 1F, 1F); @@ -76,6 +76,8 @@ public class ItemAuraBottle extends ItemImpl { if (!stack.hasTagCompound()) return AuraType.OTHER; String type = stack.getTagCompound().getString("type"); + if (type.isEmpty()) + return AuraType.OTHER; return AuraType.valueOf(type); } diff --git a/src/main/java/de/ellpeck/naturesaura/recipes/AltarRecipe.java b/src/main/java/de/ellpeck/naturesaura/recipes/AltarRecipe.java index bef012d8..fb050a9d 100644 --- a/src/main/java/de/ellpeck/naturesaura/recipes/AltarRecipe.java +++ b/src/main/java/de/ellpeck/naturesaura/recipes/AltarRecipe.java @@ -1,5 +1,6 @@ package de.ellpeck.naturesaura.recipes; +import de.ellpeck.naturesaura.Helper; import net.minecraft.block.Block; import net.minecraft.item.ItemStack; import net.minecraft.util.ResourceLocation; @@ -31,7 +32,7 @@ public class AltarRecipe { public static AltarRecipe forInput(ItemStack input) { for (AltarRecipe recipe : RECIPES.values()) { - if (recipe.input.isItemEqual(input)) { + if (Helper.areItemsEqual(recipe.input, input, true)) { return recipe; } } diff --git a/src/main/java/de/ellpeck/naturesaura/recipes/ModRecipes.java b/src/main/java/de/ellpeck/naturesaura/recipes/ModRecipes.java index 71213a8b..be22bd75 100644 --- a/src/main/java/de/ellpeck/naturesaura/recipes/ModRecipes.java +++ b/src/main/java/de/ellpeck/naturesaura/recipes/ModRecipes.java @@ -1,7 +1,9 @@ package de.ellpeck.naturesaura.recipes; import de.ellpeck.naturesaura.NaturesAura; +import de.ellpeck.naturesaura.aura.AuraType; import de.ellpeck.naturesaura.blocks.ModBlocks; +import de.ellpeck.naturesaura.items.ItemAuraBottle; import de.ellpeck.naturesaura.items.ModItems; import net.minecraft.init.Blocks; import net.minecraft.init.Items; @@ -23,7 +25,8 @@ public final class ModRecipes { new ItemStack(Blocks.STONE), new ItemStack(Blocks.STONE), new ItemStack(ModItems.GOLD_LEAF), - new ItemStack(Items.GOLD_INGOT)); + new ItemStack(Items.GOLD_INGOT), + ItemAuraBottle.setType(new ItemStack(ModItems.AURA_BOTTLE), AuraType.OVERWORLD)); new TreeRitualRecipe(new ResourceLocation(NaturesAura.MOD_ID, "ancient_sapling"), new ItemStack(Blocks.SAPLING), new ItemStack(ModBlocks.ANCIENT_SAPLING), 200, new ItemStack(Blocks.SAPLING), @@ -40,7 +43,8 @@ public final class ModRecipes { new ItemStack(ModItems.INFUSED_IRON), new ItemStack(Items.FIRE_CHARGE), new ItemStack(Items.FLINT), - new ItemStack(Blocks.MAGMA)); + new ItemStack(Blocks.MAGMA), + ItemAuraBottle.setType(new ItemStack(ModItems.AURA_BOTTLE), AuraType.NETHER)); new TreeRitualRecipe(new ResourceLocation(NaturesAura.MOD_ID, "conversion_catalyst"), new ItemStack(Blocks.SAPLING, 1, 3), new ItemStack(ModBlocks.CONVERSION_CATALYST), 600, new ItemStack(Blocks.STONEBRICK, 1, 1), @@ -58,8 +62,8 @@ public final class ModRecipes { null, 150, 40); new AltarRecipe(new ResourceLocation(NaturesAura.MOD_ID, "chorus"), - new ItemStack(Blocks.CHORUS_FLOWER), new ItemStack(Items.DRAGON_BREATH), - ModBlocks.CONVERSION_CATALYST, 1000, 120); + ItemAuraBottle.setType(new ItemStack(ModItems.AURA_BOTTLE), AuraType.END), new ItemStack(Items.DRAGON_BREATH), + ModBlocks.CONVERSION_CATALYST, 350, 80); new AltarRecipe(new ResourceLocation(NaturesAura.MOD_ID, "leather"), new ItemStack(Items.ROTTEN_FLESH), new ItemStack(Items.LEATHER), ModBlocks.CONVERSION_CATALYST, 400, 50); diff --git a/src/main/resources/assets/naturesaura/advancements/altar.json b/src/main/resources/assets/naturesaura/advancements/altar.json index 98c0ff9c..cff4be83 100644 --- a/src/main/resources/assets/naturesaura/advancements/altar.json +++ b/src/main/resources/assets/naturesaura/advancements/altar.json @@ -10,7 +10,7 @@ "translate": "advancement.naturesaura.altar.desc" } }, - "parent": "naturesaura:wood_stand", + "parent": "naturesaura:aura_bottle_overworld", "criteria": { "book": { "trigger": "minecraft:inventory_changed", diff --git a/src/main/resources/assets/naturesaura/advancements/aura_bottle_end.json b/src/main/resources/assets/naturesaura/advancements/aura_bottle_end.json new file mode 100644 index 00000000..1d4880ce --- /dev/null +++ b/src/main/resources/assets/naturesaura/advancements/aura_bottle_end.json @@ -0,0 +1,28 @@ +{ + "display": { + "icon": { + "item": "naturesaura:aura_bottle", + "nbt": "{\"type\":\"END\"}" + }, + "title": { + "translate": "advancement.naturesaura.aura_bottle_end" + }, + "description": { + "translate": "advancement.naturesaura.aura_bottle_end.desc" + } + }, + "parent": "naturesaura:wood_stand", + "criteria": { + "bottle": { + "trigger": "minecraft:inventory_changed", + "conditions": { + "items": [ + { + "item": "naturesaura:aura_bottle", + "nbt": "{\"type\":\"END\"}" + } + ] + } + } + } +} \ No newline at end of file diff --git a/src/main/resources/assets/naturesaura/advancements/aura_bottle_nether.json b/src/main/resources/assets/naturesaura/advancements/aura_bottle_nether.json new file mode 100644 index 00000000..76f0745c --- /dev/null +++ b/src/main/resources/assets/naturesaura/advancements/aura_bottle_nether.json @@ -0,0 +1,28 @@ +{ + "display": { + "icon": { + "item": "naturesaura:aura_bottle", + "nbt": "{\"type\":\"NETHER\"}" + }, + "title": { + "translate": "advancement.naturesaura.aura_bottle_nether" + }, + "description": { + "translate": "advancement.naturesaura.aura_bottle_nether.desc" + } + }, + "parent": "naturesaura:wood_stand", + "criteria": { + "bottle": { + "trigger": "minecraft:inventory_changed", + "conditions": { + "items": [ + { + "item": "naturesaura:aura_bottle", + "nbt": "{\"type\":\"NETHER\"}" + } + ] + } + } + } +} \ No newline at end of file diff --git a/src/main/resources/assets/naturesaura/advancements/aura_bottle_overworld.json b/src/main/resources/assets/naturesaura/advancements/aura_bottle_overworld.json new file mode 100644 index 00000000..8f824d8d --- /dev/null +++ b/src/main/resources/assets/naturesaura/advancements/aura_bottle_overworld.json @@ -0,0 +1,28 @@ +{ + "display": { + "icon": { + "item": "naturesaura:aura_bottle", + "nbt": "{\"type\":\"OVERWORLD\"}" + }, + "title": { + "translate": "advancement.naturesaura.aura_bottle_overworld" + }, + "description": { + "translate": "advancement.naturesaura.aura_bottle_overworld.desc" + } + }, + "parent": "naturesaura:wood_stand", + "criteria": { + "bottle": { + "trigger": "minecraft:inventory_changed", + "conditions": { + "items": [ + { + "item": "naturesaura:aura_bottle", + "nbt": "{\"type\":\"OVERWORLD\"}" + } + ] + } + } + } +} \ No newline at end of file diff --git a/src/main/resources/assets/naturesaura/advancements/infused_materials.json b/src/main/resources/assets/naturesaura/advancements/infused_materials.json index 313c65ab..f63fb714 100644 --- a/src/main/resources/assets/naturesaura/advancements/infused_materials.json +++ b/src/main/resources/assets/naturesaura/advancements/infused_materials.json @@ -18,9 +18,6 @@ "items": [ { "item": "naturesaura:infused_iron" - }, - { - "item": "naturesaura:infused_stone" } ] } diff --git a/src/main/resources/assets/naturesaura/advancements/potion_generator.json b/src/main/resources/assets/naturesaura/advancements/potion_generator.json index 63b20b70..ddcba0dc 100644 --- a/src/main/resources/assets/naturesaura/advancements/potion_generator.json +++ b/src/main/resources/assets/naturesaura/advancements/potion_generator.json @@ -10,7 +10,7 @@ "translate": "advancement.naturesaura.potion_generator.desc" } }, - "parent": "naturesaura:flower_generator", + "parent": "naturesaura:aura_bottle_nether", "criteria": { "generator": { "trigger": "minecraft:inventory_changed", diff --git a/src/main/resources/assets/naturesaura/advancements/root.json b/src/main/resources/assets/naturesaura/advancements/root.json index 22e192df..5654a977 100644 --- a/src/main/resources/assets/naturesaura/advancements/root.json +++ b/src/main/resources/assets/naturesaura/advancements/root.json @@ -19,7 +19,8 @@ "conditions": { "items": [ { - "item": "patchouli:guide_book" + "item": "patchouli:guide_book", + "nbt": "{\"patchouli:book\":\"naturesaura:book\"}" } ] } diff --git a/src/main/resources/assets/naturesaura/lang/en_US.lang b/src/main/resources/assets/naturesaura/lang/en_US.lang index 102b17f0..65554bb4 100644 --- a/src/main/resources/assets/naturesaura/lang/en_US.lang +++ b/src/main/resources/assets/naturesaura/lang/en_US.lang @@ -67,7 +67,7 @@ advancement.naturesaura.wood_stand.desc=Create a Wooden Stand for the Ritual of advancement.naturesaura.altar=Empowered advancement.naturesaura.altar.desc=Create a Natural Altar using the Ritual of the Forest advancement.naturesaura.infused_materials=Iron Factory -advancement.naturesaura.infused_materials.desc=Use the Natural Altar to create Infused Iron and Infused Rock +advancement.naturesaura.infused_materials.desc=Use the Natural Altar to create Infused Iron advancement.naturesaura.furnace_heater=Cozy Warmth advancement.naturesaura.furnace_heater.desc=Create an Extraneous Firestarter to heat your furnace advancement.naturesaura.potion_generator=Lurking Powers @@ -80,5 +80,11 @@ advancement.naturesaura.conversion_catalyst=Not so Equivalent Exchange advancement.naturesaura.conversion_catalyst.desc=Create a Conversion Catalyst for easy material conversion advancement.naturesaura.infused_tools=Gear Up Intensifies advancement.naturesaura.infused_tools.desc=Create an Infused Iron Pickaxe and Blade +advancement.naturesaura.aura_bottle_overworld=A taste of Sunlight +advancement.naturesaura.aura_bottle_overworld.desc=Collect Aura using a Bottle in the Overworld +advancement.naturesaura.aura_bottle_nether=Spooky Scary Skeletons +advancement.naturesaura.aura_bottle_nether.desc=Collect Aura using a Bottle in the Nether +advancement.naturesaura.aura_bottle_end=Breathy Surroundings +advancement.naturesaura.aura_bottle_end.desc=Collect Aura using a Bottle in the End command.naturesaura.aura.usage=/naaura \ No newline at end of file diff --git a/src/main/resources/assets/naturesaura/patchouli_books/book/en_us/entries/collecting/altar.json b/src/main/resources/assets/naturesaura/patchouli_books/book/en_us/entries/collecting/altar.json index 331c09d3..355b050c 100644 --- a/src/main/resources/assets/naturesaura/patchouli_books/book/en_us/entries/collecting/altar.json +++ b/src/main/resources/assets/naturesaura/patchouli_books/book/en_us/entries/collecting/altar.json @@ -2,7 +2,7 @@ "name": "The Natural Altar", "icon": "naturesaura:nature_altar", "category": "collecting", - "advancement": "naturesaura:wood_stand", + "advancement": "naturesaura:aura_bottle_overworld", "priority": true, "pages": [ { diff --git a/src/main/resources/assets/naturesaura/patchouli_books/book/en_us/entries/collecting/aura_bottle.json b/src/main/resources/assets/naturesaura/patchouli_books/book/en_us/entries/collecting/aura_bottle.json index 1cdb07f0..d1802ac2 100644 --- a/src/main/resources/assets/naturesaura/patchouli_books/book/en_us/entries/collecting/aura_bottle.json +++ b/src/main/resources/assets/naturesaura/patchouli_books/book/en_us/entries/collecting/aura_bottle.json @@ -2,7 +2,7 @@ "name": "Aura Bottling", "icon": "naturesaura:aura_bottle{type:'OVERWORLD'}", "category": "collecting", - "advancement": "naturesaura:gold_leaf", + "advancement": "naturesaura:wood_stand", "pages": [ { "type": "text", @@ -11,6 +11,7 @@ { "type": "spotlight", "item": "naturesaura:aura_bottle{type:'OVERWORLD'}", + "link_recipe": true, "text": "Of course, based on the world that you are currently in, the type of $(aura) collected will slightly vary. For instance, in the normal world, $(aura) can be gathered in the form of sunlight, while in the Nether realm, $(aura) can be gathered in the form of ghosts." } ] diff --git a/src/main/resources/assets/naturesaura/patchouli_books/book/en_us/entries/creating/potion_generator.json b/src/main/resources/assets/naturesaura/patchouli_books/book/en_us/entries/creating/potion_generator.json index 9a6fd38b..db702840 100644 --- a/src/main/resources/assets/naturesaura/patchouli_books/book/en_us/entries/creating/potion_generator.json +++ b/src/main/resources/assets/naturesaura/patchouli_books/book/en_us/entries/creating/potion_generator.json @@ -2,7 +2,7 @@ "name": "Ritual of the Brewer", "icon": "naturesaura:potion_generator", "category": "creating", - "advancement": "naturesaura:flower_generator", + "advancement": "naturesaura:aura_bottle_nether", "pages": [ { "type": "text", diff --git a/src/main/resources/assets/naturesaura/recipes/flower_generator.json b/src/main/resources/assets/naturesaura/recipes/flower_generator.json index 1c8f324a..8c9b8fef 100644 --- a/src/main/resources/assets/naturesaura/recipes/flower_generator.json +++ b/src/main/resources/assets/naturesaura/recipes/flower_generator.json @@ -1,7 +1,7 @@ { "type": "forge:ore_shaped", "pattern": [ - "PIP", + "PBP", "IFI", "PIP" ], @@ -16,6 +16,13 @@ "F": { "item": "minecraft:double_plant", "data": 5 + }, + "B": { + "type": "minecraft:item_nbt", + "item": "naturesaura:aura_bottle", + "nbt": { + "type": "OVERWORLD" + } } }, "result": { diff --git a/src/main/resources/assets/naturesaura/recipes/potion_generator.json b/src/main/resources/assets/naturesaura/recipes/potion_generator.json index d57b0e33..8562217b 100644 --- a/src/main/resources/assets/naturesaura/recipes/potion_generator.json +++ b/src/main/resources/assets/naturesaura/recipes/potion_generator.json @@ -16,7 +16,11 @@ "item": "naturesaura:infused_iron" }, "W": { - "item": "minecraft:nether_wart" + "type": "minecraft:item_nbt", + "item": "naturesaura:aura_bottle", + "nbt": { + "type": "NETHER" + } } }, "result": {