diff --git a/src/api/java/baritone/api/utils/BlockOptionalMeta.java b/src/api/java/baritone/api/utils/BlockOptionalMeta.java index 451d95eb..020df814 100644 --- a/src/api/java/baritone/api/utils/BlockOptionalMeta.java +++ b/src/api/java/baritone/api/utils/BlockOptionalMeta.java @@ -188,13 +188,20 @@ public final class BlockOptionalMeta { return (C) value; } + /** + * Normalizes the specified blockstate by setting meta-affecting properties which + * are not being targeted by the meta parameter to their default values. + *
+ * For example, block variant/color is the primary target for the meta value, so properties + * such as rotation/facing direction will be set to default values in order to nullify + * the effect that they have on the state's meta value. + * + * @param state The state to normalize + * @return The normalized block state + */ public static IBlockState normalize(IBlockState state) { IBlockState newState = state; - // TODO: Can the state not be normalized by simply doing...? - // return state.getBlock().getDefaultState(); - // ??? - for (IProperty> property : state.getProperties().keySet()) { Class> valueClass = property.getValueClass(); if (normalizations.containsKey(property)) { @@ -224,6 +231,15 @@ public final class BlockOptionalMeta { return newState; } + /** + * Evaluate the target meta value for the specified state. The target meta value is + * most often that which is influenced by the variant/color property of the block state. + * + * @see #normalize(IBlockState) + * + * @param state The state to check + * @return The target meta of the state + */ public static int stateMeta(IBlockState state) { return state.getBlock().getMetaFromState(normalize(state)); }