From 1242fefc30a1dde971040ce5f9701ef1cfb6710f Mon Sep 17 00:00:00 2001 From: WayofTime Date: Tue, 26 Jan 2016 07:56:17 -0500 Subject: [PATCH] Added sentient armour gem recipe. Added ability for Tartaric gems to fill other gems. --- changelog.txt | 8 ++++++ .../api/soul/PlayerDemonWillHandler.java | 28 +++++++++++++++++++ .../item/armour/ItemLivingArmour.java | 4 +-- .../item/armour/ItemSentientArmour.java | 4 +++ .../item/soul/ItemSentientArmourGem.java | 8 +++--- .../bloodmagic/item/soul/ItemSoulGem.java | 13 +++++++++ .../bloodmagic/registry/ModRecipes.java | 3 ++ .../assets/bloodmagic/lang/en_US.lang | 5 ++++ 8 files changed, 67 insertions(+), 6 deletions(-) diff --git a/changelog.txt b/changelog.txt index 032d1e8f..74d24ec1 100644 --- a/changelog.txt +++ b/changelog.txt @@ -1,3 +1,11 @@ +------------------------------------------------------ +Version 2.0.0-10 +------------------------------------------------------ +- Added recipe for Sentient Armour - craft a Sentient Armour Gem and right click with it to toggle the armour. +- Added recipes for the Greater and Grand Tartaric gems. These are temporary recipes. +- Updated textures. +- Added ability to fill gems from other gems. Right click with a gem to fill other gems in your inventory. + ------------------------------------------------------ Version 2.0.0-9 ------------------------------------------------------ diff --git a/src/main/java/WayofTime/bloodmagic/api/soul/PlayerDemonWillHandler.java b/src/main/java/WayofTime/bloodmagic/api/soul/PlayerDemonWillHandler.java index beef1218..f51c910a 100644 --- a/src/main/java/WayofTime/bloodmagic/api/soul/PlayerDemonWillHandler.java +++ b/src/main/java/WayofTime/bloodmagic/api/soul/PlayerDemonWillHandler.java @@ -140,4 +140,32 @@ public class PlayerDemonWillHandler return amount - remaining; } + + public static double addDemonWill(EntityPlayer player, double amount, ItemStack ignored) + { + ItemStack[] inventory = player.inventory.mainInventory; + double remaining = amount; + + for (int i = 0; i < inventory.length; i++) + { + ItemStack stack = inventory[i]; + if (stack != null && !stack.equals(ignored)) + { + if (stack.getItem() instanceof IDemonWillGem) + { + double souls = ((IDemonWillGem) stack.getItem()).getWill(stack); + double fill = Math.min(((IDemonWillGem) stack.getItem()).getMaxWill(stack) - souls, remaining); + ((IDemonWillGem) stack.getItem()).setWill(stack, fill + souls); + remaining -= fill; + + if (remaining <= 0) + { + break; + } + } + } + } + + return amount - remaining; + } } diff --git a/src/main/java/WayofTime/bloodmagic/item/armour/ItemLivingArmour.java b/src/main/java/WayofTime/bloodmagic/item/armour/ItemLivingArmour.java index 320090b9..0e635c06 100644 --- a/src/main/java/WayofTime/bloodmagic/item/armour/ItemLivingArmour.java +++ b/src/main/java/WayofTime/bloodmagic/item/armour/ItemLivingArmour.java @@ -189,12 +189,12 @@ public class ItemLivingArmour extends ItemArmor implements ISpecialArmor { if (this == ModItems.livingArmourChest || this == ModItems.livingArmourHelmet || this == ModItems.livingArmourBoots) { - return "bloodmagic:models/armor/boundArmour_layer_1.png"; + return "bloodmagic:models/armor/livingArmour_layer_1.png"; } if (this == ModItems.livingArmourLegs) { - return "bloodmagic:models/armor/boundArmour_layer_2.png"; + return "bloodmagic:models/armor/livingArmour_layer_2.png"; } else { return null; diff --git a/src/main/java/WayofTime/bloodmagic/item/armour/ItemSentientArmour.java b/src/main/java/WayofTime/bloodmagic/item/armour/ItemSentientArmour.java index 0d7bc76d..f951c726 100644 --- a/src/main/java/WayofTime/bloodmagic/item/armour/ItemSentientArmour.java +++ b/src/main/java/WayofTime/bloodmagic/item/armour/ItemSentientArmour.java @@ -1,7 +1,9 @@ package WayofTime.bloodmagic.item.armour; import java.util.List; +import java.util.Map; +import net.minecraft.enchantment.EnchantmentHelper; import net.minecraft.entity.Entity; import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.player.EntityPlayer; @@ -260,6 +262,8 @@ public class ItemSentientArmour extends ItemArmor implements ISpecialArmor } omegaTag.setTag("armour", tag); + Map enchantmentMap = EnchantmentHelper.getEnchantments(previousArmour); + EnchantmentHelper.setEnchantments(enchantmentMap, newArmour); } public ItemStack getContainedArmourStack(ItemStack newArmour) diff --git a/src/main/java/WayofTime/bloodmagic/item/soul/ItemSentientArmourGem.java b/src/main/java/WayofTime/bloodmagic/item/soul/ItemSentientArmourGem.java index 2b51e7a6..78a94a76 100644 --- a/src/main/java/WayofTime/bloodmagic/item/soul/ItemSentientArmourGem.java +++ b/src/main/java/WayofTime/bloodmagic/item/soul/ItemSentientArmourGem.java @@ -14,9 +14,9 @@ import WayofTime.bloodmagic.item.armour.ItemSentientArmour; public class ItemSentientArmourGem extends Item { - public static double[] willBracket = new double[] { 30, 200, 600, 1500, 4000, 6000, 8000 }; - public static double[] consumptionPerHit = new double[] { 0.1, 0.12, 0.15, 0.2, 0.3, 0.35, 0.4 }; - public static double[] extraProtectionLevel = new double[] { 0, 0.25, 0.5, 0.6, 0.7, 0.75, 0.85 }; + public static double[] willBracket = new double[] { 30, 200, 600, 1500, 4000, 6000, 8000, 16000 }; + public static double[] consumptionPerHit = new double[] { 0.1, 0.12, 0.15, 0.2, 0.3, 0.35, 0.4, 0.5 }; + public static double[] extraProtectionLevel = new double[] { 0, 0.25, 0.5, 0.6, 0.7, 0.75, 0.85, 0.9 }; public ItemSentientArmourGem() { @@ -52,7 +52,7 @@ public class ItemSentientArmourGem extends Item if (bracket >= 0) { - PlayerDemonWillHandler.consumeDemonWill(player, willBracket[bracket]); +// PlayerDemonWillHandler.consumeDemonWill(player, willBracket[bracket]); ItemSentientArmour.convertPlayerArmour(player, consumptionPerHit[bracket], extraProtectionLevel[bracket]); } } diff --git a/src/main/java/WayofTime/bloodmagic/item/soul/ItemSoulGem.java b/src/main/java/WayofTime/bloodmagic/item/soul/ItemSoulGem.java index 7526a4b9..8059c9f4 100644 --- a/src/main/java/WayofTime/bloodmagic/item/soul/ItemSoulGem.java +++ b/src/main/java/WayofTime/bloodmagic/item/soul/ItemSoulGem.java @@ -7,12 +7,14 @@ import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.world.World; 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.soul.IDemonWill; import WayofTime.bloodmagic.api.soul.IDemonWillGem; +import WayofTime.bloodmagic.api.soul.PlayerDemonWillHandler; import WayofTime.bloodmagic.api.util.helper.NBTHelper; import WayofTime.bloodmagic.util.helper.TextHelper; @@ -37,6 +39,17 @@ public class ItemSoulGem extends Item implements IDemonWillGem return super.getUnlocalizedName(stack) + names[stack.getItemDamage()]; } + @Override + public ItemStack onItemRightClick(ItemStack stack, World world, EntityPlayer player) + { + double drain = Math.min(this.getWill(stack), this.getMaxWill(stack) / 10); + + double filled = PlayerDemonWillHandler.addDemonWill(player, drain, stack); + this.drainWill(stack, filled); + + return stack; + } + @Override @SideOnly(Side.CLIENT) public void getSubItems(Item id, CreativeTabs creativeTab, List list) diff --git a/src/main/java/WayofTime/bloodmagic/registry/ModRecipes.java b/src/main/java/WayofTime/bloodmagic/registry/ModRecipes.java index 15da0339..2e18b27b 100644 --- a/src/main/java/WayofTime/bloodmagic/registry/ModRecipes.java +++ b/src/main/java/WayofTime/bloodmagic/registry/ModRecipes.java @@ -160,6 +160,8 @@ public class ModRecipes TartaricForgeRecipeRegistry.registerRecipe(new ItemStack(ModItems.soulGem), 1, 1, "dustRedstone", "ingotGold", "blockGlass", "dyeBlue"); TartaricForgeRecipeRegistry.registerRecipe(new ItemStack(ModItems.soulGem, 1, 1), 60, 20, new ItemStack(ModItems.soulGem), "gemDiamond", "blockRedstone", "blockLapis"); TartaricForgeRecipeRegistry.registerRecipe(new ItemStack(ModItems.soulGem, 1, 2), 240, 50, new ItemStack(ModItems.soulGem, 1, 1), "gemDiamond", "blockGold", new ItemStack(ModItems.slate, 1, 2)); + TartaricForgeRecipeRegistry.registerRecipe(new ItemStack(ModItems.soulGem, 1, 3), 1000, 100, new ItemStack(ModItems.soulGem, 1, 2), new ItemStack(ModItems.slate, 1, 3), new ItemStack(ModItems.bloodShard), Items.blaze_rod); + TartaricForgeRecipeRegistry.registerRecipe(new ItemStack(ModItems.soulGem, 1, 4), 4000, 500, new ItemStack(ModItems.soulGem, 1, 3), Items.nether_star); TartaricForgeRecipeRegistry.registerRecipe(new ItemStack(ModItems.sentientSword), 0, 0, new ItemStack(ModItems.soulGem), new ItemStack(Items.iron_sword)); TartaricForgeRecipeRegistry.registerRecipe(new ItemStack(ModItems.sentientBow), 70, 0, new ItemStack(Items.bow), new ItemStack(ModItems.soulGem, 1, 1), Items.string, Items.string); TartaricForgeRecipeRegistry.registerRecipe(new ItemStack(ModItems.arcaneAshes), 0, 0, "dustRedstone", "dyeWhite", new ItemStack(Items.gunpowder), Items.coal); @@ -173,6 +175,7 @@ public class ModRecipes TartaricForgeRecipeRegistry.registerRecipe(ItemComponent.getStack(ItemComponent.REAGENT_AFFINITY), 300, 30, ModItems.sigilWater, ModItems.sigilAir, ModItems.sigilLava, Blocks.obsidian); TartaricForgeRecipeRegistry.registerRecipe(ItemComponent.getStack(ItemComponent.REAGENT_SUPPRESSION), 500, 50, ModBlocks.teleposer, Items.water_bucket, Items.lava_bucket, Items.blaze_rod); TartaricForgeRecipeRegistry.registerRecipe(ItemComponent.getStack(ItemComponent.REAGENT_BINDING), 400, 10, "dustGlowstone", "dustRedstone", "nuggetGold", Items.gunpowder); + TartaricForgeRecipeRegistry.registerRecipe(new ItemStack(ModItems.sentientArmourGem), 240, 150, Items.diamond_chestplate, new ItemStack(ModItems.soulGem, 1, 1), Blocks.iron_block, Blocks.obsidian); TartaricForgeRecipeRegistry.registerRecipe(ItemComponent.getStack(ItemComponent.COMPONENT_FRAME_PART), 400, 10, "blockGlass", "stone", new ItemStack(ModItems.slate)); TartaricForgeRecipeRegistry.registerRecipe(new ItemStack(ModItems.nodeRouter), 400, 5, Items.stick, new ItemStack(ModItems.slate, 1, 1), "gemLapis", "gemLapis"); diff --git a/src/main/resources/assets/bloodmagic/lang/en_US.lang b/src/main/resources/assets/bloodmagic/lang/en_US.lang index 100edee0..83c516d8 100644 --- a/src/main/resources/assets/bloodmagic/lang/en_US.lang +++ b/src/main/resources/assets/bloodmagic/lang/en_US.lang @@ -102,6 +102,10 @@ item.BloodMagic.livingArmour.helmet.name=Living Helmet item.BloodMagic.livingArmour.chest.name=Living Chestplate item.BloodMagic.livingArmour.legs.name=Living Leggings item.BloodMagic.livingArmour.boots.name=Living Boots +item.BloodMagic.sentientArmour.helmet.name=Sentient Helmet +item.BloodMagic.sentientArmour.chest.name=Sentient Chestplate +item.BloodMagic.sentientArmour.legs.name=Sentient Leggings +item.BloodMagic.sentientArmour.boots.name=Sentient Boots item.BloodMagic.altarMaker.name=Altar Maker @@ -120,6 +124,7 @@ item.BloodMagic.soulGem.greater.name=Greater Tartaric Gem item.BloodMagic.soulGem.grand.name=Grand Tartaric Gem item.BloodMagic.soulSnare.base.name=Rudimentary Snare item.BloodMagic.sentientBow.name=Sentient Bow +item.BloodMagic.sentientArmourGem.name=Sentient Armour Gem item.BloodMagic.nodeRouter.name=Node Router item.BloodMagic.itemFilter.exact.name=Precise Item Filter