diff --git a/src/main/java/de/ellpeck/naturesaura/blocks/ModBlocks.java b/src/main/java/de/ellpeck/naturesaura/blocks/ModBlocks.java index a8b0755e..c81a63de 100644 --- a/src/main/java/de/ellpeck/naturesaura/blocks/ModBlocks.java +++ b/src/main/java/de/ellpeck/naturesaura/blocks/ModBlocks.java @@ -20,4 +20,5 @@ public final class ModBlocks { public static final Block FURNACE_HEATER = new BlockFurnaceHeater(); public static final Block POTION_GENERATOR = new BlockPotionGenerator(); public static final Block AURA_DETECTOR = new BlockAuraDetector(); + public static final Block CONVERSION_CATALYST = new BlockImpl("conversion_catalyst", Material.ROCK).setSoundType(SoundType.STONE).setHardness(2.5F); } 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 1caac693..5e03bdda 100644 --- a/src/main/java/de/ellpeck/naturesaura/blocks/tiles/TileEntityNatureAltar.java +++ b/src/main/java/de/ellpeck/naturesaura/blocks/tiles/TileEntityNatureAltar.java @@ -1,6 +1,5 @@ package de.ellpeck.naturesaura.blocks.tiles; -import de.ellpeck.naturesaura.Helper; import de.ellpeck.naturesaura.NaturesAura; import de.ellpeck.naturesaura.aura.Capabilities; import de.ellpeck.naturesaura.aura.chunk.AuraChunk; @@ -11,6 +10,7 @@ import de.ellpeck.naturesaura.packet.PacketHandler; import de.ellpeck.naturesaura.packet.PacketParticleStream; import de.ellpeck.naturesaura.packet.PacketParticles; import de.ellpeck.naturesaura.recipes.AltarRecipe; +import net.minecraft.block.Block; import net.minecraft.block.state.IBlockState; import net.minecraft.init.SoundEvents; import net.minecraft.item.ItemStack; @@ -110,7 +110,7 @@ public class TileEntityNatureAltar extends TileEntityImpl implements ITickable { if (stack.isEmpty() || !stack.isItemEqual(this.currentRecipe.input)) { this.currentRecipe = null; this.timer = 0; - } else { + } else if (this.hasCatalyst(this.currentRecipe.catalyst)) { int req = this.currentRecipe.aura / this.currentRecipe.time; if (this.container.getStoredAura() >= req) { this.container.drainAura(req, false); @@ -168,6 +168,20 @@ public class TileEntityNatureAltar extends TileEntityImpl implements ITickable { } } + private boolean hasCatalyst(Block block) { + if (block == null) + return true; + + for (int x = -2; x <= 2; x += 4) { + for (int z = -2; z <= 2; z += 4) { + IBlockState state = this.world.getBlockState(this.pos.add(x, 1, z)); + if (state.getBlock() == block) + return true; + } + } + return false; + } + @Override public void writeNBT(NBTTagCompound compound, boolean syncing) { super.writeNBT(compound, syncing); diff --git a/src/main/java/de/ellpeck/naturesaura/compat/jei/JEINaturesAuraPlugin.java b/src/main/java/de/ellpeck/naturesaura/compat/jei/JEINaturesAuraPlugin.java index 000a2951..14afa4e0 100644 --- a/src/main/java/de/ellpeck/naturesaura/compat/jei/JEINaturesAuraPlugin.java +++ b/src/main/java/de/ellpeck/naturesaura/compat/jei/JEINaturesAuraPlugin.java @@ -41,5 +41,6 @@ public class JEINaturesAuraPlugin implements IModPlugin { registry.addRecipeCatalyst(new ItemStack(ModBlocks.GOLD_POWDER), TREE_RITUAL); registry.addRecipeCatalyst(new ItemStack(ModBlocks.WOOD_STAND), TREE_RITUAL); registry.addRecipeCatalyst(new ItemStack(ModBlocks.NATURE_ALTAR), ALTAR); + registry.addRecipeCatalyst(new ItemStack(ModBlocks.CONVERSION_CATALYST), ALTAR); } } diff --git a/src/main/java/de/ellpeck/naturesaura/compat/jei/altar/AltarCategory.java b/src/main/java/de/ellpeck/naturesaura/compat/jei/altar/AltarCategory.java index 93627a61..fd8d5e2a 100644 --- a/src/main/java/de/ellpeck/naturesaura/compat/jei/altar/AltarCategory.java +++ b/src/main/java/de/ellpeck/naturesaura/compat/jei/altar/AltarCategory.java @@ -1,6 +1,5 @@ package de.ellpeck.naturesaura.compat.jei.altar; -import de.ellpeck.naturesaura.Helper; import de.ellpeck.naturesaura.NaturesAura; import de.ellpeck.naturesaura.blocks.ModBlocks; import de.ellpeck.naturesaura.compat.jei.JEINaturesAuraPlugin; @@ -11,7 +10,6 @@ import mezz.jei.api.gui.IGuiItemStackGroup; import mezz.jei.api.gui.IRecipeLayout; import mezz.jei.api.ingredients.IIngredients; import mezz.jei.api.recipe.IRecipeCategory; -import net.minecraft.client.Minecraft; import net.minecraft.client.resources.I18n; import net.minecraft.item.ItemStack; import net.minecraft.util.ResourceLocation; @@ -45,11 +43,6 @@ public class AltarCategory implements IRecipeCategory { return this.background; } - @Override - public void drawExtras(Minecraft minecraft) { - Helper.renderItemInGui(this.altar, 26, 19, 1F); - } - @Override public void setRecipe(IRecipeLayout recipeLayout, AltarWrapper recipeWrapper, IIngredients ingredients) { IGuiItemStackGroup group = recipeLayout.getItemStacks(); @@ -58,5 +51,7 @@ public class AltarCategory implements IRecipeCategory { group.set(0, recipe.input); group.init(1, false, 56, 18); group.set(1, recipe.output); + group.init(2, true, 26, 18); + group.set(2, recipe.catalyst == null ? this.altar : new ItemStack(recipe.catalyst)); } } diff --git a/src/main/java/de/ellpeck/naturesaura/compat/jei/altar/AltarWrapper.java b/src/main/java/de/ellpeck/naturesaura/compat/jei/altar/AltarWrapper.java index 65d1d658..b98d2ad1 100644 --- a/src/main/java/de/ellpeck/naturesaura/compat/jei/altar/AltarWrapper.java +++ b/src/main/java/de/ellpeck/naturesaura/compat/jei/altar/AltarWrapper.java @@ -4,6 +4,9 @@ import de.ellpeck.naturesaura.recipes.AltarRecipe; import mezz.jei.api.ingredients.IIngredients; import mezz.jei.api.ingredients.VanillaTypes; import mezz.jei.api.recipe.IRecipeWrapper; +import net.minecraft.item.ItemStack; + +import java.util.Arrays; public class AltarWrapper implements IRecipeWrapper { @@ -15,7 +18,7 @@ public class AltarWrapper implements IRecipeWrapper { @Override public void getIngredients(IIngredients ingredients) { - ingredients.setInput(VanillaTypes.ITEM, this.recipe.input); + ingredients.setInputs(VanillaTypes.ITEM, Arrays.asList(this.recipe.input, new ItemStack(this.recipe.catalyst))); ingredients.setOutput(VanillaTypes.ITEM, this.recipe.output); } } diff --git a/src/main/java/de/ellpeck/naturesaura/compat/patchouli/ProcessorAltar.java b/src/main/java/de/ellpeck/naturesaura/compat/patchouli/ProcessorAltar.java index e84c117c..c9c98f35 100644 --- a/src/main/java/de/ellpeck/naturesaura/compat/patchouli/ProcessorAltar.java +++ b/src/main/java/de/ellpeck/naturesaura/compat/patchouli/ProcessorAltar.java @@ -1,6 +1,7 @@ package de.ellpeck.naturesaura.compat.patchouli; import de.ellpeck.naturesaura.recipes.AltarRecipe; +import net.minecraft.item.ItemStack; import net.minecraft.util.ResourceLocation; import vazkii.patchouli.api.IComponentProcessor; import vazkii.patchouli.api.IVariableProvider; @@ -23,10 +24,20 @@ public class ProcessorAltar implements IComponentProcessor { return PatchouliAPI.instance.serializeItemStack(this.recipe.input); case "output": return PatchouliAPI.instance.serializeItemStack(this.recipe.output); + case "catalyst": + if (this.recipe.catalyst != null) + return PatchouliAPI.instance.serializeItemStack(new ItemStack(this.recipe.catalyst)); + else + return null; case "name": return this.recipe.output.getDisplayName(); default: return null; } } + + @Override + public boolean allowRender(String group) { + return group.isEmpty() || group.equals(this.recipe.catalyst == null ? "altar" : "catalyst"); + } } diff --git a/src/main/java/de/ellpeck/naturesaura/recipes/AltarRecipe.java b/src/main/java/de/ellpeck/naturesaura/recipes/AltarRecipe.java index 9c54cefb..e6bd897a 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 net.minecraft.block.Block; import net.minecraft.item.ItemStack; import net.minecraft.util.ResourceLocation; @@ -13,13 +14,15 @@ public class AltarRecipe { public final ResourceLocation name; public final ItemStack input; public final ItemStack output; + public final Block catalyst; public final int aura; public final int time; - public AltarRecipe(ResourceLocation name, ItemStack input, ItemStack output, int aura, int time) { + public AltarRecipe(ResourceLocation name, ItemStack input, ItemStack output, Block catalyst, int aura, int time) { this.name = name; this.input = input; this.output = output; + this.catalyst = catalyst; this.aura = aura; this.time = time; } diff --git a/src/main/java/de/ellpeck/naturesaura/recipes/ModRecipes.java b/src/main/java/de/ellpeck/naturesaura/recipes/ModRecipes.java index 290c2dd3..a464662b 100644 --- a/src/main/java/de/ellpeck/naturesaura/recipes/ModRecipes.java +++ b/src/main/java/de/ellpeck/naturesaura/recipes/ModRecipes.java @@ -41,10 +41,27 @@ public final class ModRecipes { new ItemStack(Items.FIRE_CHARGE), new ItemStack(Items.FLINT), new ItemStack(Blocks.MAGMA)).add(); + 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), + new ItemStack(ModBlocks.INFUSED_STONE), + new ItemStack(Items.BREWING_STAND), + new ItemStack(Items.GOLD_INGOT), + new ItemStack(ModItems.GOLD_LEAF), + new ItemStack(Blocks.GLOWSTONE)).add(); new AltarRecipe(new ResourceLocation(NaturesAura.MOD_ID, "infused_iron"), - new ItemStack(Items.IRON_INGOT), new ItemStack(ModItems.INFUSED_IRON), 300, 80).add(); + new ItemStack(Items.IRON_INGOT), new ItemStack(ModItems.INFUSED_IRON), + null, 300, 80).add(); new AltarRecipe(new ResourceLocation(NaturesAura.MOD_ID, "infused_stone"), - new ItemStack(Blocks.STONE), new ItemStack(ModBlocks.INFUSED_STONE), 150, 40).add(); + new ItemStack(Blocks.STONE), new ItemStack(ModBlocks.INFUSED_STONE), + null, 150, 40).add(); + + new AltarRecipe(new ResourceLocation(NaturesAura.MOD_ID, "chorus"), + new ItemStack(Blocks.CHORUS_FLOWER), new ItemStack(Items.DRAGON_BREATH), + ModBlocks.CONVERSION_CATALYST, 1000, 120).add(); + new AltarRecipe(new ResourceLocation(NaturesAura.MOD_ID, "leather"), + new ItemStack(Items.ROTTEN_FLESH), new ItemStack(Items.LEATHER), + ModBlocks.CONVERSION_CATALYST, 400, 50).add(); } } diff --git a/src/main/resources/assets/naturesaura/blockstates/conversion_catalyst.json b/src/main/resources/assets/naturesaura/blockstates/conversion_catalyst.json new file mode 100644 index 00000000..871a4975 --- /dev/null +++ b/src/main/resources/assets/naturesaura/blockstates/conversion_catalyst.json @@ -0,0 +1,14 @@ +{ + "forge_marker": 1, + "defaults": { + "model": "minecraft:cube_all", + "textures": { + "all": "naturesaura:blocks/conversion_catalyst" + }, + "transform": "forge:default-block" + }, + "variants": { + "normal": [{}], + "inventory": [{}] + } +} \ No newline at end of file diff --git a/src/main/resources/assets/naturesaura/lang/en_US.lang b/src/main/resources/assets/naturesaura/lang/en_US.lang index b9f97f76..95a9406b 100644 --- a/src/main/resources/assets/naturesaura/lang/en_US.lang +++ b/src/main/resources/assets/naturesaura/lang/en_US.lang @@ -14,6 +14,7 @@ tile.naturesaura.infused_stone.name=Infused Rock tile.naturesaura.furnace_heater.name=Extraneous Firestarter tile.naturesaura.potion_generator.name=Lingering Absorber tile.naturesaura.aura_detector.name=Aura Detector +tile.naturesaura.conversion_catalyst.name=Transmutation Catalyst item.naturesaura.eye.name=Environmental Eye item.naturesaura.gold_fiber.name=Brilliant Fiber diff --git a/src/main/resources/assets/naturesaura/patchouli_books/book/en_us/entries/using/conversion_catalyst.json b/src/main/resources/assets/naturesaura/patchouli_books/book/en_us/entries/using/conversion_catalyst.json new file mode 100644 index 00000000..1a3bf46d --- /dev/null +++ b/src/main/resources/assets/naturesaura/patchouli_books/book/en_us/entries/using/conversion_catalyst.json @@ -0,0 +1,27 @@ +{ + "name": "Transmutation Catalyst", + "icon": "naturesaura:conversion_catalyst", + "category": "using", + "advancement": "naturesaura:infused_materials", + "pages": [ + { + "type": "text", + "text": "The $(l:collecting/altar)Natural Altar$() can be useful for infusing certain items with the power of $(aura), however, it can also assist in transmuting items from one type into another.$(br)This can be achieved by creating the $(item)Transmutation Catalyst$() and placing it on top of any of the four lower $(item)Mossy Stone Brick$() blocks around the altar, and then placing the ingredient on the altar as usual." + }, + { + "type": "naturesaura:tree_ritual", + "text": "Creating the $(item)Transmutation Catalyst$() using the $(l:practices/tree_ritual)Ritual of the Forest$().", + "recipe": "naturesaura:conversion_catalyst" + }, + { + "type": "naturesaura:altar", + "text": "Creating $(item)Dragon's Breath$() out of the end's fruit", + "recipe": "naturesaura:chorus" + }, + { + "type": "naturesaura:altar", + "text": "Conjuring $(item)Leather$() from a zombie's remains", + "recipe": "naturesaura:leather" + } + ] +} \ No newline at end of file diff --git a/src/main/resources/assets/naturesaura/patchouli_books/book/en_us/templates/altar.json b/src/main/resources/assets/naturesaura/patchouli_books/book/en_us/templates/altar.json index 458d8439..60012a56 100644 --- a/src/main/resources/assets/naturesaura/patchouli_books/book/en_us/templates/altar.json +++ b/src/main/resources/assets/naturesaura/patchouli_books/book/en_us/templates/altar.json @@ -15,6 +15,14 @@ "link_recipe": true }, { + "group": "catalyst", + "type": "item", + "item": "#catalyst", + "x": 50, + "y": 28 + }, + { + "group": "altar", "type": "item", "item": "naturesaura:nature_altar", "x": 50, diff --git a/src/main/resources/assets/naturesaura/textures/blocks/conversion_catalyst.png b/src/main/resources/assets/naturesaura/textures/blocks/conversion_catalyst.png new file mode 100644 index 00000000..ee259fad Binary files /dev/null and b/src/main/resources/assets/naturesaura/textures/blocks/conversion_catalyst.png differ