Skip to content

Commit

Permalink
hide harvest tooltip on creative by default
Browse files Browse the repository at this point in the history
(cherry picked from commit 3bce6e1)
  • Loading branch information
deirn committed Jun 17, 2024
1 parent 5d6e4d5 commit eec0fb3
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ public class WailaPluginHarvest implements IWailaPlugin {
public void register(IRegistrar registrar) {
registrar.addFeatureConfig(Options.ENABLED, true);
registrar.addConfig(Options.DISPLAY_MODE, HarvestDisplayMode.MODERN);
registrar.addConfig(Options.CREATIVE, false);
registrar.addComponent(HarvestProvider.INSTANCE, TooltipPosition.BODY, Block.class);
registrar.addEventListener(HarvestProvider.INSTANCE, 3000);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ public class Options {
// @formatter:off
public static final ResourceLocation ENABLED = rl("enabled");
public static final ResourceLocation DISPLAY_MODE = rl("display_mode");
public static final ResourceLocation CREATIVE = rl("creative");
// @formatter:on

public static ResourceLocation rl(String path) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ public enum HarvestProvider implements IBlockComponentProvider, IEventListener {
@Override
public void appendBody(ITooltip tooltip, IBlockAccessor accessor, IPluginConfig config) {
if (!config.getBoolean(Options.ENABLED)) return;
if (accessor.getPlayer().isCreative() && !config.getBoolean(Options.CREATIVE)) return;

updateId = accessor.getUpdateId();
state = accessor.getBlockState();
Expand Down
1 change: 1 addition & 0 deletions src/resources/resources/assets/waila/lang/en_us.json
Original file line number Diff line number Diff line change
Expand Up @@ -343,6 +343,7 @@
"config.waila.plugin_harvest.display_mode_modern" : "Modern",
"config.waila.plugin_harvest.display_mode_classic" : "Classic",
"config.waila.plugin_harvest.display_mode_classic_minimal" : "Classic Minimal",
"config.waila.plugin_harvest.creative" : "Show on Creative",

"config.waila.plugin_wailax" : "Waila Extra",
"config.waila.plugin_wailax.energy" : "Energy",
Expand Down

0 comments on commit eec0fb3

Please sign in to comment.