From 71065792010a0d755c4360e44778bec45d9e15aa Mon Sep 17 00:00:00 2001 From: WayofTime Date: Sat, 27 Feb 2016 19:34:42 -0500 Subject: [PATCH] Updated changelog and added recipes. Also created behaviour for the crystals to drop single crystals. --- changelog.txt | 9 +++++++ .../bloodmagic/block/BlockDemonCrystal.java | 27 ++++++++++++++++++- .../bloodmagic/registry/ModRecipes.java | 5 +++- .../bloodmagic/tile/TileDemonCrystal.java | 21 +++++++++++++++ 4 files changed, 60 insertions(+), 2 deletions(-) diff --git a/changelog.txt b/changelog.txt index a893c4ee..c16feab1 100644 --- a/changelog.txt +++ b/changelog.txt @@ -6,6 +6,15 @@ Version 2.0.0-19 - Grayed out the currently active side's button in the item routers. - Added Demon Pylon - Changed behaviour of Demon Crucible +- Fully implemented the behaviour of the crystal growing process. + - A Demon Crucible will be able to syphon the demon will from the tartaric gems inside of its inventory - right click with a gem to place it into the inventory. + - The syphoned will from the gem will go into the chunk, staying in the air - it will not move to neighbouring chunks unless forced to do so through other means + - The Demon Pylon draws will in the air from surrounding chunks and puts it into its own chunk - this acts as sort of like a pressure system, where it will even out the will distribution, but only goes one way. + - The Demon Crystallizer takes 100 will from the air (need a demon crucible for it to work) and forms a demon crystal on top of it. There is a 10% chance that this crystal will be of a special type. + - The Demon Crystals can be mined in order to collect their crystals. These crystals can be used for crafting more powerful stuff. If you have over 1024 will on your person when you right click the crystal, you can harvest a single crystal instead of the entire thing. + - You can put the harvested crystals inside of a demon crucible. Each crystal is worth 10 will, so this acts as a way to semi-automate will creation. + - When a hellfire forge is inside of a chunk with demon will, it will fill its contained tartaric gem with will. + - Changed a few recipes (like the greater tartaric gem) to match this new system. ------------------------------------------------------ Version 2.0.0-18 diff --git a/src/main/java/WayofTime/bloodmagic/block/BlockDemonCrystal.java b/src/main/java/WayofTime/bloodmagic/block/BlockDemonCrystal.java index 6ed5e8ef..0fc2c62e 100644 --- a/src/main/java/WayofTime/bloodmagic/block/BlockDemonCrystal.java +++ b/src/main/java/WayofTime/bloodmagic/block/BlockDemonCrystal.java @@ -24,10 +24,15 @@ import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; import WayofTime.bloodmagic.BloodMagic; import WayofTime.bloodmagic.api.Constants; +import WayofTime.bloodmagic.api.altar.IAltarManipulator; +import WayofTime.bloodmagic.api.iface.IAltarReader; import WayofTime.bloodmagic.api.soul.EnumDemonWillType; +import WayofTime.bloodmagic.api.soul.PlayerDemonWillHandler; import WayofTime.bloodmagic.item.ItemComponent; import WayofTime.bloodmagic.item.ItemDemonCrystal; +import WayofTime.bloodmagic.tile.TileAltar; import WayofTime.bloodmagic.tile.TileDemonCrystal; +import WayofTime.bloodmagic.util.Utils; public class BlockDemonCrystal extends BlockContainer { @@ -158,7 +163,7 @@ public class BlockDemonCrystal extends BlockContainer world.removeTileEntity(pos); } - private ItemStack getItemStackDropped(EnumDemonWillType type, int crystalNumber) + public static ItemStack getItemStackDropped(EnumDemonWillType type, int crystalNumber) { ItemStack stack = null; switch (type) @@ -190,6 +195,26 @@ public class BlockDemonCrystal extends BlockContainer return 0; } + @Override + public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumFacing side, float hitX, float hitY, float hitZ) + { + if (world.isRemote) + { + return true; + } + + TileDemonCrystal crystal = (TileDemonCrystal) world.getTileEntity(pos); + + if (PlayerDemonWillHandler.getTotalDemonWill(EnumDemonWillType.DEFAULT, player) > 1024) + { + crystal.dropSingleCrystal(); + + world.markBlockForUpdate(pos); + } + + return true; + } + // @Override // public java.util.List getDrops(net.minecraft.world.IBlockAccess world, BlockPos pos, IBlockState state, int fortune) // { diff --git a/src/main/java/WayofTime/bloodmagic/registry/ModRecipes.java b/src/main/java/WayofTime/bloodmagic/registry/ModRecipes.java index 7127029d..ee079ba1 100644 --- a/src/main/java/WayofTime/bloodmagic/registry/ModRecipes.java +++ b/src/main/java/WayofTime/bloodmagic/registry/ModRecipes.java @@ -222,7 +222,10 @@ public class ModRecipes TartaricForgeRecipeRegistry.registerRecipe(new ItemStack(ModBlocks.demonCrystal, 1, 0), 1200, 100, ItemDemonCrystal.getStack(ItemDemonCrystal.CRYSTAL_DEFAULT), ItemDemonCrystal.getStack(ItemDemonCrystal.CRYSTAL_DEFAULT), ItemDemonCrystal.getStack(ItemDemonCrystal.CRYSTAL_DEFAULT), ItemDemonCrystal.getStack(ItemDemonCrystal.CRYSTAL_DEFAULT)); TartaricForgeRecipeRegistry.registerRecipe(new ItemStack(ModBlocks.demonCrystal, 1, 1), 1200, 100, ItemDemonCrystal.getStack(ItemDemonCrystal.CRYSTAL_CORROSIVE), ItemDemonCrystal.getStack(ItemDemonCrystal.CRYSTAL_CORROSIVE), ItemDemonCrystal.getStack(ItemDemonCrystal.CRYSTAL_CORROSIVE), ItemDemonCrystal.getStack(ItemDemonCrystal.CRYSTAL_CORROSIVE)); TartaricForgeRecipeRegistry.registerRecipe(new ItemStack(ModBlocks.demonCrystal, 1, 2), 1200, 100, ItemDemonCrystal.getStack(ItemDemonCrystal.CRYSTAL_DESTRUCTIVE), ItemDemonCrystal.getStack(ItemDemonCrystal.CRYSTAL_DESTRUCTIVE), ItemDemonCrystal.getStack(ItemDemonCrystal.CRYSTAL_DESTRUCTIVE), ItemDemonCrystal.getStack(ItemDemonCrystal.CRYSTAL_DESTRUCTIVE)); - TartaricForgeRecipeRegistry.registerRecipe(new ItemStack(ModBlocks.demonCrystal, 1, 3), 1200, 100, ItemDemonCrystal.getStack(ItemDemonCrystal.CRYSTAL_VENGEFUL), ItemDemonCrystal.getStack(ItemDemonCrystal.CRYSTAL_VENGEFUL), ItemDemonCrystal.getStack(ItemDemonCrystal.CRYSTAL_VENGEFUL), ItemDemonCrystal.getStack(ItemDemonCrystal.CRYSTAL_VENGEFUL)); TartaricForgeRecipeRegistry.registerRecipe(new ItemStack(ModBlocks.demonCrystal, 1, 4), 1200, 100, ItemDemonCrystal.getStack(ItemDemonCrystal.CRYSTAL_STEADFAST), ItemDemonCrystal.getStack(ItemDemonCrystal.CRYSTAL_STEADFAST), ItemDemonCrystal.getStack(ItemDemonCrystal.CRYSTAL_STEADFAST), ItemDemonCrystal.getStack(ItemDemonCrystal.CRYSTAL_STEADFAST)); + + TartaricForgeRecipeRegistry.registerRecipe(new ItemStack(ModBlocks.demonCrucible), 400, 100, Items.cauldron, "stone", "gemLapis", "gemDiamond"); + TartaricForgeRecipeRegistry.registerRecipe(new ItemStack(ModBlocks.demonPylon), 400, 50, "blockIron", "stone", "gemLapis", ModItems.itemDemonCrystal); + TartaricForgeRecipeRegistry.registerRecipe(new ItemStack(ModBlocks.demonCrystallizer), 500, 100, ModBlocks.soulForge, "stone", "gemLapis", "blockGlass"); } } diff --git a/src/main/java/WayofTime/bloodmagic/tile/TileDemonCrystal.java b/src/main/java/WayofTime/bloodmagic/tile/TileDemonCrystal.java index bf2ec092..88175049 100644 --- a/src/main/java/WayofTime/bloodmagic/tile/TileDemonCrystal.java +++ b/src/main/java/WayofTime/bloodmagic/tile/TileDemonCrystal.java @@ -3,6 +3,8 @@ package WayofTime.bloodmagic.tile; import lombok.Getter; import lombok.Setter; import net.minecraft.block.state.IBlockState; +import net.minecraft.entity.item.EntityItem; +import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.network.NetworkManager; import net.minecraft.network.Packet; @@ -16,6 +18,7 @@ import net.minecraft.world.World; import WayofTime.bloodmagic.api.soul.DemonWillHolder; import WayofTime.bloodmagic.api.soul.EnumDemonWillType; import WayofTime.bloodmagic.api.soul.IDemonWillConduit; +import WayofTime.bloodmagic.block.BlockDemonCrystal; import WayofTime.bloodmagic.demonAura.WorldDemonWillHandler; public class TileDemonCrystal extends TileEntity implements ITickable, IDemonWillConduit @@ -96,6 +99,24 @@ public class TileDemonCrystal extends TileEntity implements ITickable, IDemonWil // } } + public boolean dropSingleCrystal() + { + if (!worldObj.isRemote && crystalCount > 1) + { + IBlockState state = worldObj.getBlockState(pos); + EnumDemonWillType type = state.getValue(BlockDemonCrystal.TYPE); + ItemStack stack = BlockDemonCrystal.getItemStackDropped(type, 1); + if (stack != null) + { + crystalCount--; + worldObj.spawnEntityInWorld(new EntityItem(worldObj, pos.getX() + 0.5, pos.getY() + 0.5, pos.getZ() + 0.5, stack)); + return true; + } + } + + return false; + } + public double getCrystalGrowthPerSecond(double will) { return 1.0 / 800 * Math.sqrt(will / 200);