Lib Block Attributes

Lib Block Attributes

853k Downloads

FluidKeys.EMPTY could have a better name

williambl opened this issue ยท 4 comments

commented

I know there is a comment saying "Empty doesn't have a proper sprite or text component because it doesn't ever make sense to use it." However, if the empty fluid key had a less out-of-place name, it'd cut down on code like this:

private Text getFluidName(FluidKey key) {
    if (key == FluidKeys.EMPTY)
        return someOtherValue;
    else return key.name;
}

such as what is in my mod.

My suggestions for names are:
new LiteralText("None") - makes sense in most contexts.
new LiteralText("Empty") - close to current, but less out-of-place.
Blocks.AIR.getName() - this may look insane, but it has a couple of things going for it:

  • In most cases, an empty container is filled with air.
  • It's localised.
  • if this is done, then
someFluidKey.name

and

someRawFluid.toBlockstate().getBlock().getName()

(which is, afaik, the only way to get the name of a vanilla fluid)
will be the same, disregarding formatting.

commented

That's a good point - so far I've been assuming that everyone would be happy with re-using LBA's own fluid tooltip methods (For example getFluidVolume(stack).addFullTooltip(getCapacity(stack), tooltip); should add a tooltip similar to Empty 16 Bucket Tank or 5 Buckets of Water in a 16 Bucket Tank, or at least it would do if it wasn't buggy :/ )

I'll add a localisable string "libblockattributes.fluid.empty": "Empty" as I think that's probably simplest.

commented

(I've pushed this in 0.8.2-pre.6).

commented

I'll admit though it does result in an awkward tooltip - while Big Bucket: Empty or Empty Big Bucket would make sense (similar to how vanilla localises fluids in buckets), I'm not so sure about Fluid: Empty. (So you might want to special-case empty anyway?)

commented

Fluid: Empty seems fine to me tbh - as long as it's not in all caps and with exclamation marks then it's fine :p Thanks for changing this! :)