Skip to content

Commit

Permalink
post cherry-pick fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
deirn committed Jan 11, 2025
1 parent 7add29e commit 2a9bf6f
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
import mcp.mobius.waila.api.component.WrappedComponent;
import mcp.mobius.waila.api.data.FluidData;
import mcp.mobius.waila.plugin.extra.data.FluidDataImpl;
import net.minecraft.core.registries.BuiltInRegistries;
import net.minecraft.core.Registry;
import net.minecraft.network.chat.Component;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.world.level.block.Block;
Expand Down Expand Up @@ -65,7 +65,7 @@ private void addFluidTooltip(ITooltip tooltip, FluidDataImpl data, IPluginConfig
text += " " + displayUnit.symbol;

var sprite = desc.sprite();
tooltip.setLine(FluidData.ID.withSuffix("." + BuiltInRegistries.FLUID.getKey(entry.fluid()).toLanguageKey()), new PairComponent(
tooltip.setLine(new ResourceLocation(FluidData.ID.getNamespace(), FluidData.ID.getPath() + "." + Registry.FLUID.getKey(entry.fluid()).toLanguageKey()), new PairComponent(
new WrappedComponent(desc.name().getString()),
new SpriteBarComponent(ratio, sprite, 16, 16, desc.tint(), Component.literal(text))));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,4 +90,8 @@ private static ResourceLocation rl(String rl) {
return new ResourceLocation(rl);
}

public static ResourceLocation withSuffix(ResourceLocation rl, String suffix) {
return new ResourceLocation(rl.getNamespace(), rl.getPath() + suffix);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public void appendBody(ITooltip tooltip, IBlockAccessor accessor, IPluginConfig
valueText.withStyle(value == Boolean.TRUE ? ChatFormatting.GREEN : ChatFormatting.RED);
}
var name = property.getName();
tooltip.setLine(Options.BLOCK_STATE.withSuffix("." + name), new PairComponent(Component.literal(name), valueText));
tooltip.setLine(Options.withSuffix(Options.BLOCK_POSITION, "." + name), new PairComponent(Component.literal(name), valueText));
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@ public enum ItemEntityProvider implements IEntityComponentProvider {

INSTANCE;

private static final ResourceLocation AUTHOR = Options.BOOK_WRITTEN.withSuffix(".author");
private static final ResourceLocation GENERATION = Options.BOOK_WRITTEN.withSuffix(".generation");
private static final ResourceLocation AUTHOR = Options.withSuffix(Options.BOOK_WRITTEN, ".author");
private static final ResourceLocation GENERATION = Options.withSuffix(Options.BOOK_WRITTEN, ".generation");

private static long lastEnchantmentTime = 0;
private static int enchantmentIndex = 0;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ public enum PandaProvider implements IEntityComponentProvider {

INSTANCE;

private static final ResourceLocation PERSONALITY = Options.PANDA_GENES.withSuffix(".personality");
private static final ResourceLocation TRAITS = Options.PANDA_GENES.withSuffix(".traits");
private static final ResourceLocation PERSONALITY = Options.withSuffix(Options.PANDA_GENES, ".personality");
private static final ResourceLocation TRAITS = Options.withSuffix(Options.PANDA_GENES, ".traits");

@Override
public void appendBody(ITooltip tooltip, IEntityAccessor accessor, IPluginConfig config) {
Expand Down

0 comments on commit 2a9bf6f

Please sign in to comment.