use of net.silentchaos512.gems.api.tool.part.ToolPart in project SilentGems by SilentChaos512.
the class GemsClientEvents method onTooltipForToolRod.
private void onTooltipForToolRod(ItemTooltipEvent event, ItemStack stack, ToolPart part, boolean ctrlDown, boolean shiftDown) {
int index = 1;
final String sep = loc.getMiscText("Tooltip.Separator");
List<String> list = event.getToolTip();
ToolPartRod.Stats stats = ((ToolPartRod) part).getStats();
// Tool Rod indicator
list.add(index++, loc.getMiscText("ToolPart.Rod"));
if (ctrlDown) {
// Compatible tiers
String line = "";
for (EnumMaterialTier tier : part.getCompatibleTiers()) {
if (!line.isEmpty())
line += ", ";
line += tier.getLocalizedName();
}
list.add(index++, loc.getMiscText("ToolPart.ValidTiers"));
list.add(index++, " " + line);
list.add(index++, sep);
TextFormatting color = TextFormatting.GOLD;
list.add(index++, color + TooltipHelper.getAsColoredPercentage("HarvestSpeed", stats.harvestSpeedMulti));
// list.add(index++, color + TooltipHelper.get("HarvestLevel", part.getHarvestLevel()));
color = TextFormatting.DARK_GREEN;
list.add(index++, color + TooltipHelper.getAsColoredPercentage("MeleeDamage", stats.meleeDamageMulti));
list.add(index++, color + TooltipHelper.getAsColoredPercentage("MagicDamage", stats.magicDamageMulti));
// list.add(index++, color + TooltipHelper.get("MeleeSpeed", (int) (part.getMeleeSpeed() * 100)));
color = TextFormatting.BLUE;
list.add(index++, color + TooltipHelper.getAsColoredPercentage("Durability", stats.durabilityMulti));
list.add(index++, color + TooltipHelper.getAsColoredPercentage("Enchantability", stats.enchantabilityMulti));
list.add(index++, sep);
// Debug info
if (shiftDown) {
list.add(index++, TextFormatting.DARK_GRAY + "* Part key: " + part.getKey());
}
} else {
list.add(index++, loc.getMiscText("PressCtrl"));
}
}
use of net.silentchaos512.gems.api.tool.part.ToolPart in project SilentGems by SilentChaos512.
the class GemsClientEvents method onTooltip.
@SubscribeEvent
public void onTooltip(ItemTooltipEvent event) {
boolean ctrlDown = KeyTracker.isControlDown();
boolean shiftDown = KeyTracker.isShiftDown();
ItemStack stack = event.getItemStack();
ToolPart part = StackHelper.isValid(stack) ? ToolPartRegistry.fromStack(stack) : null;
if (part != null && !part.isBlacklisted(stack)) {
if (part instanceof ToolPartRod) {
onTooltipForToolRod(event, stack, part, ctrlDown, shiftDown);
} else if (part instanceof ToolPartMain) {
onTooltipForToolMaterial(event, stack, part, ctrlDown, shiftDown);
} else if (part instanceof ArmorPartFrame) {
// TODO: Localization
event.getToolTip().add(TextFormatting.GOLD + "Armor Frame");
}
}
}
Aggregations