Beacon not properly whitelisted because config requires localized name [1.12.2]
jchung01 opened this issue ยท 3 comments
With just this mod, the beacon's beam will be culled because the expected format in the config's whitelist is wrong. According to the line here, the block entity whitelist in the config uses the localized name of the tile entity. Perhaps you meant to use Block#getTranslationKey(), which gives you the "unlocalized" name with tile. prepended to it? This would allow the default tile.beacon to properly be whitelisted. I believe another option would be to get the tile entity name from its registry, which would instead align the format with the modern versions of this mod, using modid:tile_entity_name.
I'll be honest, this code is really old and not too much tested(just that it basically works), and the 1.8/1.12 version(same source code more or less) have a few oddities, having to use the translationkey being one of them. At least in 1.8 I wasn't able to find anything that looked like the normal minecraft:beacon syntax, so I just assumed that 1.8/1.12 don't use namespace keys yet. Getting keys from a registry sounds a bit expensive, might need to build a cache on the fly. Will check whats going on with beacons later.
To clarify, in its current state, the beacon will get correctly whitelisted if in the config it is Beacon instead of tile.beacon.
Using the beacon as an example, here's what I believe are the correct ways to get the names for the following formats (entry being the tile entity):
Beacon=entry.getBlockType().getLocalizedName(): This is the current behavior, whitelists by localized nametile.beacon=entry.getBlockType().getTranslationKey(): Whitelists by unlocalized nameminecraft:beacon=entry.getBlockType().getRegistryName().toString():IForgeRegistryEntry.Impl#getRegistryName()is a Forge method, whitelists by themodid:block_nameformat. I don't believe this is expensive, as it is just getting the resource location from the Block's superclassImpl's instance variabledelegate.