The Hordes

The Hordes

5M Downloads

[Compat] Visual bug with Stylish Effects mod

mpustovoi opened this issue ยท 6 comments

commented

The line +45% protection against infection also appears in the description of any other effect, even if the player is not affected by the Infection Immunity effect, if the Stylish Effects mod is installed (https://modrinth.com/mod/stylish-effects )
image
image
It looks especially weird with the Infection effect:
image
Maybe the difference in description handlers plays a role, since they aren't present by default in Stylish Effects and you need to install either Just Enough Effect Descriptions or EMI Effects mod as well as add lines like this to the lang file:

  "effect.hordes.infected.description": "Kills the player, turning him into a zombie after the expiration time",
  "effect.hordes.immunity.description": "Gives +45% protection against zombie infection",

After all, it's generally clear what the effect of Infection Immunity does.

commented

That's not supposed to show up on effects, that's an item tooltip, I don't know why Styllish Effects is adding it to the effect tooltip, or where it's getting 45% from.

It's a bug on stylish effects part, I don't know why it would be pulling that tooltip.

Got it. I'll report it to Stylish Effects
Sorry for the misunderstanding about the origin of this tooltip.

commented

That's not supposed to show up on effects, that's an item tooltip, I don't know why Styllish Effects is adding it to the effect tooltip, or where it's getting 45% from.

It's a bug on stylish effects part, I don't know why it would be pulling that tooltip.

commented

Testing on a minimal setup with only Stylish Effects led to the appearance of another tooltip:
image
Maybe the lack of the EMI Effects mod, which I had in the full setup, played a role.

commented

No that's fine, I just don't know why it's pulling that tooltip and without that I can't do anything to stop it using it.

commented

I can change something about how the tooltips are rendered if neccecary but as far as I can tell I can't see any reason why it would conflict with it.

@SubscribeEvent(priority = EventPriority.HIGH)
public void tooltip(RenderTooltipEvent.GatherComponents event) {
ItemStack stack = event.getItemStack();
Item item = stack.getItem();
List<Component> components = Lists.newArrayList();
if (ClientConfigHandler.cureTooltip.get() && stack.is(HordesInfection.INFECTION_CURES_TAG))
components.add(Component.translatable("tooltip.hordes.cure"));
if (ClientConfigHandler.immunityTooltip.get() && immunityItems.containsKey(item))
PotionUtils.addPotionTooltip(Lists.newArrayList(new MobEffectInstance(HordesInfection.IMMUNITY.get(),
immunityItems.get(item) * 20)), components, 1);
if (ClientConfigHandler.wearableProtectionTooltip.get() && wearableProtection.containsKey(item)) {
int value = wearableProtection.get(item);
if (value == 0) return;
String str = value + "%";
if (value > 0) str = "+" + str;
components.add(Component.translatable("tooltip.hordes.wearableProtection", str).withStyle(ChatFormatting.BLUE));
}
components.forEach(c -> event.getTooltipElements().add(Either.left(c)));
}

"tooltip.hordes.cure": "Cures infection",
"tooltip.hordes.wearableProtection": "%1$s protection against infection",

commented

As you wish.
The only thing I know is that Fuzs usually takes a long time to respond to issues.