Skip to content

OreSight rendering broken: '#' prefix in oretag prevents block matching #20

@theosib

Description

@theosib

Bug Description

OreSight potions/charms do not highlight any ores in version 21.1.113-1.0.1 (1.21.1 NeoForge). The potions apply correctly, the block scanner runs, but no ores are ever rendered.

Root Cause

In RenderEnqueue.blockFinder(), the tag matching logic compares TagKey.location().toString() against BlockData.getoreTag():

if (!block.location().toString().contains(data.getoreTag())) continue;
  • block.location().toString() returns "c:ores/diamond" (no # prefix)
  • data.getoreTag() returns "#c:ores/diamond" (with # prefix, as stored in both hardcoded defaults and config JSON files)

Since "c:ores/diamond".contains("#c:ores/diamond") is always false, no ores ever match and nothing is rendered. This affects all ores, both built-in defaults and config-added ones.

Additional issue: findAny() only matches one tag

The original code uses findAny() to get a single tag containing "ores/" from a block's tags. If a block has multiple tags matching this filter (e.g. both c:ores/diamond and c:ores from a parent tag), only one is checked. This should iterate over all matching tags.

Additional issue: config-added ore colors

When adding custom ores via config JSON, positive color values (e.g. 8454143 = 0x80FFFF) result in a low/zero alpha byte, making highlights invisible even if tag matching is fixed. The hardcoded defaults all use negative integers (e.g. -12723229 = 0xFF3DA2C3) which have 0xFF in the high byte. Config documentation should note that colors must be specified as signed negative integers to get full opacity.

Fix

Strip the # prefix before comparison:

private static String stripHash(String tag) {
    if (tag != null && tag.startsWith("#")) {
        return tag.substring(1);
    }
    return tag;
}

// In blockFinder():
if (!block.location().toString().contains(stripHash(data.getoreTag()))) continue;

And iterate all matching tags instead of using findAny():

// Replace:
Optional<TagKey> firstTag = currentState.getTags().filter(tag -> tag.toString().contains("ores/")).findAny();
// With:
List<TagKey> oreTags = currentState.getTags().filter(tag -> tag.toString().contains("ores/")).collect(Collectors.toList());
for (TagKey block : oreTags) { ... }

Environment

  • Minecraft 1.21.1
  • NeoForge 21.1.219
  • Potions Master 21.1.113-1.0.1
  • Tested with and without Sodium

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions