updating tooltip printout to print properly
This commit is contained in:
@@ -106,25 +106,27 @@ public class WeaponPart extends Item implements WeaponNBT {
|
||||
{
|
||||
if(stack.hasTagCompound()) {
|
||||
if (stack.getSubCompound("tags") != null) {
|
||||
//System.out.println(WeaponNBT.materialModifiers.get(this.toolMaterial));
|
||||
//System.out.println(stack.getSubCompound("tags").getInteger("modifiers"));
|
||||
tooltip.add(ChatFormatting.GRAY + "Upgrades left: " + (WeaponNBT.materialModifiers.get(this.toolMaterial) - WeaponNBT.getModifiers(stack)));
|
||||
if (WeaponNBT.getSmiteLevel(stack) > 0) {
|
||||
//if (WeaponNBT.getSmiteLevel(stack) > 0) {
|
||||
tooltip.add(ChatFormatting.GOLD + "Holy: " + WeaponNBT.getSmiteLevel(stack));
|
||||
}
|
||||
if (WeaponNBT.getBaneLevel(stack) > 0) {
|
||||
//}
|
||||
//if (WeaponNBT.getBaneLevel(stack) > 0) {
|
||||
tooltip.add(ChatFormatting.GREEN + "Spider Killing: " + WeaponNBT.getBaneLevel(stack));
|
||||
}
|
||||
if (WeaponNBT.getFireLevel(stack) > 0) {
|
||||
//}
|
||||
//if (WeaponNBT.getFireLevel(stack) > 0) {
|
||||
tooltip.add(ChatFormatting.RED + "Flame: " + WeaponNBT.getFireLevel(stack));
|
||||
}
|
||||
if (WeaponNBT.getFortuneLevel(stack) > 0) {
|
||||
//}
|
||||
//if (WeaponNBT.getFortuneLevel(stack) > 0) {
|
||||
tooltip.add(ChatFormatting.BLUE + "Thieving: " + WeaponNBT.getFortuneLevel(stack));
|
||||
}
|
||||
if (WeaponNBT.getLeechLevel(stack) > 0) {
|
||||
tooltip.add(ChatFormatting.BLACK + "Life Steal: " + WeaponNBT.getLeechLevel(stack));
|
||||
}
|
||||
if (WeaponNBT.getSharpnessLevel(stack) > 0) {
|
||||
//}
|
||||
//if (WeaponNBT.getLeechLevel(stack) > 0) {
|
||||
tooltip.add(ChatFormatting.LIGHT_PURPLE + "Life Steal: " + WeaponNBT.getLeechLevel(stack));
|
||||
//}
|
||||
//if (WeaponNBT.getSharpnessLevel(stack) > 0) {
|
||||
tooltip.add(ChatFormatting.WHITE + "Sharpness: " + WeaponNBT.getSharpnessLevel(stack));
|
||||
}
|
||||
//}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -33,7 +33,7 @@ import java.util.List;
|
||||
public class CustomSword extends ItemSword implements WeaponNBT {
|
||||
|
||||
private double attack, speed;
|
||||
private ToolMaterial toolMaterial;
|
||||
public ToolMaterial toolMaterial;
|
||||
public CustomSword(String name, ToolMaterial material, double attackDamage, double attackSpeed) {
|
||||
super(material);
|
||||
this.setUnlocalizedName(name);
|
||||
@@ -64,7 +64,7 @@ public class CustomSword extends ItemSword implements WeaponNBT {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
/*@Override
|
||||
public void onUpdate(ItemStack stack, World world, Entity playerin, int itemSlot, boolean isSelected) {
|
||||
if(!world.isRemote){
|
||||
if(isSelected) {
|
||||
@@ -100,6 +100,22 @@ public class CustomSword extends ItemSword implements WeaponNBT {
|
||||
//System.out.println(WeaponNBT.getSharpnessLevel(stack));
|
||||
}
|
||||
}
|
||||
}*/
|
||||
@Override
|
||||
public void onUpdate(ItemStack item, World world, Entity player, int itemSlot, boolean isSelected) {
|
||||
//System.out.println(item.getTagCompound());
|
||||
if(!item.hasTagCompound()) {
|
||||
WeaponNBT.setDefaultNBT(item);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCreated(ItemStack item, World worldIn, EntityPlayer playerIn) {
|
||||
|
||||
if(!item.hasTagCompound()) {
|
||||
WeaponNBT.setDefaultNBT(item);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -145,21 +161,28 @@ public class CustomSword extends ItemSword implements WeaponNBT {
|
||||
tooltip.add(ChatFormatting.LIGHT_PURPLE + "Damage: " + stack.getItemDamage() );
|
||||
if(stack.hasTagCompound())
|
||||
{
|
||||
tooltip.add(ChatFormatting.GRAY + "Upgrades left: " + (WeaponNBT.materialModifiers.get(this.toolMaterial) - WeaponNBT.getModifiers(stack)));
|
||||
if (WeaponNBT.getSmiteLevel(stack) > 0) {
|
||||
if (stack.getSubCompound("tags") != null) {
|
||||
//System.out.println(WeaponNBT.materialModifiers.get(this.toolMaterial));
|
||||
//System.out.println(stack.getSubCompound("tags").getInteger("modifiers"));
|
||||
tooltip.add(ChatFormatting.GRAY + "Upgrades left: " + (WeaponNBT.materialModifiers.get(this.toolMaterial) - WeaponNBT.getModifiers(stack)));
|
||||
//if (WeaponNBT.getSmiteLevel(stack) > 0) {
|
||||
tooltip.add(ChatFormatting.GOLD + "Holy: " + WeaponNBT.getSmiteLevel(stack));
|
||||
}
|
||||
if (WeaponNBT.getBaneLevel(stack) > 0) {
|
||||
//}
|
||||
//if (WeaponNBT.getBaneLevel(stack) > 0) {
|
||||
tooltip.add(ChatFormatting.GREEN + "Spider Killing: " + WeaponNBT.getBaneLevel(stack));
|
||||
}
|
||||
if (WeaponNBT.getFireLevel(stack) > 0) {
|
||||
//}
|
||||
//if (WeaponNBT.getFireLevel(stack) > 0) {
|
||||
tooltip.add(ChatFormatting.RED + "Flame: " + WeaponNBT.getFireLevel(stack));
|
||||
}
|
||||
if (WeaponNBT.getFortuneLevel(stack) > 0) {
|
||||
//}
|
||||
//if (WeaponNBT.getFortuneLevel(stack) > 0) {
|
||||
tooltip.add(ChatFormatting.BLUE + "Thieving: " + WeaponNBT.getFortuneLevel(stack));
|
||||
}
|
||||
if (WeaponNBT.getLeechLevel(stack) > 0) {
|
||||
tooltip.add(ChatFormatting.BLACK + "Life Steal: " + WeaponNBT.getLeechLevel(stack));
|
||||
//}
|
||||
//if (WeaponNBT.getLeechLevel(stack) > 0) {
|
||||
tooltip.add(ChatFormatting.LIGHT_PURPLE + "Life Steal: " + WeaponNBT.getLeechLevel(stack));
|
||||
//}
|
||||
//if (WeaponNBT.getSharpnessLevel(stack) > 0) {
|
||||
tooltip.add(ChatFormatting.WHITE + "Sharpness: " + WeaponNBT.getSharpnessLevel(stack));
|
||||
//}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,6 +2,8 @@ package nmd.primal.forgecraft.items.weapons;
|
||||
|
||||
import com.google.common.collect.HashMultimap;
|
||||
import com.google.common.collect.Multimap;
|
||||
import com.mojang.realmsclient.gui.ChatFormatting;
|
||||
import net.minecraft.client.util.ITooltipFlag;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.SharedMonsterAttributes;
|
||||
import net.minecraft.entity.ai.attributes.AttributeModifier;
|
||||
@@ -17,6 +19,9 @@ import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
import nmd.primal.forgecraft.ModInfo;
|
||||
import nmd.primal.forgecraft.util.WeaponNBT;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Created by mminaie on 6/25/17.
|
||||
*/
|
||||
@@ -61,4 +66,34 @@ public class SlayerSword extends CustomSword {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void addInformation(ItemStack stack, @Nullable World world, List<String> tooltip, ITooltipFlag flagIn) {
|
||||
tooltip.add(ChatFormatting.LIGHT_PURPLE + "Damage: " + stack.getItemDamage());
|
||||
if (stack.hasTagCompound()) {
|
||||
if (stack.getSubCompound("tags") != null) {
|
||||
//System.out.println(WeaponNBT.materialModifiers.get(this.toolMaterial));
|
||||
//System.out.println(stack.getSubCompound("tags").getInteger("modifiers"));
|
||||
tooltip.add(ChatFormatting.GRAY + "Upgrades left: " + (WeaponNBT.materialModifiers.get(this.toolMaterial) - WeaponNBT.getModifiers(stack)));
|
||||
//if (WeaponNBT.getSmiteLevel(stack) > 0) {
|
||||
tooltip.add(ChatFormatting.GOLD + "Holy: " + WeaponNBT.getSmiteLevel(stack));
|
||||
//}
|
||||
//if (WeaponNBT.getBaneLevel(stack) > 0) {
|
||||
tooltip.add(ChatFormatting.GREEN + "Spider Killing: " + WeaponNBT.getBaneLevel(stack));
|
||||
//}
|
||||
//if (WeaponNBT.getFireLevel(stack) > 0) {
|
||||
tooltip.add(ChatFormatting.RED + "Flame: " + WeaponNBT.getFireLevel(stack));
|
||||
//}
|
||||
//if (WeaponNBT.getFortuneLevel(stack) > 0) {
|
||||
tooltip.add(ChatFormatting.BLUE + "Thieving: " + WeaponNBT.getFortuneLevel(stack));
|
||||
//}
|
||||
//if (WeaponNBT.getLeechLevel(stack) > 0) {
|
||||
tooltip.add(ChatFormatting.LIGHT_PURPLE + "Life Steal: " + WeaponNBT.getLeechLevel(stack));
|
||||
//}
|
||||
//if (WeaponNBT.getSharpnessLevel(stack) > 0) {
|
||||
tooltip.add(ChatFormatting.WHITE + "Sharpness: " + WeaponNBT.getSharpnessLevel(stack));
|
||||
//}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user