Skip to content

Commit

Permalink
fix: make Ravenous Claws tooltip less confusing
Browse files Browse the repository at this point in the history
  • Loading branch information
Elenterius committed Jun 25, 2023
1 parent ea9f79c commit c8940a6
Show file tree
Hide file tree
Showing 3 changed files with 69 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,7 @@ protected void addTranslations() {
addTooltip("nutrients_consumes", "Consumes %1$s u");
addTooltip("consumption", "Consumption");
addTooltip("bile_fuel", "Bile");
addTooltip("blood_charge", "Blood Charge");
addTooltip("contains_unique_dna", "[PH] Contains Unique Genetic Sequences");
addTooltip("press_button_to", "Press %1$s to %2$s");

Expand All @@ -190,6 +191,8 @@ protected void addTranslations() {
addTooltip("action.reload", "reload");
addTooltip("action.cycle", "cycle");
addTooltip("action.switch_mode", "switch mode");
addTooltip("action.awaken", "awaken");
addTooltip("action.make_drowsy", "make drowsy");

// addTooltip("fire_rate", "Fire Rate");
// addTooltip("accuracy", "Accuracy");
Expand All @@ -199,14 +202,14 @@ protected void addTranslations() {

add(LivingToolState.getTooltipTranslationKey(), "The Tool is %1$s");
add(LivingToolState.BROKEN.getTranslationKey(), "Broken");
add(LivingToolState.DORMANT.getTranslationKey(), "Dormant");
add(LivingToolState.DORMANT.getTranslationKey(), "Drowsy");
add(LivingToolState.AWAKENED.getTranslationKey(), "Awakened");

addHudMessage("not_sleepy", "You don't feel sleepy...");
// addHudMessage("set_behavior_command", "%1$s will now execute the %2$s command");
// addHudMessage("not_enough_ammo", "Not enough Ammo");
addHudMessage("not_enough_nutrients", "Not enough Nutrients");
addHudMessage("not_enough_blood_charge", "Not enough Blood");
addHudMessage("not_enough_blood_charge", "Not enough Blood Charge");

add(ClientTextUtil.getCtrlKey(), "ctrl");
add(ClientTextUtil.getAltKey(), "alt");
Expand Down Expand Up @@ -371,7 +374,9 @@ private void addItemTranslations() {
addItem(ModItems.RAVENOUS_CLAWS, "Ravenous Claws", """
Extremely hungry and vicious Claws forged by starving living flesh and grafting claws onto them.
Feed the famished claws by killing Mobs or feed them with food via the player inventory.""");
Repair the famished claws by feeding them with food via the player inventory like a bundle.
Killing Mobs grants blood charges which allow you to use the Awakened mode.""");
addItem(ModItems.DEV_ARM_CANNON, "[Dev Tool] Arm Cannon", "Creative/Developer Tool for testing projectiles.");
addItem(ModItems.BILE_SPITTER, "[WIP] Bile Spitter", "[WIP] \"living\" projectile weapon that shoots corrosive bile.\nIntended behaviour: charge it like a bow to increase damageShape & size of projectile.");

Expand Down
9 changes: 6 additions & 3 deletions src/generated/resources/assets/biomancy/lang/en_us.json
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@
"item.biomancy.gift_sac": "Gift Sac",
"item.biomancy.gift_sac.tooltip": "Looks like some objects are wrapped in an organic layer of skin. It's either filled with items or toxin if your language is set to German.\n\nRight Click the Sac to retrieve the Items.",
"item.biomancy.ravenous_claws": "Ravenous Claws",
"item.biomancy.ravenous_claws.tooltip": "Extremely hungry and vicious Claws forged by starving living flesh and grafting claws onto them.\n\nFeed the famished claws by killing Mobs or feed them with food via the player inventory.",
"item.biomancy.ravenous_claws.tooltip": "Extremely hungry and vicious Claws forged by starving living flesh and grafting claws onto them.\n\nRepair the famished claws by feeding them with food via the player inventory like a bundle.\n\nKilling Mobs grants blood charges which allow you to use the Awakened mode.",
"item.biomancy.dev_arm_cannon": "[Dev Tool] Arm Cannon",
"item.biomancy.dev_arm_cannon.tooltip": "Creative/Developer Tool for testing projectiles.",
"item.biomancy.bile_spitter": "[WIP] Bile Spitter",
Expand Down Expand Up @@ -236,6 +236,7 @@
"tooltip.biomancy.nutrients_consumes": "Consumes %1$s u",
"tooltip.biomancy.consumption": "Consumption",
"tooltip.biomancy.bile_fuel": "Bile",
"tooltip.biomancy.blood_charge": "Blood Charge",
"tooltip.biomancy.contains_unique_dna": "[PH] Contains Unique Genetic Sequences",
"tooltip.biomancy.press_button_to": "Press %1$s to %2$s",
"tooltip.biomancy.owner": "Owner: %1$s",
Expand All @@ -251,13 +252,15 @@
"tooltip.biomancy.action.reload": "reload",
"tooltip.biomancy.action.cycle": "cycle",
"tooltip.biomancy.action.switch_mode": "switch mode",
"tooltip.biomancy.action.awaken": "awaken",
"tooltip.biomancy.action.make_drowsy": "make drowsy",
"tooltip.biomancy.living_tool_state_is": "The Tool is %1$s",
"state.biomancy.living_tool.broken": "Broken",
"state.biomancy.living_tool.dormant": "Dormant",
"state.biomancy.living_tool.dormant": "Drowsy",
"state.biomancy.living_tool.awakened": "Awakened",
"msg.biomancy.not_sleepy": "You don't feel sleepy...",
"msg.biomancy.not_enough_nutrients": "Not enough Nutrients",
"msg.biomancy.not_enough_blood_charge": "Not enough Blood",
"msg.biomancy.not_enough_blood_charge": "Not enough Blood Charge",
"keyboard.biomancy.ctrl": "ctrl",
"keyboard.biomancy.alt": "alt",
"keyboard.biomancy.shift": "shift",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,22 @@

import com.github.elenterius.biomancy.chat.ComponentUtil;
import com.github.elenterius.biomancy.client.render.item.ravenousclaws.RavenousClawsRenderer;
import com.github.elenterius.biomancy.client.util.ClientTextUtil;
import com.github.elenterius.biomancy.entity.MobUtil;
import com.github.elenterius.biomancy.init.ModParticleTypes;
import com.github.elenterius.biomancy.init.ModSoundEvents;
import com.github.elenterius.biomancy.item.ItemCharge;
import com.github.elenterius.biomancy.item.livingtool.LivingClawsItem;
import com.github.elenterius.biomancy.item.livingtool.LivingToolState;
import com.github.elenterius.biomancy.styles.TextComponentUtil;
import com.github.elenterius.biomancy.styles.TextStyles;
import com.github.elenterius.biomancy.util.CombatUtil;
import com.github.elenterius.biomancy.util.SoundUtil;
import com.google.common.collect.ImmutableMultimap;
import com.google.common.collect.Multimap;
import net.minecraft.ChatFormatting;
import net.minecraft.client.renderer.BlockEntityWithoutLevelRenderer;
import net.minecraft.core.NonNullList;
import net.minecraft.network.chat.Component;
import net.minecraft.server.level.ServerLevel;
import net.minecraft.sounds.SoundEvents;
Expand All @@ -29,6 +32,7 @@
import net.minecraft.world.entity.player.Player;
import net.minecraft.world.inventory.ClickAction;
import net.minecraft.world.inventory.Slot;
import net.minecraft.world.item.CreativeModeTab;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.item.Tier;
import net.minecraft.world.item.TooltipFlag;
Expand All @@ -48,6 +52,7 @@
import software.bernie.geckolib3.core.manager.AnimationFactory;
import software.bernie.geckolib3.util.GeckoLibUtil;

import java.text.DecimalFormat;
import java.util.List;
import java.util.UUID;
import java.util.function.Consumer;
Expand Down Expand Up @@ -127,6 +132,17 @@ public InteractionResultHolder<Byte> onClientKeyPress(ItemStack stack, Level lev
return InteractionResultHolder.success(flags);
}

@Override
public void fillItemCategory(CreativeModeTab tab, NonNullList<ItemStack> items) {
if (allowedIn(tab)) {
items.add(new ItemStack(this)); //empty

ItemStack stack = new ItemStack(this);
setNutrients(stack, Integer.MAX_VALUE);
items.add(stack);
}
}

@Override
public int getMaxCharge(ItemStack container) {
return 50;
Expand Down Expand Up @@ -265,27 +281,57 @@ public boolean hurtEnemy(ItemStack stack, LivingEntity target, LivingEntity atta

@Override
public void appendHoverText(ItemStack stack, @Nullable Level level, List<Component> tooltip, TooltipFlag isAdvanced) {
super.appendHoverText(stack, level, tooltip, isAdvanced);
tooltip.add(ComponentUtil.horizontalLine());
tooltip.add(ClientTextUtil.getItemInfoTooltip(stack));
tooltip.add(ComponentUtil.emptyLine());
appendLivingToolTooltip(stack, tooltip);

if (stack.isEnchanted()) {
tooltip.add(ComponentUtil.emptyLine());
}
}

@Override
public void appendLivingToolTooltip(ItemStack stack, List<Component> tooltip) {
switch (getLivingToolState(stack)) {
case BROKEN -> {
//do nothing
}
case DORMANT -> {
tooltip.add(ComponentUtil.literal("Bleed Proc (8% chance)").withStyle(ChatFormatting.GRAY));
tooltip.add(ComponentUtil.literal(" adds one bleed stack (max 2)").withStyle(ChatFormatting.DARK_GRAY));
tooltip.add(ComponentUtil.emptyLine());
tooltip.add(ComponentUtil.literal("Bleed Proc:").withStyle(ChatFormatting.GRAY));
tooltip.add(ComponentUtil.literal(" 8% chance to add one bleed stack (max 2)").withStyle(ChatFormatting.DARK_GRAY));
}
case AWAKENED -> {
tooltip.add(ComponentUtil.literal("Bleed Proc (20% chance)").withStyle(ChatFormatting.GRAY));
tooltip.add(ComponentUtil.literal(" adds one Bleed Stack (max 2)").withStyle(ChatFormatting.DARK_GRAY));
tooltip.add(ComponentUtil.literal("Blood Explosion").withStyle(ChatFormatting.GRAY));
tooltip.add(ComponentUtil.literal(" on Bleed Stack deals 10% of max health as damage").withStyle(ChatFormatting.DARK_GRAY));
tooltip.add(ComponentUtil.emptyLine());
tooltip.add(ComponentUtil.literal("Bleed Proc:").withStyle(ChatFormatting.GRAY));
tooltip.add(ComponentUtil.literal(" 20% chance to add one bleed stack (max 2)").withStyle(ChatFormatting.DARK_GRAY));
tooltip.add(ComponentUtil.literal("Blood Explosion:").withStyle(ChatFormatting.GRAY));
tooltip.add(ComponentUtil.literal(" on bleed proc deals 10% of max health as damage").withStyle(ChatFormatting.DARK_GRAY));
}
}

if (stack.isEnchanted()) {
tooltip.add(ComponentUtil.emptyLine());
DecimalFormat df = ClientTextUtil.getDecimalFormatter("#,###,###");
tooltip.add(TextComponentUtil.getTooltipText("nutrients_fuel").withStyle(ChatFormatting.GRAY));
tooltip.add(ComponentUtil.literal(" %s/%s".formatted(df.format(getNutrients(stack)), df.format(getMaxNutrients(stack)))).withStyle(TextStyles.NUTRIENTS));
tooltip.add(TextComponentUtil.getTooltipText("blood_charge").withStyle(ChatFormatting.GRAY));
tooltip.add(ComponentUtil.literal(" %s/%s".formatted(df.format(getCharge(stack)), df.format(getMaxCharge(stack)))).withStyle(TextStyles.ERROR));

switch (getLivingToolState(stack)) {
case BROKEN -> {
tooltip.add(ComponentUtil.emptyLine());
tooltip.add(getLivingToolState(stack).getTooltip());
}
case DORMANT -> {
tooltip.add(ComponentUtil.emptyLine());
tooltip.add(getLivingToolState(stack).getTooltip().withStyle(TextStyles.ITALIC_GRAY));
tooltip.add(ClientTextUtil.pressButtonTo(ClientTextUtil.getDefaultKey(), TextComponentUtil.getTooltipText("action.awaken")));
}
case AWAKENED -> {
tooltip.add(ComponentUtil.emptyLine());
tooltip.add(getLivingToolState(stack).getTooltip().withStyle(TextStyles.ITALIC_GRAY));
tooltip.add(ClientTextUtil.pressButtonTo(ClientTextUtil.getDefaultKey(), TextComponentUtil.getTooltipText("action.make_drowsy")));
}
}
}

Expand Down

0 comments on commit c8940a6

Please sign in to comment.