|
已解决,调用blockstate.isIn方法即可。
@Override
public boolean check(World world, BlockPos pos) {
BlockState state = world.getBlockState(pos);
Block block = state.getBlock();
for (var i : matchBlock) {
if(Registries.BLOCK.getEntry(block).matchesKey(Registries.BLOCK.getEntry(i).getKey().get())){
return true;
}
}
for (var i : matchTag){
if(state.isIn(i)){
return true;
}
}
return false;
} |
|