Skip to content

Commit

Permalink
feat: Simple tooltip explaining the facade types.
Browse files Browse the repository at this point in the history
  • Loading branch information
Rover656 committed Dec 29, 2024
1 parent aba594b commit 6e12e81
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -38,5 +38,7 @@
"tooltip.enderio.conduit.fluid.multi": "Allows multiple fluids to be transported on the same line",
"tooltip.enderio.conduit.fluid.raw_rate": "Rate: %s mB/graph tick",
"tooltip.enderio.conduit.item.effective_rate": "Effective Rate: %s Items/sec",
"tooltip.enderio.conduit.item.raw_rate": "Rate: %s Items/graph tick"
"tooltip.enderio.conduit.item.raw_rate": "Rate: %s Items/graph tick",
"tooltip.enderio.conduit_facade.blast_resist": "Hardened: Resists breaking and explosions",
"tooltip.enderio.conduit_facade.transparent": "Transparent: Hides conduits when painted with a translucent block"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
package com.enderio.conduits.common.conduit.facades;

import com.enderio.conduits.EnderIOConduits;
import com.enderio.conduits.common.init.ConduitCapabilities;
import com.enderio.conduits.common.init.ConduitLang;
import com.enderio.core.common.util.TooltipUtil;
import net.minecraft.world.item.ItemStack;
import net.neoforged.bus.api.SubscribeEvent;
import net.neoforged.fml.common.EventBusSubscriber;
import net.neoforged.neoforge.event.entity.player.ItemTooltipEvent;

@EventBusSubscriber(modid = EnderIOConduits.MODULE_MOD_ID, bus = EventBusSubscriber.Bus.GAME)
public class FacadeTooltipHandler {
@SubscribeEvent
public static void addTooltip(ItemTooltipEvent event) {
ItemStack stack = event.getItemStack();
var facade = stack.getCapability(ConduitCapabilities.ConduitFacade.ITEM);

if (facade != null) {
if (facade.type().doesHideConduits()) {
event.getToolTip().add(TooltipUtil.style(ConduitLang.TRANSPARENT_FACADE_TOOLTIP));
}

if (facade.type().isBlastResistant()) {
event.getToolTip().add(TooltipUtil.style(ConduitLang.BLAST_RESIST_FACADE_TOOLTIP));
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,9 @@ public class ConduitLang {
public static final Component CONDUIT_INSERT = addTranslation("gui", EnderIOBase.loc("conduit.insert"), "Insert");
public static final Component CONDUIT_EXTRACT = addTranslation("gui", EnderIOBase.loc("conduit.extract"), "Extract");

public static final MutableComponent TRANSPARENT_FACADE_TOOLTIP = addTranslation("tooltip", EnderIOBase.loc("conduit_facade.transparent"), "Transparent: Hides conduits when painted with a translucent block");
public static final MutableComponent BLAST_RESIST_FACADE_TOOLTIP = addTranslation("tooltip", EnderIOBase.loc("conduit_facade.blast_resist"), "Hardened: Resists breaking and explosions");

private static MutableComponent addTranslation(String prefix, ResourceLocation id, String translation) {
return EnderIOConduits.REGILITE.addTranslation(prefix, id, translation);
}
Expand Down

0 comments on commit 6e12e81

Please sign in to comment.