diff --git a/src/main/java/WayofTime/alchemicalWizardry/ModBlocks.java b/src/main/java/WayofTime/alchemicalWizardry/ModBlocks.java index f451d5ad..bf90abce 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/ModBlocks.java +++ b/src/main/java/WayofTime/alchemicalWizardry/ModBlocks.java @@ -7,6 +7,7 @@ import WayofTime.alchemicalWizardry.common.block.BlockAltar; import WayofTime.alchemicalWizardry.common.block.BlockBelljar; import WayofTime.alchemicalWizardry.common.block.BlockBloodLightSource; import WayofTime.alchemicalWizardry.common.block.BlockConduit; +import WayofTime.alchemicalWizardry.common.block.BlockCrucible; import WayofTime.alchemicalWizardry.common.block.BlockCrystal; import WayofTime.alchemicalWizardry.common.block.BlockDemonPortal; import WayofTime.alchemicalWizardry.common.block.BlockEnchantmentGlyph; @@ -98,7 +99,7 @@ public class ModBlocks public static Block blockMimic; public static Block blockEnchantmentGlyph; public static Block blockStabilityGlyph; - + public static Block blockIncence; public static void init() { @@ -141,6 +142,7 @@ public class ModBlocks blockLifeEssence = new LifeEssenceBlock(); blockEnchantmentGlyph = new BlockEnchantmentGlyph(); blockStabilityGlyph = new BlockStabilityGlyph(); + blockIncence = new BlockCrucible(); } public static void registerBlocksInPre() @@ -186,6 +188,8 @@ public class ModBlocks GameRegistry.registerBlock(ModBlocks.blockMimic, "blockMimic"); GameRegistry.registerBlock(ModBlocks.blockEnchantmentGlyph, ItemEnchantmentGlyphBlock.class, "blockEnchantmentGlyph"); GameRegistry.registerBlock(ModBlocks.blockStabilityGlyph, ItemStabilityGlyphBlock.class, "blockStabilityGlyph"); + +// GameRegistry.registerBlock(ModBlocks.blockIncence, "blockIncence"); } public static void registerBlocksInInit() diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/block/BlockCrucible.java b/src/main/java/WayofTime/alchemicalWizardry/common/block/BlockCrucible.java new file mode 100644 index 00000000..b9b778e0 --- /dev/null +++ b/src/main/java/WayofTime/alchemicalWizardry/common/block/BlockCrucible.java @@ -0,0 +1,42 @@ +package WayofTime.alchemicalWizardry.common.block; + +import WayofTime.alchemicalWizardry.AlchemicalWizardry; +import net.minecraft.block.Block; +import net.minecraft.block.material.Material; +import net.minecraft.util.AxisAlignedBB; +import net.minecraft.world.IBlockAccess; +import net.minecraft.world.World; + +public class BlockCrucible extends Block +{ + public BlockCrucible() + { + super(Material.anvil); + this.setCreativeTab(AlchemicalWizardry.tabBloodMagic); + this.setBlockName("blockIncence"); + } + + @Override + public AxisAlignedBB getCollisionBoundingBoxFromPool(World world, int x, int y, int z) + { + return null; + } + + @Override + public void setBlockBoundsBasedOnState(IBlockAccess world, int x, int y, int z) + { + this.setBlockBounds(0.4F, 0.0F, 0.4F, 0.6F, 0.8F, 0.6F); + } + + @Override + public boolean isOpaqueCube() + { + return false; + } + + @Override + public boolean renderAsNormalBlock() + { + return false; + } +} diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/block/BlockReagentConduit.java b/src/main/java/WayofTime/alchemicalWizardry/common/block/BlockReagentConduit.java index 16c151f3..eeae6acc 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/block/BlockReagentConduit.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/block/BlockReagentConduit.java @@ -1,16 +1,15 @@ package WayofTime.alchemicalWizardry.common.block; -import WayofTime.alchemicalWizardry.AlchemicalWizardry; -import WayofTime.alchemicalWizardry.common.tileEntity.TEReagentConduit; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; import net.minecraft.block.BlockContainer; import net.minecraft.block.material.Material; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.AxisAlignedBB; import net.minecraft.world.World; +import WayofTime.alchemicalWizardry.AlchemicalWizardry; +import WayofTime.alchemicalWizardry.common.tileEntity.TEReagentConduit; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; public class BlockReagentConduit extends BlockContainer { @@ -66,9 +65,9 @@ public class BlockReagentConduit extends BlockContainer return -1; } - @Override - public AxisAlignedBB getCollisionBoundingBoxFromPool(World p_149668_1_, int p_149668_2_, int p_149668_3_, int p_149668_4_) - { - return null; - } +// @Override +// public AxisAlignedBB getCollisionBoundingBoxFromPool(World p_149668_1_, int p_149668_2_, int p_149668_3_, int p_149668_4_) +// { +// return null; +// } } diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/book/BloodMagicGuide.java b/src/main/java/WayofTime/alchemicalWizardry/common/book/BloodMagicGuide.java index 39d80597..4d2d52f1 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/book/BloodMagicGuide.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/book/BloodMagicGuide.java @@ -155,9 +155,15 @@ public class BloodMagicGuide fivePeoplePages.addAll(PageHelper.pagesForLongText(StatCollector.translateToLocal("aw.entries.architect.fivePeople"))); entries.add(new EntryUniText(fivePeoplePages, "guide.BloodMagic.entryName.architect.fivePeople")); + ArrayList tier3Pages = new ArrayList(); + tier3Pages.add(new PageUnlocImage("", new ResourceLocation("alchemicalwizardry:textures/misc/screenshots/altars/T3.png"), true)); + tier3Pages.addAll(PageHelper.pagesForLongText(StatCollector.translateToLocal("aw.entries.architect.tier3"))); + entries.add(new EntryUniText(tier3Pages, "guide.BloodMagic.entryName.architect.tier3")); - - + ArrayList magicianOrbPages = new ArrayList(); + magicianOrbPages.add(new PageAltarRecipe(RecipeHolder.magicianBloodOrbRecipe)); + magicianOrbPages.addAll(PageHelper.pagesForLongText(StatCollector.translateToLocal("aw.entries.architect.magicianOrb"))); + entries.add(new EntryUniText(magicianOrbPages, "guide.BloodMagic.entryName.architect.magicianOrb")); categories.add(new CategoryItemStack(entries, "guide.BloodMagic.category.architect", new ItemStack(ModItems.divinationSigil))); } diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/demonVillage/tileEntity/TEDemonPortal.java b/src/main/java/WayofTime/alchemicalWizardry/common/demonVillage/tileEntity/TEDemonPortal.java index 6d6ad11d..0a7b1ab3 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/demonVillage/tileEntity/TEDemonPortal.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/demonVillage/tileEntity/TEDemonPortal.java @@ -63,7 +63,7 @@ public class TEDemonPortal extends TileEntity public static int[] tierCostList = new int[]{1500}; - public static Set hoardList = new HashSet(); + public Set hoardList = new HashSet(); public static List buildingList = new ArrayList(); public Random rand = new Random(); diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/items/ItemRitualDiviner.java b/src/main/java/WayofTime/alchemicalWizardry/common/items/ItemRitualDiviner.java index 073eeeb0..91e7d8f7 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/items/ItemRitualDiviner.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/items/ItemRitualDiviner.java @@ -5,6 +5,7 @@ import java.util.List; import net.minecraft.block.Block; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.creativetab.CreativeTabs; +import net.minecraft.entity.Entity; import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.Item; @@ -21,7 +22,9 @@ import org.lwjgl.input.Keyboard; import WayofTime.alchemicalWizardry.AlchemicalWizardry; import WayofTime.alchemicalWizardry.ModBlocks; +import WayofTime.alchemicalWizardry.api.Int3; import WayofTime.alchemicalWizardry.api.items.interfaces.IRitualDiviner; +import WayofTime.alchemicalWizardry.api.rituals.IMasterRitualStone; import WayofTime.alchemicalWizardry.api.rituals.IRitualStone; import WayofTime.alchemicalWizardry.api.rituals.RitualComponent; import WayofTime.alchemicalWizardry.api.rituals.Rituals; @@ -51,14 +54,14 @@ public class ItemRitualDiviner extends EnergyItems implements IRitualDiviner } @Override - public void addInformation(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, List par3List, boolean par4) + public void addInformation(ItemStack stack, EntityPlayer player, List par3List, boolean x) { par3List.add(StatCollector.translateToLocal("tooltip.ritualdiviner.desc")); - if (this.getMaxRuneDisplacement(par1ItemStack) == 1) + if (this.getMaxRuneDisplacement(stack) == 1) { par3List.add(StatCollector.translateToLocal("tooltip.ritualdiviner.canplace")); - }else if (this.getMaxRuneDisplacement(par1ItemStack) >= 2) + }else if (this.getMaxRuneDisplacement(stack) >= 2) { par3List.add(StatCollector.translateToLocal("tooltip.ritualdiviner.canplacedawn")); @@ -67,19 +70,19 @@ public class ItemRitualDiviner extends EnergyItems implements IRitualDiviner par3List.add(StatCollector.translateToLocal("tooltip.ritualdiviner.cannotplace")); } - par3List.add(StatCollector.translateToLocal("tooltip.ritualdiviner.ritualtunedto") + " " + this.getNameForDirection(this.getDirection(par1ItemStack))); + par3List.add(StatCollector.translateToLocal("tooltip.ritualdiviner.ritualtunedto") + " " + this.getNameForDirection(this.getDirection(stack))); boolean sneaking = Keyboard.isKeyDown(Keyboard.KEY_RSHIFT) || Keyboard.isKeyDown(Keyboard.KEY_LSHIFT); if(sneaking) { - if (!(par1ItemStack.getTagCompound() == null)) + if (!(stack.getTagCompound() == null)) { - String ritualID = this.getCurrentRitual(par1ItemStack); + String ritualID = this.getCurrentRitual(stack); //TODO - par3List.add(StatCollector.translateToLocal("tooltip.owner.currentowner") + " " + par1ItemStack.getTagCompound().getString("ownerName")); + par3List.add(StatCollector.translateToLocal("tooltip.owner.currentowner") + " " + stack.getTagCompound().getString("ownerName")); par3List.add(StatCollector.translateToLocal("tooltip.alchemy.ritualid") + " " + ritualID); - List ritualList = Rituals.getRitualList(this.getCurrentRitual(par1ItemStack)); + List ritualList = Rituals.getRitualList(this.getCurrentRitual(stack)); if (ritualList == null) { return; @@ -146,35 +149,56 @@ public class ItemRitualDiviner extends EnergyItems implements IRitualDiviner } @Override - public String getItemStackDisplayName(ItemStack par1ItemStack) + public String getItemStackDisplayName(ItemStack stack) { - if (!(par1ItemStack.getTagCompound() == null)) + if (!(stack.getTagCompound() == null)) { - String ritualID = this.getCurrentRitual(par1ItemStack); + String ritualID = this.getCurrentRitual(stack); if (ritualID.equals("")) { - return super.getItemStackDisplayName(par1ItemStack); + return super.getItemStackDisplayName(stack); } return "Ritual: " + Rituals.getNameOfRitual(ritualID); } else { - return super.getItemStackDisplayName(par1ItemStack); + return super.getItemStackDisplayName(stack); } } @Override - public boolean onItemUse(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, World par3World, int par4, int par5, int par6, int par7, float par8, float par9, float par10) + public boolean onItemUse(ItemStack stack, EntityPlayer player, World world, int x, int y, int z, int par7, float par8, float par9, float par10) { - int direction = this.getDirection(par1ItemStack); - - if (!EnergyItems.checkAndSetItemOwner(par1ItemStack, par2EntityPlayer)) return false; - ItemStack[] playerInventory = par2EntityPlayer.inventory.mainInventory; - TileEntity tileEntity = par3World.getTileEntity(par4, par5, par6); + if (!EnergyItems.checkAndSetItemOwner(stack, player)) return false; + + if(placeRitualStoneAtMasterStone(stack, player, world, x, y, z)) + { + this.setStoredLocation(stack, new Int3(x, y, z)); + return true; + }else if(!(world.getBlock(x, y, z) instanceof IRitualStone || world.getBlock(x, y, z) instanceof IMasterRitualStone) && !player.isSneaking()) + { + if(world.isRemote) + { + return false; + } + this.cycleDirection(stack); + player.addChatComponentMessage(new ChatComponentText(StatCollector.translateToLocal("tooltip.ritualdiviner.ritualtunedto") + " " + this.getNameForDirection(this.getDirection(stack)))); + return true; + } + + return false; + } + + public boolean placeRitualStoneAtMasterStone(ItemStack stack, EntityPlayer player, World world, int x, int y, int z) + { + int direction = this.getDirection(stack); + + ItemStack[] playerInventory = player.inventory.mainInventory; + TileEntity tileEntity = world.getTileEntity(x, y, z); if (tileEntity instanceof TEMasterStone) { TEMasterStone masterStone = (TEMasterStone) tileEntity; - List ritualList = Rituals.getRitualList(this.getCurrentRitual(par1ItemStack)); + List ritualList = Rituals.getRitualList(this.getCurrentRitual(stack)); if (ritualList == null) { return false; @@ -198,28 +222,28 @@ public class ItemRitualDiviner extends EnergyItems implements IRitualDiviner for (RitualComponent rc : ritualList) { - if (par3World.isAirBlock(par4 + rc.getX(direction), par5 + rc.getY(), par6 + rc.getZ(direction))) + if (world.isAirBlock(x + rc.getX(direction), y + rc.getY(), z + rc.getZ(direction))) { - if (playerInvRitualStoneLocation >= 0 || par2EntityPlayer.capabilities.isCreativeMode) + if (playerInvRitualStoneLocation >= 0 || player.capabilities.isCreativeMode) { - if (rc.getStoneType() > this.maxMetaData + this.getMaxRuneDisplacement(par1ItemStack)) + if (rc.getStoneType() > this.maxMetaData + this.getMaxRuneDisplacement(stack)) { - par3World.playAuxSFX(200, par4, par5 + 1, par6, 0); + world.playAuxSFX(200, x, y + 1, z, 0); return true; } - if (!par2EntityPlayer.capabilities.isCreativeMode) + if (!player.capabilities.isCreativeMode) { - par2EntityPlayer.inventory.decrStackSize(playerInvRitualStoneLocation, 1); + player.inventory.decrStackSize(playerInvRitualStoneLocation, 1); } - if(EnergyItems.syphonBatteries(par1ItemStack, par2EntityPlayer, getEnergyUsed())) + if(EnergyItems.syphonBatteries(stack, player, getEnergyUsed())) { - par3World.setBlock(par4 + rc.getX(direction), par5 + rc.getY(), par6 + rc.getZ(direction), ModBlocks.ritualStone, rc.getStoneType(), 3); + world.setBlock(x + rc.getX(direction), y + rc.getY(), z + rc.getZ(direction), ModBlocks.ritualStone, rc.getStoneType(), 3); - if (par3World.isRemote) + if (world.isRemote) { - par3World.playAuxSFX(2005, par4, par5 + 1, par6, 0); + world.playAuxSFX(2005, x, y + 1, z, 0); return true; } @@ -229,56 +253,119 @@ public class ItemRitualDiviner extends EnergyItems implements IRitualDiviner } } else { - Block block = par3World.getBlock(par4 + rc.getX(direction), par5 + rc.getY(), par6 + rc.getZ(direction)); + Block block = world.getBlock(x + rc.getX(direction), y + rc.getY(), z + rc.getZ(direction)); if (block == ModBlocks.ritualStone) { - int metadata = par3World.getBlockMetadata(par4 + rc.getX(direction), par5 + rc.getY(), par6 + rc.getZ(direction)); + int metadata = world.getBlockMetadata(x + rc.getX(direction), y + rc.getY(), z + rc.getZ(direction)); if (metadata != rc.getStoneType()) { - if(EnergyItems.syphonBatteries(par1ItemStack, par2EntityPlayer, getEnergyUsed())) + if(EnergyItems.syphonBatteries(stack, player, getEnergyUsed())) { - if (rc.getStoneType() > this.maxMetaData + this.getMaxRuneDisplacement(par1ItemStack)) + if (rc.getStoneType() > this.maxMetaData + this.getMaxRuneDisplacement(stack)) { - par3World.playAuxSFX(200, par4, par5 + 1, par6, 0); + world.playAuxSFX(200, x, y + 1, z, 0); return true; } - par3World.setBlockMetadataWithNotify(par4 + rc.getX(direction), par5 + rc.getY(), par6 + rc.getZ(direction), rc.getStoneType(), 3); + world.setBlockMetadataWithNotify(x + rc.getX(direction), y + rc.getY(), z + rc.getZ(direction), rc.getStoneType(), 3); return true; } } } else { - par3World.playAuxSFX(0000, par4, par5 + 1, par6, 0); + world.playAuxSFX(0000, x, y + 1, z, 0); return true; } } } - }else if(!(par3World.getBlock(par4, par5, par6) instanceof IRitualStone) && !par2EntityPlayer.isSneaking()) - { - if(par3World.isRemote) - { - return false; - } - this.cycleDirection(par1ItemStack); - par2EntityPlayer.addChatComponentMessage(new ChatComponentText(StatCollector.translateToLocal("tooltip.ritualdiviner.ritualtunedto") + " " + this.getNameForDirection(this.getDirection(par1ItemStack)))); - return true; } return false; } @Override - public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) + public void onUpdate(ItemStack stack, World world, Entity entity, int par4, boolean par5) { - if (EnergyItems.checkAndSetItemOwner(par1ItemStack, par3EntityPlayer) && par3EntityPlayer.isSneaking()) + if(entity instanceof EntityPlayer && hasStoredLocation(stack) && world.getWorldTime() % 5 == 0) + { + Int3 loc = getStoredLocation(stack); + + int x = loc.xCoord; + int y = loc.yCoord; + int z = loc.zCoord; + + if(!this.placeRitualStoneAtMasterStone(stack, (EntityPlayer)entity, world, x, y, z)) + { + this.voidStoredLocation(stack); + } + } + } + + public void setStoredLocation(ItemStack stack, Int3 location) + { + NBTTagCompound tag = stack.getTagCompound(); + if(tag == null) + { + tag = new NBTTagCompound(); + stack.setTagCompound(tag); + } + + NBTTagCompound locTag = location.writeToNBT(new NBTTagCompound()); + locTag.setBoolean("isStored", true); + + tag.setTag("location", locTag); + } + + public void voidStoredLocation(ItemStack stack) + { + NBTTagCompound tag = stack.getTagCompound(); + if(tag == null || !tag.hasKey("location")) + { + tag = new NBTTagCompound(); + stack.setTagCompound(tag); + } + + NBTTagCompound locTag = (NBTTagCompound)tag.getTag("location"); + locTag.setBoolean("isStored", false); + } + + public Int3 getStoredLocation(ItemStack stack) + { + NBTTagCompound tag = stack.getTagCompound(); + if(tag == null || !tag.hasKey("location")) + { + return new Int3(0, 0, 0); + } + + NBTTagCompound locTag = (NBTTagCompound)tag.getTag("location"); + + return Int3.readFromNBT(locTag); + } + + public boolean hasStoredLocation(ItemStack stack) + { + NBTTagCompound tag = stack.getTagCompound(); + if(tag == null || !tag.hasKey("location")) + { + return false; + } + + NBTTagCompound locTag = (NBTTagCompound)tag.getTag("location"); + + return locTag.getBoolean("isStored"); + } + + @Override + public ItemStack onItemRightClick(ItemStack stack, World par2World, EntityPlayer par3EntityPlayer) + { + if (EnergyItems.checkAndSetItemOwner(stack, par3EntityPlayer) && par3EntityPlayer.isSneaking()) { - rotateRituals(par2World,par3EntityPlayer, par1ItemStack, true); + rotateRituals(par2World,par3EntityPlayer, stack, true); } - return par1ItemStack; + return stack; } @Override @@ -327,37 +414,37 @@ public class ItemRitualDiviner extends EnergyItems implements IRitualDiviner } @Override - public String getCurrentRitual(ItemStack par1ItemStack) + public String getCurrentRitual(ItemStack stack) { - if (par1ItemStack.getTagCompound() == null) + if (stack.getTagCompound() == null) { - par1ItemStack.setTagCompound(new NBTTagCompound()); + stack.setTagCompound(new NBTTagCompound()); } - return par1ItemStack.getTagCompound().getString("ritualID"); + return stack.getTagCompound().getString("ritualID"); } @Override - public void setCurrentRitual(ItemStack par1ItemStack, String ritualID) + public void setCurrentRitual(ItemStack stack, String ritualID) { - if (par1ItemStack.getTagCompound() == null) + if (stack.getTagCompound() == null) { - par1ItemStack.setTagCompound(new NBTTagCompound()); + stack.setTagCompound(new NBTTagCompound()); } - par1ItemStack.getTagCompound().setString("ritualID", ritualID); + stack.getTagCompound().setString("ritualID", ritualID); } @Override - public int getMaxRuneDisplacement(ItemStack par1ItemStack) //0 indicates the starting 4 runes, 1 indicates it can use Dusk runes + public int getMaxRuneDisplacement(ItemStack stack) //0 indicates the starting 4 runes, 1 indicates it can use Dusk runes { - return par1ItemStack.getItemDamage(); + return stack.getItemDamage(); } @Override - public void setMaxRuneDisplacement(ItemStack par1ItemStack, int displacement) + public void setMaxRuneDisplacement(ItemStack stack, int displacement) { - par1ItemStack.setItemDamage(displacement); + stack.setItemDamage(displacement); } @Override diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/items/SacrificialDagger.java b/src/main/java/WayofTime/alchemicalWizardry/common/items/SacrificialDagger.java index e073c620..b3bc65f1 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/items/SacrificialDagger.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/items/SacrificialDagger.java @@ -3,9 +3,13 @@ package WayofTime.alchemicalWizardry.common.items; import java.util.List; import net.minecraft.client.renderer.texture.IIconRegister; +import net.minecraft.entity.Entity; import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.EnumAction; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.potion.Potion; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.DamageSource; import net.minecraft.util.StatCollector; @@ -42,7 +46,8 @@ public class SacrificialDagger extends Item } } - public void addInformation(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, List par3List, boolean par4) + @Override + public void addInformation(ItemStack stack, EntityPlayer par2EntityPlayer, List par3List, boolean par4) { if (AlchemicalWizardry.wimpySettings) { @@ -53,37 +58,73 @@ public class SacrificialDagger extends Item par3List.add(StatCollector.translateToLocal("tooltip.sacrificialdagger.desc3")); } } - - public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) + + /** + * called when the player releases the use item button. Args: itemstack, world, entityplayer, itemInUseCount + */ + @Override + public void onPlayerStoppedUsing(ItemStack stack, World world, EntityPlayer player, int itemInUseCount) { - if (!par3EntityPlayer.capabilities.isCreativeMode) + if(itemInUseCount < 32) { - SacrificeKnifeUsedEvent evt = new SacrificeKnifeUsedEvent(par3EntityPlayer, true, true, 2); + return; + } + + + } + + @Override + public int getMaxItemUseDuration(ItemStack stack) + { + return 72000; + } + + /** + * returns the action that specifies what animation to play when the items is being used + */ + @Override + public EnumAction getItemUseAction(ItemStack stack) + { + return EnumAction.bow; + } + + @Override + public ItemStack onItemRightClick(ItemStack stack, World world, EntityPlayer player) + { + if (this.canUseForSacrifice(stack)) + { + player.setItemInUse(stack, this.getMaxItemUseDuration(stack)); + return stack; + } + + if (!player.capabilities.isCreativeMode) + { + SacrificeKnifeUsedEvent evt = new SacrificeKnifeUsedEvent(player, true, true, 2); if(MinecraftForge.EVENT_BUS.post(evt)) { - return par1ItemStack; + return stack; } if(evt.shouldDrainHealth) { - par3EntityPlayer.setHealth(par3EntityPlayer.getHealth() - 2); + player.setHealth(player.getHealth() - 2); } if(!evt.shouldFillAltar) { - return par1ItemStack; + return stack; } } - if (par3EntityPlayer instanceof FakePlayer) + if (player instanceof FakePlayer) { - return par1ItemStack; + return stack; } - double posX = par3EntityPlayer.posX; - double posY = par3EntityPlayer.posY; - double posZ = par3EntityPlayer.posZ; - par2World.playSoundEffect((double) ((float) posX + 0.5F), (double) ((float) posY + 0.5F), (double) ((float) posZ + 0.5F), "random.fizz", 0.5F, 2.6F + (par2World.rand.nextFloat() - par2World.rand.nextFloat()) * 0.8F); + double posX = player.posX; + double posY = player.posY; + double posZ = player.posZ; + world.playSoundEffect((double) ((float) posX + 0.5F), (double) ((float) posY + 0.5F), (double) ((float) posZ + 0.5F), "random.fizz", 0.5F, 2.6F + (world.rand.nextFloat() - world.rand.nextFloat()) * 0.8F); float f = (float) 1.0F; float f1 = f * 0.6F + 0.4F; float f2 = f * f * 0.7F - 0.5F; @@ -91,28 +132,28 @@ public class SacrificialDagger extends Item for (int l = 0; l < 8; ++l) { - par2World.spawnParticle("reddust", posX + Math.random() - Math.random(), posY + Math.random() - Math.random(), posZ + Math.random() - Math.random(), f1, f2, f3); + world.spawnParticle("reddust", posX + Math.random() - Math.random(), posY + Math.random() - Math.random(), posZ + Math.random() - Math.random(), f1, f2, f3); } - if (!par2World.isRemote && SpellHelper.isFakePlayer(par2World, par3EntityPlayer)) + if (!world.isRemote && SpellHelper.isFakePlayer(world, player)) { - return par1ItemStack; + return stack; } - if (par3EntityPlayer.isPotionActive(AlchemicalWizardry.customPotionSoulFray)) + if (player.isPotionActive(AlchemicalWizardry.customPotionSoulFray)) { - findAndFillAltar(par2World, par3EntityPlayer, 20); + findAndFillAltar(world, player, 20); } else { - findAndFillAltar(par2World, par3EntityPlayer, 200); + findAndFillAltar(world, player, 200); } - if (par3EntityPlayer.getHealth() <= 0.001f) + if (player.getHealth() <= 0.001f) { - par3EntityPlayer.onDeath(DamageSource.generic); + player.onDeath(DamageSource.generic); } - return par1ItemStack; + return stack; } public void findAndFillAltar(World world, EntityPlayer player, int amount) @@ -142,40 +183,64 @@ public class SacrificialDagger extends Item for (int k = -2; k <= 1; k++) { tileEntity = world.getTileEntity(i + x, k + y, j + z); - - if ((tileEntity instanceof IBloodAltar)) - { - return (IBloodAltar) tileEntity; - } - } - - if ((tileEntity instanceof IBloodAltar)) - { - return (IBloodAltar) tileEntity; } } - - if ((tileEntity instanceof IBloodAltar)) - { - return (IBloodAltar) tileEntity; - } - } - - if ((tileEntity instanceof IBloodAltar)) - { - return (IBloodAltar) tileEntity; } return null; } - + @Override - public String getItemStackDisplayName(ItemStack par1ItemStack) + public void onUpdate(ItemStack stack, World world, Entity entity, int par4, boolean par5) + { + if(!world.isRemote && entity instanceof EntityPlayer) + { + this.setUseForSacrifice(stack, this.isPlayerPreparedForSacrifice(world, (EntityPlayer)entity)); + } + } + + @Override + public String getItemStackDisplayName(ItemStack stack) { if (AlchemicalWizardry.wimpySettings) { return "Sacrificial Orb"; } - return super.getItemStackDisplayName(par1ItemStack); + return super.getItemStackDisplayName(stack); + } + + public boolean isPlayerPreparedForSacrifice(World world, EntityPlayer player) + { + return !world.isRemote && player.isPotionActive(Potion.regeneration); + } + + public boolean canUseForSacrifice(ItemStack stack) + { + NBTTagCompound tag = stack.getTagCompound(); + if(tag == null) + { + return false; + } + + return tag.getBoolean("sacrifice"); + } + + public void setUseForSacrifice(ItemStack stack, boolean sacrifice) + { + NBTTagCompound tag = stack.getTagCompound(); + if(tag == null) + { + tag = new NBTTagCompound(); + stack.setTagCompound(tag); + } + + tag.setBoolean("sacrifice", sacrifice); + } + + @Override + @SideOnly(Side.CLIENT) + public boolean hasEffect(ItemStack stack, int pass) + { + return this.canUseForSacrifice(stack) ? true : super.hasEffect(stack, pass); } } \ No newline at end of file diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/rituals/RitualEffectAutoAlchemy.java b/src/main/java/WayofTime/alchemicalWizardry/common/rituals/RitualEffectAutoAlchemy.java index 9cfae056..e3581192 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/rituals/RitualEffectAutoAlchemy.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/rituals/RitualEffectAutoAlchemy.java @@ -1,5 +1,15 @@ package WayofTime.alchemicalWizardry.common.rituals; +import java.util.ArrayList; +import java.util.List; + +import net.minecraft.inventory.IInventory; +import net.minecraft.inventory.ISidedInventory; +import net.minecraft.item.ItemStack; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.world.World; +import net.minecraftforge.common.util.ForgeDirection; +import net.minecraftforge.oredict.OreDictionary; import WayofTime.alchemicalWizardry.api.alchemy.AlchemyRecipeRegistry; import WayofTime.alchemicalWizardry.api.alchemy.energy.ReagentRegistry; import WayofTime.alchemicalWizardry.api.rituals.IMasterRitualStone; @@ -8,14 +18,6 @@ import WayofTime.alchemicalWizardry.api.rituals.RitualEffect; import WayofTime.alchemicalWizardry.api.soulNetwork.SoulNetworkHandler; import WayofTime.alchemicalWizardry.api.tile.IBloodAltar; import WayofTime.alchemicalWizardry.common.tileEntity.TEWritingTable; -import net.minecraft.inventory.IInventory; -import net.minecraft.item.ItemStack; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.world.World; -import net.minecraftforge.oredict.OreDictionary; - -import java.util.ArrayList; -import java.util.List; public class RitualEffectAutoAlchemy extends RitualEffect { @@ -269,6 +271,12 @@ public class RitualEffectAutoAlchemy extends RitualEffect { continue; } + + if(!inputInv1.isItemValidForSlot(j, curItem) || (inputInv1 instanceof ISidedInventory && !((ISidedInventory) inputInv1).canExtractItem(j, curItem, ForgeDirection.DOWN.ordinal()))) + { + continue; + } + if (areItemStacksEqualWithWildcard(recItem, curItem)) { if (alchStack == null) diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/tileEntity/TEAltar.java b/src/main/java/WayofTime/alchemicalWizardry/common/tileEntity/TEAltar.java index 0a703f49..a3e8c653 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/tileEntity/TEAltar.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/tileEntity/TEAltar.java @@ -501,22 +501,22 @@ public class TEAltar extends TEInventory implements IFluidTank, IFluidHandler, I } } - if (AlchemicalWizardry.causeHungerWithRegen) - { - List list = SpellHelper.getPlayersInRange(worldObj, xCoord + 0.5, yCoord + 0.5, zCoord + 0.5, 15, 15); - for (EntityPlayer player : list) - { - PotionEffect regenEffect = player.getActivePotionEffect(Potion.regeneration); - if (regenEffect != null && regenEffect.getAmplifier() > 0) - { - if(AlchemicalWizardry.causeHungerChatMessage && !player.isPotionActive(Potion.hunger.id)) - { - player.addChatComponentMessage(new ChatComponentText(StatCollector.translateToLocal("message.altar.hunger"))); - } - player.addPotionEffect(new PotionEffect(Potion.hunger.id, 40, regenEffect.getAmplifier() * 2 - 2)); - } - } - } +// if (AlchemicalWizardry.causeHungerWithRegen) +// { +// List list = SpellHelper.getPlayersInRange(worldObj, xCoord + 0.5, yCoord + 0.5, zCoord + 0.5, 15, 15); +// for (EntityPlayer player : list) +// { +// PotionEffect regenEffect = player.getActivePotionEffect(Potion.regeneration); +// if (regenEffect != null && regenEffect.getAmplifier() > 0) +// { +// if(AlchemicalWizardry.causeHungerChatMessage && !player.isPotionActive(Potion.hunger.id)) +// { +// player.addChatComponentMessage(new ChatComponentText(StatCollector.translateToLocal("message.altar.hunger"))); +// } +// player.addPotionEffect(new PotionEffect(Potion.hunger.id, 40, regenEffect.getAmplifier() * 2 - 2)); +// } +// } +// } } if(worldObj.getWorldTime() % Math.max(20 - this.accelerationUpgrades, 1) == 0) diff --git a/src/main/resources/assets/alchemicalwizardryBooks/lang/en_US.lang b/src/main/resources/assets/alchemicalwizardryBooks/lang/en_US.lang index e4a172df..764a2205 100644 --- a/src/main/resources/assets/alchemicalwizardryBooks/lang/en_US.lang +++ b/src/main/resources/assets/alchemicalwizardryBooks/lang/en_US.lang @@ -26,8 +26,8 @@ aw.entries.architect.sacrifice.1=Looking at these little speed runes, I have dec aw.entries.architect.sacrifice.2=Well, if there is anything thaumaturgy and magic in general has taught me, it is that gold is a very good metal for magic. By simply replacing the glowstone in the recipe with gold ingots, a sacrifice rune is formed. It has the same additional ten percent addition per rune per sacrifice, meaning the more LP of the mob sacrificed the more LP the runes adds. This has got me thinking... The altar was constructed with both diamond and gold. It seems to resonate with the diamond enough to make the first blood orb, and even a second, so why not try making one out of gold? I'll need to revisit this idea later as a test run showed some reaction to a block of solid gold(I didn't ask Magus where he got it, and he doesn't seem forthcoming about these matters), but the altar couldn't cope with the strain needed to shape the block. Before catastrophic failure happened, a few safety precautions Magus and I had built into the altar triggered, stopping the transmutation before... Well, neither of us are really sure what would happen. But Magus said he has dealt with matters of unstable and untested magic, and knew most of them end with a crater in the floor(Hence the safety precautions). It has been a few days since the experiment with the gold block. Magus and I have been discussing what to do now, as the altar is getting bigger then the basement. Magus has suggested moving it to some of the lower basement floors, but considering just how large it might be in the future... I finally got him to agree to building it behind his home, as long as I helped put up a few wards and spells to keep people away. Currently we're planning out the structure and needed runes for upgrading. The current altar only has eight runes, but what I have planned will more then triple that number to twenty eight. The current limitation we suffer is the strength of the altar itself, as it can only take power from runes adjacent to it. My plan is to use something the altar is naturally attuned to as a way to not only increase the range of this effect, but act as a counter balance and stabilizing it to prevent it from becoming uncontrollable. For this to work, the blocks in question must be above the altar and an equal distance apart. We've run several tests and calculations, and have a layout in mind for this upgrade. Four pillars topped with glowstone blocks, twenty runes in sections of five, built one block down and two out from the last set of runes. In theory this should provide a huge boost in power to the altar without risking our safety(Well, more then we normally risk it), but until we test full scale I can't be sure. For now, we have a lot of runes to make. After much debate we've decided to invest in the "Self sacrifice" runes, as having a steady supply of mobs will be tricky. But now I face the issue of making dozens of reinforced slates... I need to think on this. aw.entries.architect.bloodPack=It's so simple! I've discovered a way of obtaining LP for making slates that means I don't wait at the altar all day: The Blood letter's Backpack. Made with a modified leather chest-piece with a blank slate reinforced glass tank, it allows the wearer to gather LP by feeding it into the pack over time. Whenever the wearer has more than five hearts, the pack will drain their life and store it inside up to 10K LP to be dumped into an altar later. This pack does have two shortcomings, however. When the life essence is deposited into the altar, runes will have no bonus to the amount added. The second problem is that the altar will only accept LP from the pack when not performing a transmutation. Despite these limitations, it will prove quite valuable for simply allowing me to step away from the altar to do other tasks. This is a simple progress update, as it's been a few weeks since I last wrote in this journal. I've been making slow, but steady progress with assembling the slates needed for the runes and we're now halfway through. This isn't the only reason for the lack of entries, as I've been preoccupied with my research thorough thaumaturgy. An old friend of Magus has been visiting and happens to be a well versed thaumaturge, and he has been giving me pointers on how I could be doing better while Magus has been preoccupied in his library dealing with a mountain of paperwork. Now that Master Ridden has returned home, I hope to progress farther in making runes in the next few days. aw.entries.architect.fivePeople=Or not, as it seems Fate has other far more interesting plans for us. Today we had a knock on our door while I was making the last of the runes, and after opening it was greeted by three apparent orphans. The two boys in the front looked like they were brothers, or at least close relatives. The girl hiding behind them on the other hand had a very different hair and eye color, so relation was unlikely at best. All of them were covered in dirt, clothing ripped, torn, and patched with various levels of skill. The one on the left had an old sword with a chipped blade on his side, was slightly thinner and taller then the his brother, had a few deep scars that looked recent, long and messy dark brown hair, and was looking at me with a kind poker face. The brother looked more muscled, and was staring at me with a very analytical eyes and a similar poker face, his hair was slightly shorter and lighter then his brother. From what I could see of the girl, she had a simple dress on that was almost caked in dirt and dried mud. The fabric near her elbows was becoming thread bare, and a large rip near the bottom of the dress exposed some of her right leg. Her hair was a light blond, almost pale white color, but the most shocking feature was her eyes... I haven't seen haunted eyes like that in years, and last time it was in a mirror. From the looks of them, all of them hadn't ate anything in days and seemed to have everything they own on their bodies or in the simple packs on their backs. I asked them if there was anything they needed, to which the elder brother said they were looking for master Magus. I called Magus to the door, visitors being a rare thing as it stands with ones who ask for him by name and not clearly mages being rarer still. Five minutes later we all sat in the main room, eating simple sandwiches I had prepared for us all at the request of Magus. Needless to say, this day was not going as expected. Magus spent the next few minutes practically interrogating the elder brother , asking questions on both of our minds. As it turns out the two brothers, Vlad and Demier, use to be caravan traders, eldest a alchemist with basic knowledge of potion brewing, younger with enough mana and training already to cast basic spells. The girl on the other hand had a story all her own. From what the brothers had managed to gather, her village was raided like my own was and she was evidently the sole survivor. What shocked me was when they said she was found wandering the ashs, demons having left hours before without so much as a scratch on her body. Vlad was with the traders when they found her, and he was forced to leave them if he wanted to help the girl named Bella. Their story seemed to win Magus over, as he told them he would try to do what he can for them.. Not long after that, Magus asked me to help him do some shopping for our new guests. On the way to the village, Magus asked me what I thought of the three. "I can't say I believe all their story, but I also don't think their lying. Did you notice the girls eyes? Haven't see a look like that since...". Magus finished for me with "Your own?". I nodded at the dark memories of that time. We continued going over the details of their story, but we agreed that just leaving them in the cold wasn't an option worth considering. We decided to at least try to keep our recent endeavors into blood magic a secret from them, but when push comes to shove I think we might have to let them in on the secret. Magus let out a long sigh. "It's been years since I had to juggle this many apprentices at once. I'm going to need your help training them. But something tell me that we're going to be learning as much from them as they will from us..." I asked him why he felt that way, and he said it was just a gut feeling. I must say I had a similar feeling. Things like this don't happen without reason, and of all mages to come to they stopped at our door, something far easier said then done. An hour later we returned home, both our arms heavy with fabrics, food, and other necessities that we will need to take care of the new apprentices. I watched in amazement as the three ate, trying to make up for days with little food all at once. After that, Magus and I laid the three on various chairs and couches to rest, the strain of travel catching up with them. While Magus dug around looking for a few of his old things that we'd soon need, I started creating some new clothing from enchanted fabric for the three to replace their current worn and ratty clothing. Now that that is done, I should try to get some sleep. Something is telling me tomorrow is going to be quite busy. The Early this morning Magus and I started carving out the earth for the three new bedrooms, since the old ones Magus use to have had since been converted into a storage closet, a alchemy lab, and small study. It didn't take nearly as long as I expected with Magus using a few spells to clear away earth while I went behind using an equal trade foci to transmute it into stone brick before gravity caught on. Once that was done, Magus raised a few walls to separate the space into three rooms and a hallway. Only after that was done did I notice the three children had awoken, and were watching us as we worked. Magus told them that he had some spare furniture in some storerooms they could use, but sadly only knew of one bed. It didn't take long for them to decide Bella got the bed, the brothers would make do with a pillow and a blanket on the floor. After that we spent the rest of the day hunting for then moving furniture to their rooms, building little work areas and libraries for each of them. The following day was more of the same, with the evening filled with helping them find books to read from the grand library. Vlad grabbed as many alchemy books as possible, Demir took a few books on spell casting, and Bella took a Lexica botanica to read through. Later this evening, after the three had retired to their rooms, I sat in the main room with Magus, arms and legs aching from the heavy lifting of the last two days. I told Magus how I thought their rooms should be almost finished, and how I spent the last hour before they retired just answering seemingly endless questions. "I'm sure. I've gone through the same more then once, when I have apprentices new to magic. You were the same, I recall." I opened my mouth to protest, but closed it as I thought back to those days. I decided I probably was as bad as them, and left it at that. It's been just over a week, and the three have settled in nicely. They join Magus and I in morning exorcising, have started studying like true scholars, and have calmed the hungry nodes in their stomachs(Well, Vlad and Bella have. Demir on the other hand is another matter, but I feel he will always be like that.) Unfortunately, like true scholars and mages they've stumbled into places we didn't want them to go. Vlad has created a chemistry set that uses life essence from a blood orb as a fuel source, Demir has turned an old table into a way to use life essence to cast powerful spells, and Bella... She's left me questioning what I know about demons, after taming one and using a blood orb to bind it to her. All three of them have stumbled blindly into blood magic, and now I don't think we'll be able to stop them. Magus and I have agreed to give them a choice in whether they are blood mages or not, but I've seen the light in their eyes... I can't imagine any of them saying no. To seal their dedication to the art, we will have them make blood orbs of their own to use. -aw.entries.architect.= -aw.entries.architect.= +aw.entries.architect.tier3=Even with all the chaos of the last week I've managed to finish the altar construction, and it has been more successful then I predicted. With full access to twenty eight runes, each heart is now worth over seven hundred LP. I've already started prepping to try again with the gold block, having a few instant healing potions at hand. I got a brief glimpse with my sigil of sight, and this transmutation will take twenty five thousand LP to finish, over double what the altar can hold! Writing this down does give me an idea, however.... I'll need to look into it further once I have finished making this. +aw.entries.architect.magicianOrb=It was close, but I finished the orb today. I was down to the last of my three potions and barely had the strength left to hold the knife, but I pulled through and finished my shiny new blood orb! I've already used it to craft a few things I had made before, and extra lava and air sigil, and it handles it all with such ease! Now that this is finished, I have a small list of ideas to go through... To start off the process, I want a stronger slate. As it stands the reinforced type is cracking under the strain I'm starting to place on it. Well, I got a new slate type when I last upgraded the altar... Let's see if it works again. It does! A reinforced slate in a tier three altar with around five thousand LP makes a new slate... I'll call it an imbued slate for now, and come up with a better name later. aw.entries.architect.= aw.entries.architect.= aw.entries.architect.= @@ -61,8 +61,8 @@ guide.BloodMagic.entryName.architect.dagger=Dagger of Sacrifice guide.BloodMagic.entryName.architect.sacrifice=Runes of Sacrifice guide.BloodMagic.entryName.architect.bloodPack=The Blood Letter's Pack guide.BloodMagic.entryName.architect.fivePeople=And Then there was Five -guide.BloodMagic.entryName.architect. -guide.BloodMagic.entryName.architect. +guide.BloodMagic.entryName.architect.tier3=The Next Step: Tier 3 +guide.BloodMagic.entryName.architect.magicianOrb= guide.BloodMagic.entryName.architect. guide.BloodMagic.entryName.architect. guide.BloodMagic.entryName.architect.