Don't care about meta in bom if we have none

This commit is contained in:
Logan Darklock 2019-08-31 20:58:22 -07:00
parent bb2f4da6b6
commit cf12cbbcf4
No known key found for this signature in database
GPG Key ID: B8C37CEDE1AC60EA

View File

@ -104,7 +104,7 @@ public final class BlockOptionalMeta {
block = Block.REGISTRY.getObject(id);
meta = noMeta ? 0 : Integer.parseInt(matchResult.group(2));
blockstates = getStates(block, noMeta ? null : meta);
blockstates = getStates(block, getMeta());
stateHashes = getStateHashes(blockstates);
stackHashes = getStackHashes(blockstates);
}
@ -114,7 +114,7 @@ public final class BlockOptionalMeta {
}
public Integer getMeta() {
return meta;
return noMeta ? null : meta;
}
public boolean matches(@Nonnull Block block) {
@ -128,12 +128,18 @@ public final class BlockOptionalMeta {
public boolean matches(ItemStack stack) {
//noinspection ConstantConditions
return stackHashes.contains(((IItemStack) (Object) stack).getBaritoneHash());
int hash = ((IItemStack) (Object) stack).getBaritoneHash();
if (noMeta) {
hash -= stack.getItemDamage();
}
return stackHashes.contains(hash);
}
@Override
public String toString() {
return String.format("BlockOptionalMeta{block=%s,meta=%s}", block, meta);
return String.format("BlockOptionalMeta{block=%s,meta=%s}", block, getMeta());
}
public static IBlockState blockStateFromStack(ItemStack stack) {