Add metadata support to block/item list config options, fixes #353

This commit is contained in:
Electroblob77
2020-02-21 17:40:08 +00:00
parent d6b64b3576
commit df8fd21c0b
11 changed files with 85 additions and 43 deletions
@@ -32,6 +32,7 @@ import net.minecraft.world.EnumDifficulty;
import net.minecraft.world.World;
import net.minecraftforge.event.ForgeEventFactory;
import net.minecraftforge.fml.common.ObfuscationReflectionHelper;
import org.apache.commons.lang3.tuple.Pair;
import javax.annotation.Nullable;
import java.util.*;
@@ -298,11 +299,10 @@ public final class WizardryUtilities {
* @return True if the given block is a tree block, false if not.
*/
public static boolean isTreeBlock(World world, BlockPos pos){
return world.getBlockState(pos).getBlock() instanceof BlockLog
|| world.getBlockState(pos).getBlock() instanceof BlockCactus
|| world.getBlockState(pos).getBlock().isLeaves(world.getBlockState(pos), world, pos)
|| world.getBlockState(pos).getBlock().isFoliage(world, pos)
|| Arrays.asList(Wizardry.settings.treeBlocks).contains(world.getBlockState(pos).getBlock().getRegistryName());
Block block = world.getBlockState(pos).getBlock();
return block instanceof BlockLog || block instanceof BlockCactus
|| block.isLeaves(world.getBlockState(pos), world, pos) || block.isFoliage(world, pos)
|| Arrays.asList(Wizardry.settings.treeBlocks).contains(Pair.of(block.getRegistryName(), block.getMetaFromState(world.getBlockState(pos))));
}
/**