diff --git a/src/main/java/taintedmagic/common/handler/TMEventHandler.java b/src/main/java/taintedmagic/common/handler/TMEventHandler.java index d0bbad92..f53a4321 100644 --- a/src/main/java/taintedmagic/common/handler/TMEventHandler.java +++ b/src/main/java/taintedmagic/common/handler/TMEventHandler.java @@ -22,6 +22,7 @@ import net.minecraftforge.event.entity.living.LivingAttackEvent; import net.minecraftforge.event.entity.living.LivingEvent; import net.minecraftforge.event.entity.player.ItemTooltipEvent; +import taintedmagic.client.handler.HUDHandler; import taintedmagic.common.items.equipment.ItemLumosRing; import taintedmagic.common.items.tools.ItemHollowDagger; import taintedmagic.common.items.wand.foci.ItemFocusMageMace; @@ -111,75 +112,76 @@ else if (hasNightVision) { * Some hacky code to make the Mage's Mace work... */ public void modifyAttackDamage (final EntityPlayer player) { - if (!player.worldObj.isRemote) { - final IInventory inv = player.inventory; - - for (int i = 0; i < inv.getSizeInventory(); i++) { - if (inv.getStackInSlot(i) != null && inv.getStackInSlot(i).getItem() instanceof ItemWandCasting) { - final ItemStack stack = inv.getStackInSlot(i); - final ItemWandCasting wand = (ItemWandCasting) inv.getStackInSlot(i).getItem(); - - if (wand.getFocus(stack) != null && wand.getFocus(stack) == ItemRegistry.ItemFocusMageMace - && wand.getRod(stack) instanceof WandRod) { - final NBTTagList tags = new NBTTagList(); - final NBTTagCompound tag = new NBTTagCompound(); - tag.setString("AttributeName", SharedMonsterAttributes.attackDamage.getAttributeUnlocalizedName()); - - final UUID uuid = UUID.fromString("CB3F55D3-645C-4F38-A497-9C13A33DB5CF"); - final AttributeModifier am = new AttributeModifier(uuid, "Weapon modifier", - ConfigHandler.MAGE_MACE_DMG_INC_BASE + wand.getFocusPotency(stack), 0); - - tag.setString("Name", am.getName()); - tag.setDouble("Amount", am.getAmount()); - tag.setInteger("Operation", am.getOperation()); - tag.setLong("UUIDMost", am.getID().getMostSignificantBits()); - tag.setLong("UUIDLeast", am.getID().getLeastSignificantBits()); - - tags.appendTag(tag); - stack.stackTagCompound.setTag("AttributeModifiers", tags); - } - else if (wand.getRod(stack) instanceof WandRod) { - if (!stack.hasTagCompound()) { - stack.setTagCompound(new NBTTagCompound()); - } - stack.stackTagCompound.removeTag("AttributeModifiers"); - } - if (wand.getFocus(stack) != null && wand.getFocus(stack) == ItemRegistry.ItemFocusMageMace - && wand.getRod(stack) instanceof StaffRod) { - final NBTTagList tags = new NBTTagList(); - final NBTTagCompound tag = new NBTTagCompound(); - tag.setString("AttributeName", SharedMonsterAttributes.attackDamage.getAttributeUnlocalizedName()); - - final UUID uuid = UUID.fromString("CB3F55D3-645C-4F38-A497-9C13A33DB5CF"); - final AttributeModifier am = new AttributeModifier(uuid, "Weapon modifier", - 5.0D + ConfigHandler.MAGE_MACE_DMG_INC_BASE + wand.getFocusPotency(stack), 0); - - tag.setString("Name", am.getName()); - tag.setDouble("Amount", am.getAmount()); - tag.setInteger("Operation", am.getOperation()); - tag.setLong("UUIDMost", am.getID().getMostSignificantBits()); - tag.setLong("UUIDLeast", am.getID().getLeastSignificantBits()); - - tags.appendTag(tag); - stack.stackTagCompound.setTag("AttributeModifiers", tags); - } - else if (wand.getRod(stack) instanceof StaffRod) { - final NBTTagList tags = new NBTTagList(); - final NBTTagCompound tag = new NBTTagCompound(); - tag.setString("AttributeName", SharedMonsterAttributes.attackDamage.getAttributeUnlocalizedName()); - - final UUID uuid = UUID.fromString("CB3F55D3-645C-4F38-A497-9C13A33DB5CF"); - final AttributeModifier am = new AttributeModifier(uuid, "Weapon modifier", 6.0D, 0); - - tag.setString("Name", am.getName()); - tag.setDouble("Amount", am.getAmount()); - tag.setInteger("Operation", am.getOperation()); - tag.setLong("UUIDMost", am.getID().getMostSignificantBits()); - tag.setLong("UUIDLeast", am.getID().getLeastSignificantBits()); - - tags.appendTag(tag); - stack.stackTagCompound.setTag("AttributeModifiers", tags); + if (player.worldObj.isRemote) + return; + + final IInventory inv = player.inventory; + + for (int i = 0; i < inv.getSizeInventory(); i++) { + if (inv.getStackInSlot(i) != null && inv.getStackInSlot(i).getItem() instanceof ItemWandCasting) { + final ItemStack stack = inv.getStackInSlot(i); + final ItemWandCasting wand = (ItemWandCasting) inv.getStackInSlot(i).getItem(); + + if (wand.getFocus(stack) != null && wand.getFocus(stack) == ItemRegistry.ItemFocusMageMace + && wand.getRod(stack) instanceof WandRod) { + final NBTTagList tags = new NBTTagList(); + final NBTTagCompound tag = new NBTTagCompound(); + tag.setString("AttributeName", SharedMonsterAttributes.attackDamage.getAttributeUnlocalizedName()); + + final UUID uuid = UUID.fromString("CB3F55D3-645C-4F38-A497-9C13A33DB5CF"); + final AttributeModifier am = new AttributeModifier(uuid, "Weapon modifier", + ConfigHandler.MAGE_MACE_DMG_INC_BASE + wand.getFocusPotency(stack), 0); + + tag.setString("Name", am.getName()); + tag.setDouble("Amount", am.getAmount()); + tag.setInteger("Operation", am.getOperation()); + tag.setLong("UUIDMost", am.getID().getMostSignificantBits()); + tag.setLong("UUIDLeast", am.getID().getLeastSignificantBits()); + + tags.appendTag(tag); + stack.stackTagCompound.setTag("AttributeModifiers", tags); + } + else if (wand.getRod(stack) instanceof WandRod) { + if (!stack.hasTagCompound()) { + stack.setTagCompound(new NBTTagCompound()); } + stack.stackTagCompound.removeTag("AttributeModifiers"); + } + if (wand.getFocus(stack) != null && wand.getFocus(stack) == ItemRegistry.ItemFocusMageMace + && wand.getRod(stack) instanceof StaffRod) { + final NBTTagList tags = new NBTTagList(); + final NBTTagCompound tag = new NBTTagCompound(); + tag.setString("AttributeName", SharedMonsterAttributes.attackDamage.getAttributeUnlocalizedName()); + + final UUID uuid = UUID.fromString("CB3F55D3-645C-4F38-A497-9C13A33DB5CF"); + final AttributeModifier am = new AttributeModifier(uuid, "Weapon modifier", + 5.0D + ConfigHandler.MAGE_MACE_DMG_INC_BASE + wand.getFocusPotency(stack), 0); + + tag.setString("Name", am.getName()); + tag.setDouble("Amount", am.getAmount()); + tag.setInteger("Operation", am.getOperation()); + tag.setLong("UUIDMost", am.getID().getMostSignificantBits()); + tag.setLong("UUIDLeast", am.getID().getLeastSignificantBits()); + + tags.appendTag(tag); + stack.stackTagCompound.setTag("AttributeModifiers", tags); + } + else if (wand.getRod(stack) instanceof StaffRod) { + final NBTTagList tags = new NBTTagList(); + final NBTTagCompound tag = new NBTTagCompound(); + tag.setString("AttributeName", SharedMonsterAttributes.attackDamage.getAttributeUnlocalizedName()); + + final UUID uuid = UUID.fromString("CB3F55D3-645C-4F38-A497-9C13A33DB5CF"); + final AttributeModifier am = new AttributeModifier(uuid, "Weapon modifier", 6.0D, 0); + + tag.setString("Name", am.getName()); + tag.setDouble("Amount", am.getAmount()); + tag.setInteger("Operation", am.getOperation()); + tag.setLong("UUIDMost", am.getID().getMostSignificantBits()); + tag.setLong("UUIDLeast", am.getID().getLeastSignificantBits()); + + tags.appendTag(tag); + stack.stackTagCompound.setTag("AttributeModifiers", tags); } } } @@ -251,21 +253,24 @@ public void itemCrafted (final ItemCraftedEvent event) { * Give the player the Creation research upon crafting the Shard of Creation */ public void giveResearch (final EntityPlayer player) { - if (!player.worldObj.isRemote && !ThaumcraftApiHelper.isResearchComplete(player.getCommandSenderName(), "CREATION") + // CREATION + if (!ThaumcraftApiHelper.isResearchComplete(player.getCommandSenderName(), "CREATION") && ThaumcraftApiHelper.isResearchComplete(player.getCommandSenderName(), "CREATIONSHARD")) { Thaumcraft.proxy.getResearchManager().completeResearch(player, "CREATION"); PacketHandler.INSTANCE.sendTo(new PacketResearchComplete("CREATION"), (EntityPlayerMP) player); - player.addChatMessage( - new ChatComponentText(EnumChatFormatting.DARK_PURPLE + StatCollector.translateToLocal("text.creation"))); - player.playSound("thaumcraft:wind", 1.0F, 5.0F); - - if (!ThaumcraftApiHelper.isResearchComplete(player.getCommandSenderName(), "OUTERREV") - && ThaumcraftApiHelper.isResearchComplete(player.getCommandSenderName(), "CREATION")) { - Thaumcraft.proxy.getResearchManager().completeResearch(player, "OUTERREV"); - PacketHandler.INSTANCE.sendTo(new PacketResearchComplete("OUTERREV"), (EntityPlayerMP) player); - } - player.addPotionEffect(new PotionEffect(Potion.blindness.id, 80, 0)); - player.addPotionEffect(new PotionEffect(Config.potionBlurredID, 200, 0)); + + // effects + HUDHandler.displayString(EnumChatFormatting.DARK_PURPLE + StatCollector.translateToLocal("text.creation"), 3200, + false); + player.worldObj.playSoundAtEntity(player, "thaumcraft:egidle", 1.0F, 1.0F); + player.worldObj.playSoundAtEntity(player, "thaumcraft:heartbeat", 1.0F, 1.0F); + player.addPotionEffect(new PotionEffect(Potion.blindness.id, 200, -1)); + } + // OUTERREV + if (!ThaumcraftApiHelper.isResearchComplete(player.getCommandSenderName(), "OUTERREV") + && ThaumcraftApiHelper.isResearchComplete(player.getCommandSenderName(), "CREATION")) { + Thaumcraft.proxy.getResearchManager().completeResearch(player, "OUTERREV"); + PacketHandler.INSTANCE.sendTo(new PacketResearchComplete("OUTERREV"), (EntityPlayerMP) player); } } @@ -274,12 +279,14 @@ public void giveResearch (final EntityPlayer player) { */ @SubscribeEvent public void itemTooltip (final ItemTooltipEvent event) { + // mage mace attack dmg if (event.itemStack.getItem() instanceof ItemFocusMageMace && event.toolTip.contains(StatCollector.translateToLocal("item.Focus.cost1"))) { event.toolTip.remove(StatCollector.translateToLocal("item.Focus.cost1")); event.toolTip.add(1, StatCollector.translateToLocal("item.Focus.cost3")); } + // voidtouched items if (event.itemStack.stackTagCompound != null && event.itemStack.stackTagCompound.getBoolean("voidtouched")) { event.toolTip.add(EnumChatFormatting.DARK_PURPLE + StatCollector.translateToLocal("text.voidtouched")); } diff --git a/src/main/java/taintedmagic/common/registry/RecipeRegistry.java b/src/main/java/taintedmagic/common/registry/RecipeRegistry.java index b217c6ad..7566c9b4 100644 --- a/src/main/java/taintedmagic/common/registry/RecipeRegistry.java +++ b/src/main/java/taintedmagic/common/registry/RecipeRegistry.java @@ -132,10 +132,8 @@ private static void initInfusion () { // Shard of Creation ResearchRegistry.recipes.put("ItemMaterial:5", - ThaumcraftApi.addInfusionCraftingRecipe( - "CREATIONSHARD", new ItemStack(ItemRegistry.ItemMaterial, 1, 5), 8, TaintedMagicHelper.getPrimals(50) - .add(Aspect.AURA, 40).add(Aspect.VOID, 40).add(Aspect.MAGIC, 40).add(Aspect.ELDRITCH, 40), - new ItemStack(ConfigItems.itemShard, 1, 6), + ThaumcraftApi.addInfusionCraftingRecipe("CREATIONSHARD", new ItemStack(ItemRegistry.ItemMaterial, 1, 5), 8, + TaintedMagicHelper.getPrimals(55), new ItemStack(ConfigItems.itemShard, 1, 6), new ItemStack[]{ new ItemStack(ConfigItems.itemEldritchObject, 1, 3), new ItemStack(ConfigItems.itemShard, 1, 0), new ItemStack(ConfigItems.itemShard, 1, 1), new ItemStack(ConfigItems.itemShard, 1, 2), new ItemStack(Items.nether_star),