Baritone AI pathfinder

Baritone AI pathfinder

72.7k Downloads

Standardize on Blocks.FOO.equals(block) vs block instanceof BlockFoo vs block.equals(Blocks.FOO)

Closed this issue ยท 2 comments

commented
commented

Actually, maybe Never Mind on this. I don't think there's any way to get around having a mix here.

For example, block instanceof BlockStainedGlass is objectively the best way to check if something is stained glass. However, Block.equals is really == under the hood which very enticing from a performance point of view.

Then again, you can't really do this for water or lava, they're BlockStaticLiquid and BlockDynamicLiquid, so Blocks.FLOWING_WATER.equals(x) || Blocks.WATER.equals(x) is sadly the way to go (or even better BlockStateInterface.isWater(x) lol)

commented

Have basically done this everywhere possible lol.

Tons of == ๐Ÿ˜Ž

performance moment